users@jersey.java.net

[Jersey] Re: ReST Service connection failure

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Tue, 06 Mar 2012 07:29:46 +0100

Hello,

looks like its more about container settings than client call. Where is
you container listening? See "netstat -aln" output or its equivalent.
You might be listening only on one interface (localhost) and not the
real one which has assigned mentioned IP address.

Regards,
Pavel

On 3/5/12 10:34 AM, vrb.1324 wrote:
> Hi,
>
> I have Converted an EJB3.0 stateless session bean into ReST web service, I
> have also written client for this service. I am able to invoke the service
> with the URL something like this:
>
> http://localhost:8089/CustomerReSTWeb/rest/customerdetails
>
> However if I replace the loclhost with the IP address of my machine like
> this : http://10.3.150.110:8089/CustomerReSTWeb/rest/customerdetails
> its throwing me the following exeception:
>
>
> com.sun.jersey.api.client.ClientHandlerException: java.io.IOException: Error
> marshalling JAXB object of type "class com.xyz.common.vo.Customer
> at com.sun.jersey.api.client.Client.handle(Client.java:435)
> at com.sun.jersey.api.client.WebResource.handle(WebResource.java:557)
> at com.sun.jersey.api.client.WebResource.post(WebResource.java:227)
> at
> com.xyz.rest.delegate.CustomerIdentificationRestDelegate.getMediumRiskQuestions(CustomerIdentificationRestDelegate.java:27)
> at com.xyz.rest.test.CustomerReSTTest.main(CustomerReSTTest.java:24)
> Caused by: java.io.IOException: Error marshalling JAXB object of type "class
> com.xyz.common.vo.CustomerVO".
> at
> com.sun.jersey.core.provider.jaxb.AbstractRootElementProvider.writeTo(AbstractRootElementProvider.java:145)
> at
> com.sun.jersey.api.client.TerminatingClientHandler.writeRequestEntity(TerminatingClientHandler.java:317)
> at
> com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:179)
> at
> com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:126)
> ... 5 more
> Caused by: javax.xml.bind.MarshalException
> - with linked exception:
> [java.net.ConnectException: Connection refused: connect]
> at
> com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:322)
> at
> com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:246)
> at
> javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:75)
> at
> com.sun.jersey.core.provider.jaxb.AbstractRootElementProvider.writeTo(AbstractRootElementProvider.java:167)
> at
> com.sun.jersey.core.provider.jaxb.AbstractRootElementProvider.writeTo(AbstractRootElementProvider.java:143)
> ... 8 more
> Caused by: java.net.ConnectException: Connection refused: connect
> at java.net.PlainSocketImpl.socketConnect(Native Method)
> at java.net.PlainSocketImpl.doConnect(Unknown Source)
> at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
> at java.net.PlainSocketImpl.connect(Unknown Source)
> at java.net.Socket.connect(Unknown Source)
> at java.net.Socket.connect(Unknown Source)
> at sun.net.NetworkClient.doConnect(Unknown Source)
> at sun.net.www.http.HttpClient.openServer(Unknown Source)
> at sun.net.www.http.HttpClient.openServer(Unknown Source)
> at sun.net.www.http.HttpClient.<init>(Unknown Source)
> at sun.net.www.http.HttpClient.New(Unknown Source)
> at sun.net.www.http.HttpClient.New(Unknown Source)
> at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown
> Source)
> at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
> at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
> at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown
> Source)
> at
> com.sun.jersey.client.urlconnection.URLConnectionClientHandler$1$1.getOutputStream(URLConnectionClientHandler.java:200)
> at
> com.sun.jersey.api.client.CommittingOutputStream.commitWrite(CommittingOutputStream.java:114)
> at
> com.sun.jersey.api.client.CommittingOutputStream.write(CommittingOutputStream.java:86)
> at
> com.sun.xml.bind.v2.runtime.output.UTF8XmlOutput.flushBuffer(UTF8XmlOutput.java:401)
> at
> com.sun.xml.bind.v2.runtime.output.UTF8XmlOutput.endDocument(UTF8XmlOutput.java:132)
> at
> com.sun.xml.bind.v2.runtime.XMLSerializer.endDocument(XMLSerializer.java:835)
> at
> com.sun.xml.bind.v2.runtime.MarshallerImpl.postwrite(MarshallerImpl.java:371)
> at
> com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:318)
> ... 12 more
>
> Please let me know if anybody faced the same problem and know the solution
> for this problem.
>
> Thanks in Adavance!
>
> Rajesh V
>
> --
> View this message in context: http://jersey.576304.n2.nabble.com/ReST-Service-connection-failure-tp7344252p7344252.html
> Sent from the Jersey mailing list archive at Nabble.com.
>