You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Quintin Beukes <qu...@last.za.net> on 2008/08/04 15:16:46 UTC

Bug causes sending of Content-Length twice

Hey,

I am getting the following exception:
org.apache.http.ProtocolException: Content-Length header already present
    org.apache.http.protocol.RequestContent.process(RequestContent.java:70)

org.apache.http.protocol.BasicHttpProcessor.process(BasicHttpProcessor.java:290)

org.apache.http.protocol.HttpRequestExecutor.preProcess(HttpRequestExecutor.java:160)

org.apache.http.impl.client.DefaultClientRequestDirector.execute(DefaultClientRequestDirector.java:356)

org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:501)

org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:456)

za.co.junkmail.jmobs.integrat.IntegratConnection.createConnection(IntegratConnection.java:242)

za.co.junkmail.jmobs.integrat.IntegratConnection.execute(IntegratConnection.java:152)

za.co.junkmail.jmobs.services.sms.ProcessSMSTicket.onMessage(ProcessSMSTicket.java:113)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)

com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1067)
    com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:176)

com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2895)
    com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3986)

com.sun.ejb.containers.MessageBeanContainer.deliverMessage(MessageBeanContainer.java:1111)

com.sun.ejb.containers.MessageBeanListenerImpl.deliverMessage(MessageBeanListenerImpl.java:74)

com.sun.enterprise.connectors.inflow.MessageEndpointInvocationHandler.invoke(MessageEndpointInvocationHandler.java:179)
    $Proxy903.onMessage(Unknown Source)
    com.sun.messaging.jms.ra.OnMessageRunner.run(OnMessageRunner.java:258)
    com.sun.enterprise.connectors.work.OneWork.doWork(OneWork.java:76)

com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)

Doing the following:

    httpParams = new BasicHttpParams();
    HttpConnectionManagerParams.setMaxTotalConnections(httpParams, 100);
    HttpProtocolParams.setVersion(httpParams, HttpVersion.HTTP_1_1);

    schemeRegistry = new SchemeRegistry();
    schemeRegistry.register(new Scheme("http",
PlainSocketFactory.getSocketFactory(), 80));

    connManager = new ThreadSafeClientConnManager(httpParams,
schemeRegistry);

    httpClient = new DefaultHttpClient(connManager, httpParams);

    byte[] bodyBuf = someContentBody();
    Entity body = ByteArrayEntity(bodyBuf);

    HttpContext context = new
BasicHttpContext(httpClient.getDefaultContext());
    HttpPost request = new HttpPost(integratURI);
    request.setEntity(body);

    HttpResponse response = httpClient.execute(request, context); // the
exception is raised here

There after the message is reposted by the JMS provider, and then it works
fine the next time?!

The only static variables (shared by all, are the connManager,
schemeRegistry, httpParams.

It's causing problems for us, since sometimes the messages is only
redelivered hours later.. so due to some randomness messages are delayed?

If you need more information, or want me to try/test some things, let me
know.
-- 
Quintin Beukes

Re: Bug causes sending of Content-Length twice

Posted by Justin Tay <ju...@gmail.com>.
If you look at DefaultClientRequestDirector in alpha 4, if the execution
causes an IOException the retry attempt causes requestExec.preProcess() to
be called again. I think you would be better off upgrading to trunk and
seeing if you still hit this problem.
-- 
View this message in context: http://www.nabble.com/Bug-causes-sending-of-Content-Length-twice-tp18811097p18821440.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: Bug causes sending of Content-Length twice

Posted by Quintin Beukes <qu...@last.za.net>.
I was doing direct connections though? Could it be the same bug?

What was the nature of the mentioned bug?

Q

On Mon, Aug 4, 2008 at 4:17 PM, justintay <ju...@gmail.com> wrote:

>
> Hi,
>
> I encountered this in alpha 4 when going trying to go through a proxy
> server. It is already fixed in trunk though.
>
> Regards,
> Justin Tay
> --
> View this message in context:
> http://www.nabble.com/Bug-causes-sending-of-Content-Length-twice-tp18811097p18812143.html
> Sent from the HttpClient-User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>


-- 
Quintin Beukes

Re: Bug causes sending of Content-Length twice

Posted by justintay <ju...@gmail.com>.
Hi,

I encountered this in alpha 4 when going trying to go through a proxy
server. It is already fixed in trunk though.

Regards,
Justin Tay
-- 
View this message in context: http://www.nabble.com/Bug-causes-sending-of-Content-Length-twice-tp18811097p18812143.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org