This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 227712 - Wrong web.xml for Jersey REST services and GlassFish 4
Summary: Wrong web.xml for Jersey REST services and GlassFish 4
Status: VERIFIED FIXED
Alias: None
Product: webservices
Classification: Unclassified
Component: REST (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: David Konecny
URL:
Keywords:
: 228187 (view as bug list)
Depends on:
Blocks: 244109
  Show dependency tree
 
Reported: 2013-03-20 12:05 UTC by Jiri Skrivanek
Modified: 2014-04-27 15:32 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Skrivanek 2013-03-20 12:05:50 UTC
web.xml added to project for Jersey REST web service uses classes from com.sun.jersey package which are not available in GlassFish 4. To reproduce:

- create web project with GlassFish 4
- open new file wizard
- choose "Web Services|RESTful Web Services from Patterns" and click Next
- click Next
- provide package name
- select "Use Jersey specific feature"
- click Finish
- try to deploy project but it fails with message

 Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer. Please see server.log for more details.

Product Version: NetBeans IDE 7.3 (Build 201302132200)
Java: 1.7.0_17; Java HotSpot(TM) 64-Bit Server VM 23.7-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_17-b02
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
Comment 1 TomasKraus 2013-04-03 12:10:57 UTC
This is GlassFish 4 compatibility issue. I was just talking to Jersey team about
    <servlet>
        <servlet-name>ServletAdaptor</servlet-name>
        <servlet-class>
            com.sun.jersey.spi.container.servlet.ServletContainer
        </servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

and looks like this works only in Glassfish 3.
It may be also problem if those samples are for both Glassfish 3 and 4 because it was changed in GlassFish 4.
Comment 2 David Konecny 2013-04-04 00:43:09 UTC
*** Bug 228187 has been marked as a duplicate of this bug. ***
Comment 3 David Konecny 2013-04-04 00:45:29 UTC
In GF4 Jersey 2.0 is used and it is not backward compatible. The web.xml for Jersey 2.0 should use org.glassfish.jersey.servlet.ServletContainer API instead.
Comment 4 David Konecny 2013-04-04 02:51:27 UTC
Jakub, what happened to configuration parameters like com.sun.jersey.api.json.POJOMappingFeature in Jersey 2.0? Are they just renamed to org.glassfish.*?
Comment 5 David Konecny 2013-04-04 04:01:45 UTC
Some small progress in ddd2013086f1 but not complete. There will be more work necessary once I know how things supposed to work in Jersey 2.0.
Comment 6 David Konecny 2013-04-04 04:02:30 UTC
*** Bug 227718 has been marked as a duplicate of this bug. ***
Comment 7 Petr Jiricka 2013-04-04 08:06:30 UTC
BTW, why is this a 73patch-candidate? GF 4 is not supported in NB 7.3.
Comment 8 Jiri Skrivanek 2013-04-04 08:12:30 UTC
Although GlassFish 4 is not supported it is possible to register it. And my understanding was 7.3.1 will be patch release of 7.3.
Comment 9 japod 2013-04-04 09:43:48 UTC
Regarding parameters, there were some more changes then just renaming, and we still do not have everything documented (docs should be improved with the next Jersey 2 release). 
Jersey 2 takes advantage of the new JAX-RS 2.0 API in order to configure certain things.

Regarding JSON, (please note that we recommend MOXy providers for Jersey 2 in GF), there you need to rely on the following feature:
http://jersey.java.net/nonav/apidocs/snapshot/jersey/org/glassfish/jersey/moxy/json/MoxyJsonFeature.html

I.e. you register the above feature with your application.
Comment 10 Petr Jiricka 2013-04-04 10:51:44 UTC
> And my understanding was 7.3.1 will be patch release of 7.3.

From this standpoint, you are right. But after all, all P1-P2 bugs must be fixed in 7.3.1 anyway.
Comment 11 TomasKraus 2013-04-04 13:52:21 UTC
In pre 7.3.1 there was nothing to check that GlassFish version is >= 4.0 so wizard allows to register it.
Comment 12 David Konecny 2013-04-07 23:57:56 UTC
Re patch - the amount of changes to support this is quite big and spans several modules. Fixing this in 7.3.1. should be sufficient. If not I would suggest to simply disallow GF 4.0 or something like that.

few more changes: b9e7bf4d4436, 20524852e86d

While I fixed this particular issue I need to look more thoroughly at the code and review it and possibly find other cases to fix.
Comment 13 Jiri Skrivanek 2013-04-08 11:21:57 UTC
For Java EE 7 project it works. The check box "Use Jersey specific feature" is gone which is intended as I suspect. For Java EE 5 and 6 project I filed a new bug 228369.
Comment 14 Marian Mirilovic 2013-05-03 11:16:19 UTC
So, where exactly is this issue fixed ? Is it already in release73 repository ?
If so, please change SW to '73patch2-fixed',
If not, please backport the fix into release73 ASAP 

Thanks in advance.
Comment 15 David Konecny 2013-05-05 19:16:06 UTC
This was resolved as part of EE7 work for 7.3.1.