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 231640 - Issues with javax.ws.rs.Application subclass on non Jersey web server (Tomcat)
Summary: Issues with javax.ws.rs.Application subclass on non Jersey web server (Tomcat)
Status: RESOLVED FIXED
Alias: None
Product: webservices
Classification: Unclassified
Component: REST (show other bugs)
Version: 7.3.1
Hardware: All All
: P3 normal (vote)
Assignee: Milan Kuchtiak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-21 13:53 UTC by Milan Kuchtiak
Modified: 2013-07-20 02:11 UTC (History)
1 user (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 Milan Kuchtiak 2013-06-21 13:53:46 UTC
There are at 2 issues with non Jersey web server (e.g. Tomcat).

1. For Tomcat 6 (JavaEE 5):
   - the REST resources will not work without servlet adaptor specified in web.xml
   Reason is that javax.ws.rs.Application registration requires at least Java EE6 (ServletContextInitializer needed.)

   So the solution, for this case is:
   - add Jersey 2.0 library on classpath
   - don't allow javax.ws.rs.Application subclass creation 
     (disable javax.ws.rs.Application subclass option in REST Resource wizard)

2. For Tomcat 7 (JavaEE 6)
   - the REST resources will not work without Jersey library on classpath
   Solution
   - add Jersey 2.0 library to classpath
Comment 1 David Konecny 2013-06-23 21:37:46 UTC
Re. 1 - this is IMO P4 priority

Re. 2 - this sounds like a bug in Tomcat's impl of JaxRs SPI
Comment 2 Milan Kuchtiak 2013-07-02 12:52:11 UTC
For 2, we may also hide Jersey Configuration panel (Java EE 6+), as it's de facto the same as with GlassFish 4.
Comment 3 Milan Kuchtiak 2013-07-02 15:33:52 UTC
The 2. has already been fixed:
http://hg.netbeans.org/web-main/rev/90e13f698438
Comment 4 Quality Engineering 2013-07-03 02:30:49 UTC
Integrated into 'main-silver', will be available in build *201307022300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/90e13f698438
User: Milan Kuchtiak <mkuchtiak@netbeans.org>
Log: #231640 hide Jersey Choice Panel for Non Jersey Java EE6 server
Comment 5 Milan Kuchtiak 2013-07-03 15:29:28 UTC
Fixed:
http://hg.netbeans.org/web-main/rev/f6afd080fd1e

See that Jersey Configuration panel (choice) is shown only for 
Java EE6 web project on Jersey 1.x server (e.g. GlassFish 3.1).

These are the options:

1. Java EE5 web projects 
  web.xml configuration is used all the time:
  - in combination with javax.ws.rs.core.Application subclass for Jersey 2.0
  - without javax.ws.rs.core.Application (Jersey 1.x server)

2. Java EE7 web projects 
  javax.ws.rs.core.Application subclass without web.xml 

3. Java EE6 + Jersey 1.x (e.g. Glassfish 3.1)
  user has still the choice: web.xml (Jersey) or javax.ws.rs.core.Application subclass 

4. Java EE6 + Jersey 2.x (e.g. Gassfish 4)
  javax.ws.rs.core.Application subclass without web.xml 

5. Java EE6 + non Jersey server (e.g. Tomcat 7)
  the same as (4) + Jersey 2.0 is added to classpath
Comment 6 Quality Engineering 2013-07-04 02:23:31 UTC
Integrated into 'main-silver', will be available in build *201307032300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/f6afd080fd1e
User: Milan Kuchtiak <mkuchtiak@netbeans.org>
Log: #231640: use always web.xml JAX-RS configuration for Java EE 5 project types
Comment 7 Milan Kuchtiak 2013-07-08 11:37:12 UTC
Improved fix for Jersey class-path extension:
http://hg.netbeans.org/web-main/rev/5eb91a5a4464
Comment 8 Quality Engineering 2013-07-10 04:44:07 UTC
Integrated into 'main-silver', will be available in build *201307100049* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/5eb91a5a4464
User: Milan Kuchtiak <mkuchtiak@netbeans.org>
Log: #231640: improve the fix for Jersey classpath extension
Comment 9 Quality Engineering 2013-07-20 02:11:12 UTC
Integrated into 'main-silver', will be available in build *201307192300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/0a0f010a99b6
User: Milan Kuchtiak <mkuchtiak@netbeans.org>
Log: #231640 added missing package name (needed to init-param value)