users@jersey.java.net

Re: [Jersey] FW: Jersey 1.3 & Apache CXF

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Tue, 24 Aug 2010 11:55:54 +0200

On Aug 23, 2010, at 11:21 PM, Saavedra, Gisella wrote:

> thank you, Paul.
>
> I ran into an issue a long time back when using param
> "com.sun.jersey.config.property.packages". Somehow, I never
> determined why, but jersey does not look for the package names
> inside .jar files in my class path. It only looks at whatever is
> under "classes".
>
> I am looking at how I can override the ScanningResourceConfig in
> PackagesResourceConfig to allow for searching the packages inside
> the .jar files in my classpath.
> Or whaever you recommend. The classes that implement the REST beans
> are in a .jar.
>

> I remember when I reported this that you said that you tested it and
> it worked on your side. We use tomcat 6, Spring 2.5 and hibernate
> 3.3. I do not know if the Spring injection and/or
> timing of loading the servlets (<load-on-startup> parameter in
> web.xml) might help. I would prefer to know if there is a class/
> method I can override to tell Jersey to look for these packages in
> the .jar files in my classpath.
>

Package scanning will look for classes inside jar files of WEB-INF/
lib. In general it works for any class that is within the scope of the
web app class loader (and Jersey works out if it is contained in a jar
or is in a file). It should work for Tomact, there have been issues in
the past with JBoss app server because it uses a proprietary URI scheme.

Please look at the hello world web app sample:

   http://download.java.net/maven/2/com/sun/jersey/samples/helloworld-webapp/1.3/helloworld-webapp-1.3-project.zip

does that work for you?

Scanning should also work in conjuction with spring-registered root
resource classes:

   https://jersey.dev.java.net/nonav/apidocs/latest/contribs/jersey-spring/com/sun/jersey/spi/spring/container/servlet/package-summary.html

Other than that all i can suggest is you send me a reproducible test
case.

Paul.

> Thanks,
>
> Gisella
>
>
> -----Original Message-----
> From: Paul Sandoz [mailto:Paul.Sandoz_at_oracle.com]
> Sent: Monday, August 23, 2010 2:19 AM
> To: users_at_jersey.dev.java.net
> Subject: Re: [Jersey] FW: Jersey 1.3 & Apache CXF
>
> Hi Gisella,
>
> Some components of the CXF JAX-RS implementation are being picked up
> when scanning all classes in WEB-INF/lib and WEB-INF/classes
>
> Configure your web app to use package scanning instead. Add the
> following init param to your servlet:
>
> <init-param>
> <param-name>com.sun.jersey.config.property.packages</param-name>
> <param-value>class com.navis.carina.diagnostic.rest.resources</
> param-value>
> </init-param>
>
> Paul.
>
> On Aug 20, 2010, at 8:23 PM, Saavedra, Gisella wrote:
>
>> Sorry, I've sent the message to the wrong list.
>> I found this:
>> https://jersey.dev.java.net/servlets/ReadMsg?list=users&msgNo=4965
>>
>> In any case, any other alternative?
>>
>> Thanks,
>>
>> Gisella
>>
>> From: Saavedra, Gisella
>> Sent: Friday, August 20, 2010 11:01 AM
>> To: 'dev_at_jersey.dev.java.net'
>> Subject: Jersey 1.3 & Apache CXF
>>
>> Hello,
>>
>> I am trying to upgrade from Jersey 1.1.x to Jersey version 1.3, but
>> I get an error for Apache CXF. Our application uses Groovy code
>> that uses Apache CXF.
>> The CFX version I have is 2.1.9. I have also tried version 2.2.10
>> (latest) and get the same errors.
>> We use Tomcat 6.0.26 and JDK 6.0.20.
>>
>> Then I tried to upgrade to Jersey 1.2, and I do not get these errors.
>>
>> Any suggestion?
>>
>> ------------------------------------------------------------------------------ log
>> ----------------
>>
>> Aug 20, 2010 10:16:10 AM
>> com.sun.jersey.api.core.WebAppResourceConfig init
>> INFO: Scanning for root resource and provider classes in the Web app
>> resource paths:
>> /WEB-INF/lib
>> /WEB-INF/classes
>> Aug 20, 2010 10:16:17 AM
>> com.sun.jersey.api.core.ScanningResourceConfig logClasses
>> INFO: Root resource classes found:
>> class com.navis.carina.diagnostic.rest.resources.SNTPResource
>> class com.navis.carina.diagnostic.rest.resources.LogBundleResource
>> class com.navis.carina.diagnostic.rest.resources.LogListResource
>> class
>> com
>> .navis
>> .carina.diagnostic.rest.resources.registry.ApiUpdateActionResource
>> class
>> com
>> .navis
>> .carina
>> .diagnostic.rest.resources.registry.RegistryUpdateServiceResource
>> class
>> com.navis.carina.diagnostic.rest.resources.BeanAttributeResource
>> class
>> com
>> .navis
>> .carina.diagnostic.rest.resources.registry.NotifyUpdateActionResource
>> class
>> com.navis.carina.diagnostic.rest.resources.SelfDiagnosisResource
>> Aug 20, 2010 10:16:17 AM
>> com.sun.jersey.api.core.ScanningResourceConfig logClasses
>> INFO: Provider classes found:
>> class org.apache.cxf.jaxrs.provider.MultipartProvider
>> class org.apache.cxf.jaxrs.provider.AtomFeedProvider
>> class org.apache.cxf.jaxrs.impl.PathSegmentImpl
>> class org.apache.cxf.jaxrs.provider.AegisElementProvider
>> class org.apache.cxf.jaxrs.provider.FormEncodingProvider
>> class org.apache.cxf.jaxrs.provider.XMLBeansJSONProvider
>> class org.apache.cxf.jaxrs.provider.SourceProvider
>> class org.apache.cxf.jaxrs.provider.XMLBeansElementProvider
>> class org.apache.cxf.jaxrs.provider.JSONProvider
>> class org.apache.cxf.jaxrs.provider.AtomEntryProvider
>> class org.apache.cxf.jaxrs.provider.JAXBElementProvider
>> Aug 20, 2010 10:16:17 AM
>> com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
>> INFO: Initiating Jersey application, version 'Jersey: 1.3 06/17/2010
>> 04:53 PM'
>> Aug 20, 2010 10:16:18 AM com.sun.jersey.spi.inject.Errors
>> processErrorMessages
>> SEVERE: The following errors and warnings have been detected with
>> resource and/or provider classes:
>> SEVERE: Missing dependency for field: private
>> org.apache.cxf.jaxrs.ext.MessageContext
>> org.apache.cxf.jaxrs.provider.FormEncodingProvider.mc
>> SEVERE: Missing dependency for method public void
>> org
>> .apache
>> .cxf
>> .jaxrs
>> .provider
>> .JAXBElementProvider
>> .setMessageContext(org.apache.cxf.jaxrs.ext.MessageContext) at
>> parameter at index 0
>> SEVERE: Missing dependency for field: private
>> org.apache.cxf.jaxrs.ext.MessageContext
>> org.apache.cxf.jaxrs.provider.MultipartProvider.mc
>> Aug 20, 2010 10:16:19 AM org.apache.catalina.startup.HostConfig
>> deployDirectory
>> INFO: Deploying web application directory docs
>> Aug 20, 2010 10:16:19 AM org.apache.catalina.startup.HostConfig
>> deployDirectory
>> INFO: Deploying web application directory examples
>> Aug 20, 2010 10:16:19 AM org.apache.catalina.startup.HostConfig
>> deployDirectory
>> INFO: Deploying web application directory ROOT
>> Aug 20, 2010 10:16:19 AM org.apache.coyote.http11.Http11Protocol
>> start
>> INFO: Starting Coyote HTTP/1.1 on http-8280
>> Aug 20, 2010 10:16:19 AM org.apache.jk.common.ChannelSocket init
>> INFO: JK: ajp13 listening on /0.0.0.0:8009
>> Aug 20, 2010 10:16:19 AM org.apache.jk.server.JkMain start
>> INFO: Jk running ID=0 time=0/16 config=null
>> Aug 20, 2010 10:16:19 AM org.apache.catalina.startup.Catalina start
>> INFO: Server startup in 24363 ms
>>
>>
>>
>> - CONFIDENTIAL-
>>
>> This email and any files transmitted with it are confidential, and
>> may also be legally privileged. If you are not the intended
>> recipient, you may not review, use, copy, or distribute this
>> message. If you receive this email in error, please notify the
>> sender immediately by reply email and then delete this email.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>