users@jersey.java.net

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

From: Saavedra, Gisella <gsaavedra_at_zebra.com>
Date: Fri, 27 Aug 2010 18:34:42 -0500

thank you, Paul.

I fixed the problem by removing the attribute filesonly="true" (default is false) from our zip and jar tasks used for creating the ..jar files.
It is working now.


-----Original Message-----
From: Paul Sandoz [mailto:Paul.Sandoz_at_oracle.com]
Sent: Friday, August 27, 2010 2:04 AM
Cc: users_at_jersey.dev.java.net
Subject: Re: [Jersey] FW: Jersey 1.3 & Apache CXF

Hi Gisella,

Ah yes, i have seen that issue before with ant jar creation not
creating directories, but i do not have a solution.

Paul.


On Aug 26, 2010, at 5:46 PM, Saavedra, Gisella wrote:

> Paul,
>
> our application is very large.
>
> I debugged Jersey 1.3/Tomcat (6.0.28), and when it looks for the
> packages I provided, by using ReflectionHelper, it finds the class
> loader
>
> org.apache.catalina.loader.WebappClassLoader
> delegate: false
> repositories:
> /WEB-INF/classes/
> ----------> Parent Classloader:
> org.apache.catalina.loader.StandardClassLoader_at_f42ad0
>
> I see that our .jar file that has the REST classes as one of the
> jarRealFiles/jarFiles in the tomcat classLoader object. The jar that
> has the rest classes is in WEB-INF/lib.
> 1. After some debugging and testing, the code at line 1280 of
> tomcat's WebappClassLoader never finds a directory (package), only
> files.
> JarEntry jarEntry = jarFiles[i].getJarEntry(name);
> So, it does not find my package: "com/navis/carina/diagnostic/rest/
> resources" in the .jar file, neither does it find "com/navis/carina/
> diagnostic/rest/resources/".
> jarEntry comes back as NULL;
> But it DOES find the class file if I pass name as "com/navis/carina/
> diagnostic/rest/resources/MyRestResource.class"
>
> Bottom-line, I wrote a small test, and got the jar entries for my
> jar file and for log4j.jar. So I realized that our .jar has not been
> created properly. The directories (packages) do not have their own
> entries.
> We use ant to create the jar, so I will look at it.
>
> Regards!
>
>
>
> From: Paul Sandoz [mailto:Paul.Sandoz_at_oracle.com]
> Sent: Tuesday, August 24, 2010 2:56 AM
> To: users_at_jersey.dev.java.net
> Subject: Re: [Jersey] FW: Jersey 1.3 & Apache CXF
>
>
> 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
>
>