users@jersey.java.net

[Jersey] Not able to use packageNamesResourceConfig in OSGI environment

From: saikiran daripelli <saikirandaripelli_at_gmail.com>
Date: Thu, 15 Dec 2011 17:05:28 +0530

Hi,

     Currently we are using Jersey 1.8 and i am still not able to make
jersey work in OSGI specifying packages names.

    I am able to run the same war in normal web container.

    Here are the steps i followed,

    1. Downloaded helloworld-osgi-webapp-1.11-project.zip, changed the
web.xml init params to following,

       <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>

      2. Installed Apache Felix latest version,4.0.2.

      3. Followed the steps specified in README.html inside the helloworld
zip.



      But, when i hit the URL, it shows 500 Internal Server Error.

      I further tried to debug log, and got the below error message



          Dec 13, 2011 10:11:22 PM
com.sun.jersey.api.core.PackagesResourceConfig init

INFO: Scanning for root resource and provider classes in the packages:

com.sun.jersey.samples.helloworld

Dec 13, 2011 10:11:45 PM
com.sun.jersey.server.impl.application.WebApplicationImpl _initiate

INFO: Initiating Jersey application, version 'Jersey: 1.9 09/02/2011 11:17
AM'

DEBUG: DYNAMIC WIRE: [58.0] osgi.wiring.package; (osgi.wiring.package=*) ->
[0]

DEBUG: Bundle com.sun.jersey.jersey-core [58]
com/sun/jersey/impl/impl_en.properties not found by
com.sun.jersey.jersey-core [58]

DEBUG: Bundle com.sun.jersey.jersey-core [58]
com/sun/jersey/impl/impl_en_US.properties not found by
com.sun.jersey.jersey-core [58]

Dec 13, 2011 10:11:45 PM
com.sun.jersey.server.impl.application.RootResourceUriRules <init>

SEVERE: The ResourceConfig instance does not contain any root resource
classes.





Are we doing anything wrong here? Do we need to pass anymore settings?

There was a Jira JERSEY-527 for it but it is marked as resolved longback,
and still i am unable to use packageNamesResourceConfig.

I logged a JIRA JERSEY-881.



Regards,

Saikiran