Sardine put getting ClientProtocolException if not doing list first

826 views
Skip to first unread message

Joanne Kelly

unread,
Nov 26, 2013, 9:14:27 PM11/26/13
to sardi...@googlegroups.com
If I do a list before my put, everything works.
If I do the put right after the begin, I am getting ClientProtocolException

[11/26/13 20:22:24:371 EST] 00000021 servlet       E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: Uncaught exception created in one of the service methods of the servlet SardineTestServlet4 in application SardinePOCEar. Exception created : org.apache.http.client.ClientProtocolException
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:867)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:214)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:160)
at com.github.sardine.impl.SardineImpl.execute(SardineImpl.java:807)
at com.github.sardine.impl.SardineImpl.put(SardineImpl.java:738)
at com.github.sardine.impl.SardineImpl.put(SardineImpl.java:714)
at com.github.sardine.impl.SardineImpl.put(SardineImpl.java:684)
at com.github.sardine.impl.SardineImpl.put(SardineImpl.java:676)
at com.github.sardine.impl.SardineImpl.put(SardineImpl.java:670)
at chubb.SardineTest.test4(SardineTest.java:237)
at SardineTestServlet4.doTask(SardineTestServlet4.java:42)
at SardineTestServlet4.doGet(SardineTestServlet4.java:30)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1663)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:939)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3826)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:445)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:504)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:301)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:275)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1563)
Caused by: org.apache.http.client.NonRepeatableRequestException: Cannot retry request with a non-repeatable request entity.
at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:660)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:486)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
... 37 more

[11/26/13 20:22:24:383 EST] 00000021 FfdcProvider  W com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident emitted on C:\RAD75\runtimes\base_v7\profiles\was70profile1\logs\ffdc\server1_4adc4adc_13.11.26_20.22.24.3755691886356502152147.txt com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest() 298
[11/26/13 20:22:24:392 EST] 00000021 webapp        E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[SardineTestServlet4]: org.apache.http.client.ClientProtocolException
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:867)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:214)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:160)
at com.github.sardine.impl.SardineImpl.execute(SardineImpl.java:807)
at com.github.sardine.impl.SardineImpl.put(SardineImpl.java:738)
at com.github.sardine.impl.SardineImpl.put(SardineImpl.java:714)
at com.github.sardine.impl.SardineImpl.put(SardineImpl.java:684)
at com.github.sardine.impl.SardineImpl.put(SardineImpl.java:676)
at com.github.sardine.impl.SardineImpl.put(SardineImpl.java:670)
at chubb.SardineTest.test4(SardineTest.java:237)
at SardineTestServlet4.doTask(SardineTestServlet4.java:42)
at SardineTestServlet4.doGet(SardineTestServlet4.java:30)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1663)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:939)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3826)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:445)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:504)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:301)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:275)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1563)
Caused by: org.apache.http.client.NonRepeatableRequestException: Cannot retry request with a non-repeatable request entity.
at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:660)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:486)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
... 37 more

Jon Stevens

unread,
Nov 26, 2013, 9:52:49 PM11/26/13
to sardi...@googlegroups.com, sardi...@googlegroups.com
Hi Joanne, have you tried turning up the logging level for sardine and http client to see more details about why the exception is happening?
--
You received this message because you are subscribed to the Google Groups "sardine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sardine-dav...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Jon Stevens

unread,
Nov 26, 2013, 10:15:47 PM11/26/13
to sardi...@googlegroups.com

Joanne Kelly

unread,
Dec 2, 2013, 2:02:14 PM12/2/13
to sardi...@googlegroups.com
Looking at the packets sent prior to the exception, we are sending a Put request with no credentials despite the fact that we specify them when we create the Sardine object using SardineFactory.begin.  No credentials means a 401 unauthorized response -- but the exception we get is for a non-repeatable request.

Basically, when doing a Put request via a Stream, the request is not repeatable.  The way the library is coded, it always tries to access with no credentials first and if it receives a 401 it will repeat the request with the credentials specified.  Since the Put with a Stream is non-repeatable I get the ClientProtocolException
 
Since the List (or Exists) is repeatable it is not a problem that it is tried first without credentials and then again with the credentials.
 
I would like to use sardine but it seems hokey to have to do an exists before the put. Everything else we need to do works really well with sardine.  Our application needs to use the Stream.  The fact that want to use a Stream is one of the reasons we are looking for a replacement of our antiquated solution.  Is there any way around this issue other than doing a List or Exists first?

 
 

Jon Stevens

unread,
Dec 2, 2013, 3:19:35 PM12/2/13
to sardi...@googlegroups.com
Have you tried enabling preemptive authentication? Sardine.enablePreemptiveAuthentication(hostname)


best,

jon



--

Joanne Kelly

unread,
Dec 3, 2013, 11:06:06 AM12/3/13
to sardi...@googlegroups.com
When we:
1) added enablePreemptiveAuthentication 
2) overroad createDefaultSchemeRegistry to use our port for http rather than 80,
the problem was resolved.  We can now do a Put without doing a List or Exists first.

Thanks Jon for the assistance.

Jon Stevens

unread,
Dec 3, 2013, 11:54:11 AM12/3/13
to sardi...@googlegroups.com

On Tue, Dec 3, 2013 at 8:06 AM, Joanne Kelly <jkell...@gmail.com> wrote:
When we:
1) added enablePreemptiveAuthentication 
2) overroad createDefaultSchemeRegistry to use our port for http rather than 80,
the problem was resolved.  We can now do a Put without doing a List or Exists first.

Thanks Jon for the assistance.

Good to hear. I've updated the documentation to be more clear and hopefully help others in the future...


thanks,

jon

Reply all
Reply to author
Forward
0 new messages