I have noticed that there are classloader issues with the Jersey framework while performing the package scanning for Provider classes, etc. This was most notable in WebSphere while things worked locally when using Tomcat. I noticed that when using the package scanning init-parm method in web.xml, Jersey would not pick up any provider classes\resources that were not in the web application itself (we put all our jars into a common lib folder and create a shared library in WebSphere). It wasn’t until I started trolling the Jersey code that I found a comment that said if the package scanning method is not used that Jersey would scan WEB-INF\lib for providers\resources. Once I put our jar files that contained all our provider classes, Jersey was able to find everything. You may want to try this.
Travis Beech | Programmer Analyst |E&J Gallo Winery
From: spudtm [mailto:geeth.demel_at_gmail.com]
Sent: Monday, October 18, 2010 7:30 AM
To: users_at_jersey.dev.java.net
Subject: [Jersey] Re: Jersey does not pick up @Provider
Hi Remon,
How does your web.xml (or the relevant configuration file) looks? While back I had a similar problem when using jersey with Grizzly; When I made sure the packages that contain the providers are passed to the servlet init, it worked. Just a thought; you may have already tried this.
Also, check your war (or jar) file. See whether META-INF/services contain a reference to the JSON provider. If not, then, there may be a problem in the way you create the war/jar file.
- Geeth
On Mon, Oct 18, 2010 at 12:15 PM, Remon van Vliet [via Jersey] <[hidden email]</user/SendEmail.jtp?type=node&node=5647229&i=0>> wrote:
Hi,
I have a GSON message writer and reader annotated as follows :
@Provider
@Singleton
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public class GSONJSONProvider implements MessageBodyWriter<Object>, MessageBodyReader<Object> {
...
}
Now, when I deploy to GF3 Jersey does see it :
INFO: Provider classes found:
class com.exmachina.play2tv.commons.services.GSONJSONProvider
But a bit later does not consider it an appropriate option as a JSON message writer :
SEVERE: A message body writer for Java class com.exmachina.play2tv.service.config.dto.ServiceSettings, and Java type class com.exmachina.play2tv.service.config.dto.ServiceSettings, and MIME media type application/json was not found
SEVERE: The registered message body writers compatible with the MIME media type are:
application/json ->
com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$App
com.sun.jersey.json.impl.provider.entity.JSONArrayProvider$App
com.sun.jersey.json.impl.provider.entity.JSONObjectProvider$App
com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$App
com.sun.jersey.json.impl.provider.entity.JSONListElementProvider$App
*/* ->
com.sun.jersey.core.impl.provider.entity.FormProvider
com.sun.jersey.core.impl.provider.entity.MimeMultipartProvider
com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$General
com.sun.jersey.json.impl.provider.entity.JSONArrayProvider$General
com.sun.jersey.json.impl.provider.entity.JSONObjectProvider$General
com.sun.jersey.json.impl.provider.entity.JSONWithPaddingProvider
com.sun.jersey.core.impl.provider.entity.StringProvider
com.sun.jersey.core.impl.provider.entity.ByteArrayProvider
com.sun.jersey.core.impl.provider.entity.FileProvider
com.sun.jersey.core.impl.provider.entity.InputStreamProvider
com.sun.jersey.core.impl.provider.entity.DataSourceProvider
com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General
com.sun.jersey.core.impl.provider.entity.ReaderProvider
com.sun.jersey.core.impl.provider.entity.DocumentProvider
com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider
com.sun.jersey.core.impl.provider.entity.SourceProvider$SourceWriter
com.sun.jersey.server.impl.template.ViewableMessageBodyWriter
com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$General
com.sun.jersey.json.impl.provider.entity.JSONListElementProvider$General
com.sun.jersey.json.impl.provider.entity.JacksonProviderProxy
com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General
com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General
Does anyone have any idea what i'm doing wrong. The problem occurs using Jersey 1.1.X as well as 1.4.
Regards,
Remon,
________________________________
View message @
http://jersey.576304.n2.nabble.com/Jersey-does-not-pick-up-Provider-tp5646792p5646792.html<http://jersey.576304.n2.nabble.com/Jersey-does-not-pick-up-Provider-tp5646792p5646792.html?by-user=t>
To start a new topic under Jersey, email [hidden email]</user/SendEmail.jtp?type=node&node=5647229&i=1>
To unsubscribe from Jersey, click here<
http://jersey.576304.n2.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=576304&code=Z2VldGguZGVtZWxAZ21haWwuY29tfDU3NjMwNHwtMTcxOTI0ODY2MQ==&by-user=t>.
--
Geeth Ranmal de Mel
Research Assistant
Department of Computing Science
University of Aberdeen
Aberdeen AB24 3UE
Scotland (UK)
Tele : +44 - 1224 - 274174
Fax : +44 - 1224 - 273422
Web :
http://www.csd.abdn.ac.uk/~gdemel
________________________________
View this message in context: Re: Jersey does not pick up @Provider<
http://jersey.576304.n2.nabble.com/Jersey-does-not-pick-up-Provider-tp5646792p5647229.html>
Sent from the Jersey mailing list archive<
http://jersey.576304.n2.nabble.com/> at Nabble.com.