Jersey Client IPv6 - java

Can I use Jersey Client to connect to a REST resource using IPv6?
I'm getting this error:
com.sun.jersey.api.client.ClientHandlerException: java.net.MalformedURLException: For input string: ":94ea:d2bc:c189:209c%10:8100"
at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:128)
at com.sun.jersey.api.client.Client.handle(Client.java:551)
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:556)
at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:69)
at com.sun.jersey.api.client.WebResource$Builder.put(WebResource.java:475)
at com.bmc.aps.agent.jersey.JerseyClient.put(JerseyClient.java:168)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.net.MalformedURLException: For input string: ":94ea:d2bc:c189:209c%10:8100"
at java.net.URL.<init>(URL.java:601)
at java.net.URL.<init>(URL.java:464)
at java.net.URL.<init>(URL.java:413)
at java.net.URI.toURL(URI.java:1081)
at com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:139)
at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:126)
... 8 more
In the exception the ip is cut (:94ea:d2bc:c189:209c%10 instead of fe80::94ea:d2bc:c189:209c%10).
In debug, I can see that the web resource URI is OK.

Found the answer.
Jersey Client expect to get the IP with square parentheses [].
In this example - [fe80::94ea:d2bc:c189:209c%10] instead of - fe80::94ea:d2bc:c189:209c%10.

Related

Jersey, An I/O error has occurred while writing a response message

I use SpringBoot and Jersey into my project and I often tackle the following error :
[ERROR - ServerRuntime$Responder - 2018-02-13 13:16:45,983] An I/O error has occurred while writing a response message entity to the container output stream.
org.glassfish.jersey.server.internal.process.MappableException: org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe
at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:92)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1130)
at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:711)
at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:444)
at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:434)
at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:329)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
It results with a 503 status response to my client.
Could you explain me why this error occured ?
Thanks
This kind of error usually happens servlet is writing data back on the stream and connection closed from client side.
It is like server in sending some data may be file, string, bytes etc.. but on client side like a browser has closed the connection, like you close the browser tab.
It cased early End of file exception on the server.
I have had this exception when I accidentally passed a null Response at the end of a call. You can verify this in the'caused by' section following the first exception:
Caused by: org.eclipse.jetty.io.EofException: null

Getting URISyntaxException in while calling SOAP web service

I'm consuming a SOAP web service. When the service is called, I get this exception:
java.io.IOException: java.net.URISyntaxException: Illegal character in path at index 66:
I tried:
encodedUrl = URLEncoder.encode(encodedUrl, "UTF-8");
and I got this error:
java.lang.IllegalArgumentException: URI is not absolute
at java.net.URI.toURL(URI.java:1088) [rt.jar:1.8.0_91]
at org.apache.cxf.transport.http.URLConnectionHTTPConduit.createConnection(URLConnectionHTTPConduit.java:92)
at org.apache.cxf.transport.http.URLConnectionHTTPConduit.setupConnection(URLConnectionHTTPConduit.java:103)
at org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:478)
at org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:572)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:481)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:382)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:335)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:136)
Make sure your URL value is complete, meaning it should contain a protocal, a host, a port(host and port are optional based on the protocal but for http and https they are mandatory), and the rest of the url

Failed to process JAR found at URL [] for ServletContainerInitializers

I'm upgrading a service from Tomcat 7 -> Tomcat 8, and I'm encountering this issue just now that I'm kinda at a loss for.
Here is the stack trace:
SEVERE: Failed to process JAR found at URL [] for ServletContainerInitializers for context with name [{1}]
java.net.MalformedURLException: no !/ in spec
at java.net.URL.<init>(URL.java:619)
at java.net.URL.<init>(URL.java:482)
at java.net.URL.<init>(URL.java:431)
at java.net.JarURLConnection.parseSpecs(JarURLConnection.java:179)
at java.net.JarURLConnection.<init>(JarURLConnection.java:162)
at sun.net.www.protocol.jar.JarURLConnection.<init>(JarURLConnection.java:81)
at sun.net.www.protocol.jar.Handler.openConnection(Handler.java:41)
at java.net.URL.openConnection(URL.java:971)
at java.net.URL.openStream(URL.java:1037)
at org.apache.catalina.startup.WebappServiceLoader.parseConfigFile(WebappServiceLoader.java:161)
at org.apache.catalina.startup.WebappServiceLoader.load(WebappServiceLoader.java:118)
at org.apache.catalina.startup.ContextConfig.processServletContainerInitializers(ContextConfig.java:1616)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1128)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:771)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:305)
Caused by: java.lang.NullPointerException: no !/ in spec
at sun.net.www.protocol.jar.Handler.parseAbsoluteSpec(Handler.java:170)
at sun.net.www.protocol.jar.Handler.parseURL(Handler.java:150)
at java.net.URL.<init>(URL.java:614)
... 24 more
I know that the whole "URL []" and "context with name [{1}]" looks bad, but I don't know why, or how these values were set the way they were. Can anyone please point me in the right direction as to what's going on?

javax.xml.stream.XMLStreamException: ParseError

We have an Axis2 service running under Tomcat 7. Has anyone seen this
strange exception before?
org.apache.axis2.AxisFault: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,8783]
Message: The content of elements must consist of well-formed character data or markup.
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at omni.web.nms.ws.OmniWebNMSWSStub.fromOM(OmniWebNMSWSStub.java:13816)
at omni.web.nms.ws.OmniWebNMSWSStub.gettingSlotStatusFor1U(OmniWebNMSWSStub.java:29910)
at omni.web.nms.rack1u.TimerFor1uRack.getAllSlotDetailsFromDB(TimerFor1uRack.java:354)
at omni.web.nms.rack1u.TimerFor1uRack.run(TimerFor1uRack.java:119)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Caused by: org.apache.axiom.om.impl.exception.OMStreamingException: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,8783]
Message: The content of elements must consist of well-formed character data or markup.
at org.apache.axiom.om.impl.llom.SwitchingWrapper.getElementText(SwitchingWrapper.java:940)
at javax.xml.stream.util.StreamReaderDelegate.getElementText(StreamReaderDelegate.java:100)
at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.getElementText(XMLStreamReaderWrapper.java:100)
at org.apache.axiom.util.stax.debug.XMLStreamReaderValidator.getElementText(XMLStreamReaderValidator.java:75)
at omni.web.nms.ws.OmniWebNMSWSStub$ArrayOfString$Factory.parse(OmniWebNMSWSStub.java:5561)
at omni.web.nms.ws.OmniWebNMSWSStub$GettingSlotStatusFor1UResponse$Factory.parse(OmniWebNMSWSStub.java:25997)
at omni.web.nms.ws.OmniWebNMSWSStub.fromOM(OmniWebNMSWSStub.java:13789)
... 5 more
This was the same issue that i faced when deploying a Service in Axis 2.
add the axis 2 runtime in
Windows>>Preferences> webservice>> Axis2 preferences
and provide the Axis 2 installation directory
this tutorial helped me a lot
[http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jst.ws.axis2.ui.doc.user%2Ftopics%2Fcaxis2tover.html]

The response could not be parsed

I am using redstone-xmlrpc-1.1.1 api with my code and getting this error:
redstone.xmlrpc.XmlRpcException: The response could not be parsed.
at redstone.xmlrpc.XmlRpcClient.handleResponse(Unknown Source)
at redstone.xmlrpc.XmlRpcClient.endCall(Unknown Source)
at redstone.xmlrpc.XmlRpcClient.invoke(Unknown Source)
at redstone.xmlrpc.XmlRpcProxy.invoke(Unknown Source)
at net.bican.wordpress.$Proxy1.newMediaObject(Unknown Source)
at net.bican.wordpress.Wordpress.newMediaObject(Wordpress.java:582)
at WordpressPost.DataWordpressPost.DataPost(DataWordpressPost.java:53)
at arrestcentral.ArrestData.readPdf(ArrestData.java:420)
at arrestcentral.ArrestData.main(ArrestData.java:447)
Caused by: java.io.FileNotFoundException: http://www.arrestcentral.com/XMLrpc.php?
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1478)
... 9 more
can anyone help me why I am unable to post on wordpress..
Well, the exception tells you what's happened - you've tried to fetch a URL of
http://www.arrestcentral.com/XMLrpc.php?
... and it was giving you an HTTP 404 (not found) error. You probably need to change the URL, but you should have more idea of what that URL should be than we do.
java.io.FileNotFoundException: http://www.arrestcentral.com/XMLrpc.php? should have given you a clue:
Nothing was found at the URL you specified. This means that the server returned a HTTP response with the error code 404.
You either mistyped the URL or it no longer exists (at this location).

Categories

Resources