[ https://issues.apache.org/jira/browse/CXF-4149?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13220736#comment-13220736 ]
Jorge Vaquero commented on CXF-4149: ------------------------------------ Thank you for your support Daniel. I think that your are right I'm getting the Proxy to set the timeout and after the execution of the method is not used anymore. This is the code of the invocation, there are two different more like this: private static Response<org.ensure.configLayer.service.cost.jaxws.GetGlobalPreservationPlanEvaluationResponse> invokeCostModule(DataHandler globalPreservationPlan, RequirementSet requirementSet) { QName serviceName = new QName("http://cost.servicequalityfigLayer.ensure.org/", "CostEngineImplService"); QName portName = new QName("http://cost.service.configLayer.ensure.org/", "CostEngineImplPort"); Service service = Service.create(serviceName); service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, "http://" + costEngineWSHost + ":" + costEngineWSPort + "/CostEngineWS/services/CostEngineWSImplPort"); org.ensure.configLayer.service.cost.CostEngineWS client = service.getPort(portName, org.ensure.configLayer.service.cost.CostEngineWS.class); org.apache.cxf.endpoint.Client clientProxy = ClientProxy.getClient(client); // Enabling MTOM on client ServiceUtil.setMTOMEnabled(((BindingProvider)client)); // Setting a wider connection timeout for asynchronous communications ServiceUtil.setHTTPAsyncTimeout((HTTPConduit) clientProxy.getConduit()); System.out.println("Invoking getGlobalPreservationPlanEvaluationAsync using polling..."); Response<org.ensure.configLayer.service.cost.jaxws.GetGlobalPreservationPlanEvaluationResponse> response; try{ response = client.getGlobalPreservationPlanEvaluationAsync(globalPreservationPlan, requirementSet); }catch (Exception e) { e.printStackTrace(); LogUtils.printStackTrace(log, e); return null; } return response; } And this is the invocation to the three operations in parallel with polling (I have tried doing the three invocations sequentially and it happens but with far less frequency). The method below is executed N times: Response<org.ensure.configLayer.service.cost.jaxws.GetGlobalPreservationPlanEvaluationResponse> costEvaluationReply= null; Response<org.ensure.configLayer.service.quality.jaxws.GetGlobalPreservationPlanEvaluationResponse> qualityEvaluationReply = null; Response<org.ensure.configLayer.service.economicPerformance.jaxws.GetGlobalPreservationPlanEvaluationResponse> economicPerformanceReply = null; org.ensure.configLayer.service.cost.jaxws.GetGlobalPreservationPlanEvaluationResponse costEvaluationReplyRes = null; org.ensure.configLayer.service.quality.jaxws.GetGlobalPreservationPlanEvaluationResponse qualityEvaluationReplyRes = null; org.ensure.configLayer.service.economicPerformance.jaxws.GetGlobalPreservationPlanEvaluationResponse economicPerformanceReplyRes = null; -------------- costEvaluationReply = invokeCostModule(globalPreservationPlanDataHandler, requirementSet); qualityEvaluationReply = invokeQualityModule(globalPreservationPlanDataHandler, requirementSet); economicPerformanceReply = invokeEconomicPerformanceModule(globalPreservationPlanDataHandler, requirementSet); }catch (Exception e) { e.printStackTrace(); LogUtils.printStackTrace(log, e); return EError.getUnknownError(InternalModule.PRESERVATION_PLAN_OPTIMIZER); } // Polling method if (costEvaluationReply != null && qualityEvaluationReply != null && economicPerformanceReply!= null){ int i = 0; while ( !costEvaluationReply.isDone()|| !qualityEvaluationReply.isDone() || !economicPerformanceReply.isDone()) { try { Thread.sleep(Constants.POLLING_INTERVAL); } catch (InterruptedException e) { e.printStackTrace(); LogUtils.printStackTrace(log, e); } i+= Constants.POLLING_INTERVAL/1000; System.out.println("Waiting..." + i + " seconds"); } }else{ log.error("invokeAnalysisModules => Error invoking WSs"); return EError.getUnknownError(InternalModule.PRESERVATION_PLAN_OPTIMIZER); } try { costEvaluationReplyRes = costEvaluationReply.get(); qualityEvaluationReplyRes = qualityEvaluationReply.get(); economicPerformanceReplyRes = economicPerformanceReply.get(); This code is executed iteratively, it some iterations it works in others raised the exception. Kind regards, Jorge. > org.apache.cxf.endpoint.ClientImpl raises > ------------------------------------------ > > Key: CXF-4149 > URL: https://issues.apache.org/jira/browse/CXF-4149 > Project: CXF > Issue Type: Bug > Components: Bus > Affects Versions: 2.4.4, 2.4.6, 2.5.2 > Environment: Eclipse Helios, Tomcat 6, JDK 1.6, Windows 7 > Reporter: Jorge Vaquero > Assignee: Daniel Kulp > Priority: Critical > > When invoking several different web services asynchronously a > NullPointerException is raised. The web services were invoked firstly in > parallel later sequentially. The issue occurs more frequently when the web > services are executed in parallel. > Apparently the issue is at ClientImpl line 715 in version 2.4.4. I've > debugged the issue and in some executions bus is null on method onMessage: > public void onMessage(Message message) { > Endpoint endpoint = message.getExchange().getEndpoint(); > if (endpoint == null) { > // in this case correlation will occur outside the transport, > // however there's a possibility that the endpoint may have been > // rebased in the meantime, so that the response will be mediated > // via a set of in interceptors provided by a *different* endpoint > // > endpoint = getConduitSelector().getEndpoint(); > message.getExchange().put(Endpoint.class, endpoint); > } > message = endpoint.getBinding().createMessage(message); > message.getExchange().setInMessage(message); > message.put(Message.REQUESTOR_ROLE, Boolean.TRUE); > message.put(Message.INBOUND_MESSAGE, Boolean.TRUE); > ===> PhaseManager pm = bus.getExtension(PhaseManager.class); > This is the exception raised: > GRAVE: ExecutionException > java.util.concurrent.ExecutionException: java.lang.NullPointerException > at org.apache.cxf.endpoint.ClientCallback.get(ClientCallback.java:147) > at > org.apache.cxf.jaxws.JaxwsResponseCallback.get(JaxwsResponseCallback.java:49) > at > org.ensure.configLayer.planningLayer.services.PreservationPlanOptimizer.PreservationPlanOptimizer.invokeAnalysisModules(PreservationPlanOptimizer.java:382) > at > org.ensure.configLayer.planningLayer.services.PreservationPlanOptimizer.PreservationPlanOptimizer.getOptimizedGlobalPreservationPlans(PreservationPlanOptimizer.java:166) > at > org.ensure.configLayer.test.planningLayer.PreservationPlanOptimizer.tester.Tester.main(Tester.java:37) > Caused by: java.lang.NullPointerException > at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:715) > at org.apache.cxf.endpoint.ClientImpl$1.onMessage(ClientImpl.java:890) > at > org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1626) > at > org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:1498) > at java.lang.Thread.run(Unknown Source) > Kind regards, > Jorge. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira