Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-6354

NullPointer exception in cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:719)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Cannot Reproduce
    • 2.7.2
    • Invalid
    • JAX-WS Runtime
    • None
    • Unknown
    • Important

    Description

      Updated: Please see the comments. This is caused due to a deadlock.
      Overall since DefaultSingletonBeanRegistry is being called from main thread and CXF tries to use it in a seperate thread, it causes deadlock.

      See the comments:
      https://jira.spring.io/browse/SPR-8471
      --------------------

      I have a requirement where I need to move a webservice call to a seperate thread so that I could retry if it doesn't complete within a time limit. To achieve I moved my webservice call to a futuretask and in my main thread I am doing a task.get(timeout). A webservice call that is normally completed in few miliseconds doesn't complete even after 10 mins if I move it into a seperate thread.

      Is there a problem with CXF. I am getting a NullPointer exception around the cxf.endpoint.ClientImpl.onMessage() call. Stacktrace at the end.

      Please help as I am stuck with no clues.

      I am including the code thats causing problems only when I move the call in a seperate thread.

      @Override
      	public IRuleSet loadRuleSet(String ruleSetName) throws RulesEngineException {
      		IRuleSet ruleSet=null;
      		ExecutorService executor = Executors.newFixedThreadPool(1);
      		
      		for (IRuleSetLoader ruleSetLoader : loaders) {
      			try {
      				FutureTask<IRuleSet> task = new FutureTask<IRuleSet>(new LoaderTask(ruleSetLoader, ruleSetName));
      				executor.submit(task);
      				
      				long timeout=30;
      				try{			
      					ruleSet = task.get(timeout, TimeUnit.SECONDS);
      				}catch(Exception e) {
      					LOGGER.info("202::Exception", e);
      				}
                                      // if  I uncomment the below call and comment the above task submit it works perfectly fine.
      				//ruleSet = ruleSetLoader.loadRuleSet(ruleSetName);
      				if (ruleSet != null){
      					return ruleSet;
      				}else {
      					ruleSet = ruleSetLoader.loadRuleSet(ruleSetName);
      				}
      
      			} catch (Exception e) {
      				LOGGER.info("Failed to load rule set " + ruleSetName + " using ruleSetLoader:" + ruleSetLoader.getClass(), e);
      			}
      		}
      		throw new RulesEngineException("Unable to load RuleSet " + ruleSetName);
      
      	}
      
      private final static class LoaderTask implements Callable<IRuleSet> {
      		private final IRuleSetLoader ruleSetLoader;
      		private final String ruleSetName;
      
      		private LoaderTask(IRuleSetLoader ruleSetLoader, String ruleSetName) {
      			this.ruleSetLoader = ruleSetLoader;
      			this.ruleSetName = ruleSetName;
      		}
      
      		@Override
      		public IRuleSet call() throws Exception {
      			LOGGER.info("Starting task.");
      			IRuleSet ruleSet=null;
      			
      			try {
                                      //webservice call
      				ruleSet = ruleSetLoader.loadRuleSet(ruleSetName);
      				
      			} catch (Exception e) {
      				LOGGER.info("101::Exception encountered", e);				
      			}			
      			
      			return ruleSet;
      		}		
      		
      	}
      
      // stacktrace
      17:41:50.940 [pool-3-thread-1] WARN  o.a.c.p.PhaseInterceptorChain - Interceptor for {http://readonly.webservice.rulesengine.tbea.jpm.com/}IRulesEngineReadOnlyWebServiceService#{http://readonly.webservice.rulesengine.tbea.jpm.com/}getRuleSet has thrown exception, unwinding now
      java.lang.NullPointerException: NullPointerException invoking http://psie0p111.svr.emea.jpmchase.net:17190/rules-engine-web/5/rulesEngineReadOnlyWebService: null
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.7.0_67]
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) ~[na:1.7.0_67]
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.7.0_67]
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:526) ~[na:1.7.0_67]
      	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1336) ~[cxf-rt-transports-http-2.7.2.jar:2.7.2]
      	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1325) ~[cxf-rt-transports-http-2.7.2.jar:2.7.2]
      	at org.apache.cxf.io.AbstractWrappedOutputStream.close(AbstractWrappedOutputStream.java:77) ~[cxf-api-2.7.2.jar:2.7.2]
      	at org.apache.cxf.io.AbstractThresholdOutputStream.close(AbstractThresholdOutputStream.java:102) ~[cxf-api-2.7.2.jar:2.7.2]
      	at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:50) ~[cxf-api-2.7.2.jar:2.7.2]
      	at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:229) ~[cxf-api-2.7.2.jar:2.7.2]
      	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) ~[cxf-api-2.7.2.jar:2.7.2]
      	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:622) ~[cxf-rt-transports-http-2.7.2.jar:2.7.2]
      	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) ~[cxf-api-2.7.2.jar:2.7.2]
      	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271) ~[cxf-api-2.7.2.jar:2.7.2]
      	at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:530) [cxf-api-2.7.2.jar:2.7.2]
      	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463) [cxf-api-2.7.2.jar:2.7.2]
      	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:366) [cxf-api-2.7.2.jar:2.7.2]
      	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:319) [cxf-api-2.7.2.jar:2.7.2]
      	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96) [cxf-rt-frontend-simple-2.7.2.jar:2.7.2]
      	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:133) [cxf-rt-frontend-jaxws-2.7.2.jar:2.7.2]
      	at com.sun.proxy.$Proxy75.getRuleSet(Unknown Source) [na:na]
      	at com.jpm.tbea.rulesengine.core.load.impl.WebServiceRuleSetLoader.loadRuleSet(WebServiceRuleSetLoader.java:35) [classes/:na]
      	at com.jpm.tbea.rulesengine.core.load.impl.JanusAuthenticatedWebServiceRuleSetLoader.loadRuleSet(JanusAuthenticatedWebServiceRuleSetLoader.java:67) [classes/:na]
      	at com.jpm.tbea.rulesengine.core.load.impl.FailoverRuleSetLoader$LoaderTask.call(FailoverRuleSetLoader.java:124) [classes/:na]
      	at com.jpm.tbea.rulesengine.core.load.impl.FailoverRuleSetLoader$LoaderTask.call(FailoverRuleSetLoader.java:1) [classes/:na]
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_67]
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_67]
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_67]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_67]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_67]
      	at java.lang.Thread.run(Thread.java:745) [na:1.7.0_67]
      Caused by: java.lang.NullPointerException: null
      	at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:719) [cxf-api-2.7.2.jar:2.7.2]
      	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1590) ~[cxf-rt-transports-http-2.7.2.jar:2.7.2]
      	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1488) ~[cxf-rt-transports-http-2.7.2.jar:2.7.2]
      	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1307) ~[cxf-rt-transports-http-2.7.2.jar:2.7.2]
      	... 25 common frames omitted
      17:41:50.941 [pool-3-thread-1] INFO  c.j.t.r.c.l.i.FailoverRuleSetLoader - 101::Exception encountered
      java.lang.NullPointerException: null
      	at org.apache.cxf.jaxws.JaxWsClientProxy.addressChanged(JaxWsClientProxy.java:248) ~[cxf-rt-frontend-jaxws-2.7.2.jar:2.7.2]
      	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:166) ~[cxf-rt-frontend-jaxws-2.7.2.jar:2.7.2]
      	at com.sun.proxy.$Proxy75.getRuleSet(Unknown Source) ~[na:na]
      	at com.jpm.tbea.rulesengine.core.load.impl.WebServiceRuleSetLoader.loadRuleSet(WebServiceRuleSetLoader.java:35) ~[classes/:na]
      	at com.jpm.tbea.rulesengine.core.load.impl.JanusAuthenticatedWebServiceRuleSetLoader.loadRuleSet(JanusAuthenticatedWebServiceRuleSetLoader.java:67) ~[classes/:na]
      	at com.jpm.tbea.rulesengine.core.load.impl.FailoverRuleSetLoader$LoaderTask.call(FailoverRuleSetLoader.java:124) [classes/:na]
      	at com.jpm.tbea.rulesengine.core.load.impl.FailoverRuleSetLoader$LoaderTask.call(FailoverRuleSetLoader.java:1) [classes/:na]
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_67]
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_67]
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_67]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_67]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_67]
      	at java.lang.Thread.run(Thread.java:745) [na:1.7.0_67]
      

      Attachments

        Activity

          People

            dkulp Daniel Kulp
            sckonln Sanjeet Karamchandani
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: