I believe that the issue may be caused by the following line:

context.setProperty(HTTPConstants.AUTO_RELEASE_CONNECTION,
Constants.VALUE_TRUE);

Note that Amila's blog doesn't recommend this at all. I believe that
using this property is fundamentally incorrect because it implies that
the HTTP transport will release the connection before the Axis2 kernel
gets a chance to process the response. Amila seems to agree on this
point; see [1].

Andreas

[1] http://markmail.org/thread/hucxz5jckgynyagw

On Tue, Sep 28, 2010 at 11:03, Philippe Frangioni <[email protected]> wrote:
> Hi all,
>
> I'm using Axis2 1.5.1 to expose a Spring bean as a web service. Everything
> works pretty fine.
>
> The client side is configured as described in:
> http://amilachinthaka.blogspot.com/2009/05/improving-axis2-client-http-transport.html
> and:
> http://amilachinthaka.blogspot.com/2010/01/improving-axis2-http-transport-client.html
>
> But once in a while, the client gets this exception:
>
> java.lang.NullPointerException
>         at
> org.apache.axis2.client.ServiceClient.cleanupTransport(ServiceClient.java:824)
>         at
> org.apache.axis2.client.ServiceClient.createClient(ServiceClient.java:650)
>         at
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:538)
>         at
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:521)
>         at
> org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceClient.java:102)
>         at
> com.linxo.services.jobs.impl.JobExplorerProxyImpl.updateJob(JobExplorerProxyImpl.java:210)
>         at
> com.linxo.services.jobs.impl.JobExecutorServiceImpl.updateJob(JobExecutorServiceImpl.java:196)
>         at
> com.linxo.services.sync.impl.AbstractSynchronizationJobProcessor.operationUpdate(AbstractSynchronizationJobProcessor.java:46)
>         at
> com.linxo.sync.provider.AbstractProviderEngine.fireOperationUpdate(AbstractProviderEngine.java:35)
>         at
> com.linxo.provider.caissedepargne.CEProviderEngine.navigateToHistory(CEProviderEngine.java:89)
>         at
> com.linxo.provider.caissedepargne.CEProviderEngine.getTransactions(CEProviderEngine.java:110)
>         at
> com.linxo.services.sync.impl.SynchronizeNowJobProcessor.process(SynchronizeNowJobProcessor.java:136)
>         at sun.reflect.GeneratedMethodAccessor128.invoke(Unknown Source)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:616)
>         at
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
>         at
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
>         at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
>         at
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
>         at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
>         at
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
>         at $Proxy40.process(Unknown Source)
>         at
> com.linxo.services.jobs.impl.JobProcessorWrapperRunnable.invokeJobProcessor(JobProcessorWrapperRunnable.java:87)
>         at
> com.linxo.services.jobs.impl.JobProcessorWrapperRunnable.run(JobProcessorWrapperRunnable.java:32)
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>         at java.lang.Thread.run(Thread.java:636)
>
> This doesn't impact the following web service calls.
>
> This exception occurs at the same place than one of the exceptions noted in:
> https://issues.apache.org/jira/browse/AXIS2-4648
> but the rest of the stack trace is different.
>
> Do you think it could be related?
> Did someone else get this exception?
> Any idea of what's going on?
>
> Here is my client code:
>
> Initialization:
> ------------------
> try {
>       httpConnectionManager = new MultiThreadedHttpConnectionManager();
>       HttpConnectionManagerParams params = new
> HttpConnectionManagerParams();
>
> params.setDefaultMaxConnectionsPerHost(configuration.getMaxConnectionsPerHost());
>       httpConnectionManager.setParams(params);
>
>       final HttpClient httpClient = new HttpClient(httpConnectionManager);
>       rpcServiceClient = new RPCServiceClient();
>       final Options options = rpcServiceClient.getOptions();
>       final ConfigurationContext context =
> rpcServiceClient.getServiceContext().getConfigurationContext();
>       context.setProperty(HTTPConstants.REUSE_HTTP_CLIENT,
> Constants.VALUE_TRUE);
>       context.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);
>       context.setProperty(HTTPConstants.AUTO_RELEASE_CONNECTION,
> Constants.VALUE_TRUE);
>       final EndpointReference targetEPR
>                               = new
> EndpointReference(configuration.getWebServiceEndPointAddress());
>       options.setTo(targetEPR);
>       options.setCallTransportCleanup(true);
>     } catch (AxisFault af) {
>       logger.fatal("AxisFault while starting up web service client", af);
>     }
>
> At each call:
> ---------------------
> try {
>       final QName opMethodName = new
> QName(configuration.getWebServiceNamespace(),
>                                                        "methodName");
>       final Object[] args = new Object[0];
>       final Class[] returnTypes = new Class[]{ Long.class };
>
>       final Object[] response =
> rpcServiceClient.invokeBlocking(opMethodName, args,
>
> returnTypes);
>       return (Long) response[0];
>     } catch (AxisFault af) {
>       logger.error("AxisFault while calling methodName", af);
>       throw buildException(af);
>     }
>     finally {
>       cleanupTransport();
>     }
>
> where cleanupTransport() is:
> -------------------------------------------
>
>   private void cleanupTransport() throws MyException
>   {
>     try {
>       rpcServiceClient.cleanupTransport();
>     }
>     catch(AxisFault af) {
>       logger.error("AxisFault while cleaning up the transport", af);
>       throw buildException(af);
>     }
>   }
>
> and buildException() returns a MyException.
>
>
>
> Thanks for your help,
> Phil
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to