users@jersey.java.net

[Jersey] Re: multipart in Jersey 1.11

From: Ronak Patel <ronak2121_at_yahoo.com>
Date: Mon, 5 Mar 2012 04:25:29 -0800 (PST)

I also just tried just upgrading jersey to 1.11 and Metro to the latest in Glassfish 3.1.1.
However, I get exceptions when uploading my app:

Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.VerifyError: (class: com/snocell/advertising/controller/NaturalJAXBProvider, method: <init> signature: ()V) Bad type in putfield/putstatic. Please see server.log for more details. 


I am compiling with JAXB 2.2.5; which I see is deployed under the Glassfish modules...


________________________________
 From: Ronak Patel <ronak2121_at_yahoo.com>
To: Ronak Patel <ronak2121_at_yahoo.com>; "users_at_jersey.java.net" <users_at_jersey.java.net>
Sent: Sunday, March 4, 2012 6:08 PM
Subject: Re: [Jersey] multipart in Jersey 1.11
 

Because of these issues, I'm going to proceed to downgrade back to the working version of Jersey (1.9.1) + Glassfish (3.1.1).


________________________________
 From: Ronak Patel <ronak2121_at_yahoo.com>
To: Ronak Patel <ronak2121_at_yahoo.com>; "users_at_jersey.java.net" <users_at_jersey.java.net>
Sent: Sunday, March 4, 2012 5:34 PM
Subject: Re: [Jersey] multipart in Jersey 1.11
 

Through some fancy detective work (going through the Glassfish Source Code), I was able to get Glassfish to acknowledge the Multipart Message as a valid one.
It seems Glassfish is now sensitive to catch CRLF separators.

However, I now see:

java.lang.NullPointerException
at com.sun.jersey.moxy.MoxyMessageBodyWorker.typeIsKnown(MoxyMessageBodyWorker.java:110)
at com.sun.jersey.moxy.MoxyMessageBodyWorker.isReadable(MoxyMessageBodyWorker.java:133)
at com.sun.jersey.core.spi.factory.MessageBodyFactory._getMessageBodyReader(MessageBodyFactory.java:345)
at com.sun.jersey.core.spi.factory.MessageBodyFactory._getMessageBodyReader(MessageBodyFactory.java:315)
at com.sun.jersey.core.spi.factory.MessageBodyFactory.getMessageBodyReader(MessageBodyFactory.java:298)
at com.sun.jersey.multipart.impl.FormDataMultiPartDispatchProvider$FormDataMultiPartParamInjectable.getValue(FormDataMultiPartDispatchProvider.java:297)
at com.sun.jersey.server.impl.inject.InjectableValuesProvider.getInjectableValues(InjectableValuesProvider.java:46)
at com.sun.jersey.multipart.impl.FormDataMultiPartDispatchProvider$FormDataInjectableValuesProvider.getInjectableValues(FormDataMultiPartDispatchProvider.java:125)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$EntityParamInInvoker.getParams(AbstractResourceMethodDispatchProvider.java:153)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:203)
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708)


________________________________
 From: Ronak Patel <ronak2121_at_yahoo.com>
To: "users_at_jersey.java.net" <users_at_jersey.java.net>
Sent: Saturday, March 3, 2012 7:45 AM
Subject: [Jersey] multipart in Jersey 1.11
 

Hi All,

I'm seeing an exception occurring in Jersey 1.11 when I POST this specific Multipart request to the server.
This used to work just fine in Jersey 1.9.1.

This is my request:

POST /service/v2/posting/ HTTP/1.1
Host: testserver.dyndns.org:8080
User-Agent: CFNetwork/548.0.3 Darwin/11.2.0
Content-Length: 269
Accept: application/json
Content-Type: multipart/form-data; boundary=Boundary_1_27742346_1325633997534
Accept-Encoding: gzip
MIME-Version: 1.0
Accept-Language: en-us
Connection: keep-alive


--Boundary_1_27742346_1325633997534
Content-Disposition: form-data; name="resortId"
Content-Type: text/plain

0
--Boundary_1_27742346_1325633997534
Content-Disposition: form-data; name="text"
Content-Type: text/plain

yo
--Boundary_1_27742346_1325633997534--

Glassfish throws a 500 and says:

Caused by: org.apache.catalina.fileupload.MultipartStream$MalformedStreamException: Stream ended unexpectedly
at org.apache.catalina.fileupload.MultipartStream$ItemInputStream.makeAvailable(MultipartStream.java:960)
at org.apache.catalina.fileupload.MultipartStream$ItemInputStream.read(MultipartStream.java:867)
at java.io.InputStream.read(InputStream.java:82)
at org.apache.catalina.fileupload.Streams.copy(Streams.java:137)
at org.apache.catalina.fileupload.Streams.copy(Streams.java:107)
at org.apache.catalina.fileupload.Multipart.initParts(Multipart.java:157)
at org.apache.catalina.fileupload.Multipart.init(Multipart.java:101)
... 62 more

What gives?

This error is now blocking the launch of my software....