users@jersey.java.net

Re: [Jersey] Jersey 1.0.3 seems broken

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 15 May 2009 11:00:06 +0200

On May 14, 2009, at 11:13 PM, Gaëtan Sheridan wrote:

>
> Hi Paul,
>
> I found the source of the problem. In my Ant build I use a Maven
> plugin to
> get all my dependencies and then combine them in a single big jar.
>

You can use the following if you like:

http://download.java.net/maven/2/com/sun/jersey/jersey-bundle/1.1.0-ea/jersey-bundle-1.1.0-ea.jar

But it may bundle more than you require (it includes the client, and
json stuff as well).


> I depend on two Jersey jars: jersey-core-1.0.3.jar and
> jersey-server-1.0.3.jar. The problem is that they both contain a file:
> METAINF/services/javax.ws.rs.ext.MessageBodyWriter. When combined,
> the file
> from jersey-server-1.0.3.jar overwrites the one from jersey-
> core-1.0.3.jar.
> That explains the "message body writer not found" error.
>
> In the Jersey 1.0 version the server jar did not define the
> javax.ws.rs.ext.MessageBodyWriter. That's why it was working properly.
>
> I guess combining jar files was not the greatest idea...
>
> Thanks for the prompt reply.
>
> Gaetan
>
> P.S. I like Jersey very much. Nice work!

Thanks!

Glad you resolved your issue,
Paul.

>
>
> Paul Sandoz wrote:
>>
>> Hi Gaetan,
>>
>> Would be it possible to send me a zip of a maven project that
>> reproduces your issue?
>>
>> We automatically, and continuously, test all the samples and have not
>> seen any failures and would not release if such failures occurred, so
>> i am not sure what is going on without seeing more details about your
>> maven project.
>>
>> Thanks,
>> Paul.
>>
>> On May 13, 2009, at 3:51 PM, Gaetan Sheridan wrote:
>>
>>> Hi,
>>>
>>> Jersey 1.0.3 (also 1.0.1 and 1.0.2) breaks resource methods such as:
>>>
>>> @GET
>>> @Produces("text/plain")
>>> public String getSimple()
>>> {
>>> return "something";
>>> }
>>>
>>> Even the provided Helloworld example is broken.
>>>
>>> Also breaks @Produces("text/html"), @Produces("application/xhtml
>>> +xml"), etc.
>>>
>>> Going back to Jersey 1.0 works fine.
>>>
>>> Also, using my own subclasses of javax.ws.rs.ext.MessageBodyWriter
>>> work perfectly with all above versions of Jersey.
>>>
>>> The exception I get is shown below.
>>>
>>> I am using Maven to get Jersey (simply changing "1.0" to "1.0.1",
>>> etc. in the POM.xml).
>>>
>>> Thanks for help.
>>>
>>> Gaëtan Sheridan
>>>
>>>
>>>
>>> The exception is:
>>>
>>> INFO: Started org.mortbay.jetty.Server_at_19d0a1
>>> 13-May-2009 9:29:20 AM
>>> com.sun.jersey.spi.container.ContainerResponse write
>>> SEVERE: A message body writer for Java type, class java.lang.String,
>>> and MIME media type, application/xhtml+xml, was not found
>>> 13-May-2009 9:29:20 AM
>>> com.sun.jersey.server.impl.application.WebApplicationImpl
>>> onException
>>> SEVERE: Internal server error
>>> javax.ws.rs.WebApplicationException
>>> at
>>> com
>>> .sun
>>> .jersey
>>> .spi.container.ContainerResponse.write(ContainerResponse.java:
>>> 240)
>>> at
>>> com
>>> .sun
>>> .jersey
>>> .server
>>> .impl
>>> .application
>>> .WebApplicationImpl._handleRequest(WebApplicationImpl.java:593)
>>> at
>>> com
>>> .sun
>>> .jersey
>>> .server
>>> .impl
>>> .application
>>> .WebApplicationImpl.handleRequest(WebApplicationImpl.java:514)
>>> at
>>> com
>>> .sun
>>> .jersey
>>> .server
>>> .impl
>>> .application
>>> .WebApplicationImpl.handleRequest(WebApplicationImpl.java:505)
>>> at
>>> com
>>> .sun
>>> .jersey
>>> .spi
>>> .container.servlet.ServletContainer.service(ServletContainer.java:
>>> 359)
>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>>> at
>>> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
>>> 428)
>>> at
>>> org
>>> .mortbay
>>> .jetty
>>> .servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:
>>> 473)
>>> at
>>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
>>> 568)
>>> at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
>>> at
>>> org
>>> .mortbay
>>> .jetty
>>> .servlet.WebApplicationContext.handle(WebApplicationContext.java:
>>> 633)
>>> at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
>>> at org.mortbay.http.HttpServer.service(HttpServer.java:909)
>>> at org.mortbay.http.HttpConnection.service(HttpConnection.java:
>>> 816)
>>> at
>>> org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:982)
>>> at org.mortbay.http.HttpConnection.handle(HttpConnection.java:
>>> 833)
>>> at
>>> org
>>> .mortbay.http.SocketListener.handleConnection(SocketListener.java:
>>> 244)
>>> at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:
>>> 357)
>>> at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:
>>> 534)
>>> 13-May-2009 9:29:20 AM
>>> com.sun.jersey.spi.container.ContainerResponse write
>>> SEVERE: A message body writer for Java type, class java.lang.String,
>>> and MIME media type, application/octet-stream, was not found
>>> 13-May-2009 9:29:20 AM org.mortbay.jetty.servlet.ServletHandler
>>> handle
>>> WARNING: /srv/ws/doc/resources:
>>> javax.ws.rs.WebApplicationException
>>> at
>>> com
>>> .sun
>>> .jersey
>>> .spi.container.ContainerResponse.write(ContainerResponse.java:
>>> 240)
>>> at
>>> com
>>> .sun
>>> .jersey
>>> .server
>>> .impl
>>> .application
>>> .WebApplicationImpl._handleRequest(WebApplicationImpl.java:599)
>>> at
>>> com
>>> .sun
>>> .jersey
>>> .server
>>> .impl
>>> .application
>>> .WebApplicationImpl.handleRequest(WebApplicationImpl.java:514)
>>> at
>>> com
>>> .sun
>>> .jersey
>>> .server
>>> .impl
>>> .application
>>> .WebApplicationImpl.handleRequest(WebApplicationImpl.java:505)
>>> at
>>> com
>>> .sun
>>> .jersey
>>> .spi
>>> .container.servlet.ServletContainer.service(ServletContainer.java:
>>> 359)
>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>>> at
>>> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
>>> 428)
>>> at
>>> org
>>> .mortbay
>>> .jetty
>>> .servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:
>>> 473)
>>> at
>>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
>>> 568)
>>> at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
>>> at
>>> org
>>> .mortbay
>>> .jetty
>>> .servlet.WebApplicationContext.handle(WebApplicationContext.java:
>>> 633)
>>> at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
>>> at org.mortbay.http.HttpServer.service(HttpServer.java:909)
>>> at org.mortbay.http.HttpConnection.service(HttpConnection.java:
>>> 816)
>>> at
>>> org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:982)
>>> at org.mortbay.http.HttpConnection.handle(HttpConnection.java:
>>> 833)
>>> at
>>> org
>>> .mortbay.http.SocketListener.handleConnection(SocketListener.java:
>>> 244)
>>> at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:
>>> 357)
>>> at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:
>>> 534)
>>> HTTP: 09:29:20 925 INFO [ ] JettyWebServer
>>> 127.0.0.1 - GET /srv/ws/doc/resources HTTP/1.1 500 "-" "Mozilla/5.0
>>> (Windows; U; Windows NT 6.0 x64; en-US; rv:1.9.0.7) Gecko/2009030713
>>> Minefield/3.0.7"
>>
>>
>>
>
> --
> View this message in context: http://n2.nabble.com/Jersey-1.0.3-seems-broken-tp2884340p2901771.html
> Sent from the Jersey mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>