users@jersey.java.net

[Jersey] Re: Jersey FastInfoSet Example?

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Thu, 24 Feb 2011 13:19:49 +0100

Hello Paul,

you don't need declare dependency on fastinfoset directly, it is already
introduced by jersey-fastinfoset. And I'm not sure what is meant by
com.sun.xml.ws:jaxws-rt, it is not needed unless you use JAX-WS in your
application (if you replace FastInfosetMIMETypes./INFOSET/ by
"application/fastinfoset").

I'm not sure what else do you have in your app, but I suspect you might
have declared another not necessary dependencies, so see attachment and
modify your app accordingly (its modified helloworld-webapp sample which
returns some fastinfoset data).

hope it helps,
Pavel


On 02/24/2011 11:16 AM, Oleksiy Stashok wrote:
> Hi Paul,
>
> pretty sure Jersey folks will know this better.
>
> Thanks.
>
> Alexey.
>
> On 02/23/2011 07:19 PM, Paul Arnold wrote:
>>
>> Hi Oleksiys,
>>
>> I hope you might be able to help me.
>>
>> I am trying to implement a Jersey JAX-RS RESTful web service which
>> needs to accept and process FastInfoset documents and am struggling
>> to make it work, and find examples of how to do this.
>>
>> So far I have done the following:
>>
>> 1. Added the 3 dependencies below to Maven my pom.xml file:
>>
>> <dependency>
>>
>> <groupId>com.sun.xml.ws</groupId>
>>
>> <artifactId>jaxws-rt</artifactId>
>>
>> <version>2.1.4</version>
>>
>> </dependency>
>>
>> <dependency>
>>
>> <groupId>com.sun.xml.fastinfoset</groupId>
>>
>> <artifactId>FastInfoset</artifactId>
>>
>> <version>1.2.9</version>
>>
>> </dependency>
>>
>> <dependency>
>>
>> <groupId>com.sun.jersey</groupId>
>>
>> <artifactId>jersey-fastinfoset</artifactId>
>>
>> <version>1.5</version>
>>
>> </dependency>
>>
>> <dependency>
>>
>> 2. Added a new RESTful method to my Resource class.
>>
>> *import* com.sun.xml.ws.encoding.fastinfoset.FastInfosetMIMETypes;
>>
>> @POST
>>
>> @Path("fastInfoset")
>>
>> @Consumes(FastInfosetMIMETypes./INFOSET/)
>>
>> *public* Response postFastInfoset(string data) {
>>
>> *return* Response./ok/().build();
>>
>> }
>>
>> Not sure what type the method argument above should be?
>>
>> All compiles OK, and the Maven .war build completes without errors.
>> The war deployment into Glassfish also works without error.
>>
>> However when I try to send a FastInfoset document (created by Noemax
>> -- one of the vendors on the interoperability list) to my RESTful
>> service I get the following error:
>>
>> [#|2011-02-23T17:59:41.444+0000|WARNING|glassfishv3.0|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=30;_ThreadName=Thread-1;|StandardWrapperValve[qsrest]:
>> PWC1406: Servlet.service() for servlet qsrest threw exception
>>
>> java.lang.NullPointerException
>>
>> at
>> com.sun.jersey.spi.container.ContainerRequest.<init>(ContainerRequest.java:172)
>>
>> at
>> com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:336)
>>
>> at
>> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:452)
>>
>> at
>> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:633)
>>
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
>>
>> at
>> org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
>>
>> at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
>>
>> at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
>>
>> at
>> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
>>
>> at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
>>
>> at
>> com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
>>
>> at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
>>
>> at
>> org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
>>
>> at
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
>>
>> at
>> com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
>>
>> at
>> com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
>>
>> at
>> com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
>>
>> at
>> com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
>>
>> at
>> com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
>>
>> at
>> com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
>>
>> at
>> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
>>
>> at
>> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
>>
>> at
>> com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
>>
>> at
>> com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
>>
>> at
>> com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
>>
>> at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
>>
>> at
>> com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
>>
>> at
>> com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
>>
>> at java.lang.Thread.run(Thread.java:662)
>>
>> |#]
>>
>> Please can you tell me what I am doing wrong, missing and perhaps
>> give me an example of how this is supposed to be done, because I have
>> searched high and low and can't find one!?
>>
>> Thanks in advance.
>>
>> Kind regards,
>>
>> *Paul Arnold
>> Developer*
>>
>> *Innovise ESM** **Software** **Limited *
>>
>> T +44 (0)1753 513 980
>> W *www.pivetal.com <http://www.pivetal.com/>*
>>
>> Please consider the environment before printing this mail.
>>
>> /-------------------------------------------------------------------------------------------------------------
>> /Innovise plc and its group of companies are trading names and
>> registered trademarks of Innovise plc, registered in England
>> (4101777) at Hellier House, Wychbury Court, Two Woods Lane, Brierley
>> Hill, DY5 1TA. This e-mail and any files transmitted with it are
>> confidential and intended solely for the use of the individual or
>> entity to who they are addressed. If you are not the intended
>> recipient, you are hereby notified that any use or dissemination of
>> this communication is strictly prohibited. If you have received this
>> e-mail in error please notify us immediately, then delete this e-mail.
>> /-------------------------------------------------------------------------------------------------------------/
>>
>