[JERSEY-881] Package name resource config does not work in OSGi environment Created: 12/Dec/11  Updated: 08/Aug/13  Resolved: 03/Sep/12

Status: Resolved
Project: jersey
Component/s: core
Affects Version/s: None
Fix Version/s: 2.0-m07, 2.0

Type: Bug Priority: Major
Reporter: saikirandaripelli Assignee: Michal Gajdos
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 0 minutes
Time Spent: 23 hours
Original Estimate: 3 hours
Environment:

Operating System: All
Platform: All


Issue Links:
Duplicate
is duplicated by JERSEY-927 Package name resource config does not... Resolved
Issuezilla Id: 527

 Description   

To make a Jersey application work in OSGi environment, the package name
resource configuration has to be replaced by the class name mechanism.
This is quite annoying and should be fixed.



 Comments   
Comment by saikirandaripelli [ 12/Dec/11 ]

Hi,
I am not able to run helloworld-osgi-webapp-1.10 by changing the classNamesResource config to PackagenamesResourceConfig in Apache Felix or Equinox. I tried in jersey 1.8, 1.9 and 1.10.
I just changed the web.xml init params to following, and followed the readme.
I am able to run it, if it is classNamesResourceConfig as provided by default.

<init-param>
<param-name>com.sun.jersey.config.property.resourceConfigClass</param-name>
<param-value>com.sun.jersey.api.core.PackagesResourceConfig</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.sun.jersey.samples.helloworld</param-value>
</init-param>

Comment by Jakub Podlesak [ 20/Dec/11 ]

You should not need to change anything in the example configuration.
The example should run as is out of the box in Apache Felix (look at the readme doc enclosed
in the example root directory).

This gets also automatically tested when you do mvn clean install
using the pax-exam maven plugin.

Could you please re-try, and suggest what from the above does not work for you?

Comment by saikirandaripelli [ 21/Dec/11 ]

The example uses classNamesResourceConfig where we specify individual classnames in web.xml, but i want to use packageNamesResourceConfig where we specify package containing resources.
I went through the Readme, and using example as-is(classNamesResourceConfig) is working fine in felix, but when i change it to use packageNamesResourceConfig it is not working.

Comment by Pavel Bucek [ 27/Jan/12 ]

see http://java.net/jira/browse/JERSEY-927 for steps to reproduce

Comment by Jakub Podlesak [ 27/Mar/12 ]

Setting fix version to 2.0

Comment by Michal Gajdos [ 03/Sep/12 ]

Fixed in Jersey2. Will be migrated to Jersey1.

Comment by Michal Gajdos [ 04/Sep/12 ]

Migrated to Jersey 1.14.

Generated at Sun Mar 01 03:28:50 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.