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