Issues with Switchyard Service as EJB
dragos.enachescu May 21, 2013 1:35 PMHi,
We have tried to implement the Switchyard services as EJBs (Switchyard 0.7 Final), instead of leaving them as basic CDI beans, because we thought of benefiting from the EJB bean pooling. These services are also promoted with SOAP binding.
But configuring the services as EJBs caused some other issues:
- when trying to invoke a Switchyard service from another service using the WSDL reference provided by Switchyard: the requests from one service to the other are throttled down by the EJB thread pool and we observed poor performance. If we replaced the WSDL reference with CXF WSDL clients the performance improved the services were invoked through the web service endpoint instead of EJB invocation. Is it possible to still use the Switchyard’s native WSDL reference, but avoid hitting the EJB thread pool?
- As a result of the tests performed at the previous point, we tried to increase the EJB thread pool from 10 (the default value) to 15-30 threads, but doing this, we had another issue when invoking switchyard services from soapUI (so, the clients used during the tests were pure SOAP based) – we got a nullpointer as seen in the server log below (the 2 errors do not always appear, only from time to time and mostly when the number of concurrent clients is high - e.g. 30 soap clients):
[Server:server-core-0] 16:42:35,045 WARN [org.switchyard.internal.ExchangeImpl] (http-server04.localhost/192.168.0.4:9003-1) Fault generated during exchange without a handler: org.switchyard.HandlerException: java.lang.NullPointerException
[Server:server-core-0] --- Caused by java.lang.NullPointerException: null
[Server:server-core-0] 16:42:35,857 ERROR [org.jboss.ws.common.invocation.InvocationHandlerJAXWS] (http-server04.localhost/192.168.0.4:9003-4) Method invocation failed with exception: null: java.lang.reflect.InvocationTargetException
[Server:server-core-0] at sun.reflect.GeneratedMethodAccessor41.invoke(Unknown Source) [:1.7.0_09-icedtea]
[Server:server-core-0] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09-icedtea]
[Server:server-core-0] at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09-icedtea]
[Server:server-core-0] at org.jboss.ws.common.invocation.AbstractInvocationHandlerJSE.invoke(AbstractInvocationHandlerJSE.java:111)
[Server:server-core-0] at org.jboss.wsf.stack.cxf.JBossWSInvoker._invokeInternal(JBossWSInvoker.java:182)
[Server:server-core-0] at org.jboss.wsf.stack.cxf.JBossWSInvoker.invoke(JBossWSInvoker.java:127)
[Server:server-core-0] at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58) [cxf-rt-core-2.4.9-redhat-2.jar:2.4.9-redhat-2]
[Server:server-core-0] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_09-icedtea]
[Server:server-core-0] at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [rt.jar:1.7.0_09-icedtea]
[Server:server-core-0] at java.util.concurrent.FutureTask.run(FutureTask.java:166) [rt.jar:1.7.0_09-icedtea]
[Server:server-core-0] at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) [cxf-rt-core-2.4.9-redhat-2.jar:2.4.9-redhat-2]
[Server:server-core-0] at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:107) [cxf-rt-core-2.4.9-redhat-2.jar:2.4.9-redhat-2]
[Server:server-core-0] at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263) [cxf-api-2.4.9-redhat-2.jar:2.4.9-redhat-2]
[Server:server-core-0] at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) [cxf-rt-core-2.4.9-redhat-2.jar:2.4.9-redhat-2]
[Server:server-core-0] at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:207) [cxf-rt-transports-http-2.4.9-redhat-2.jar:2.4.9-redhat-2]
[Server:server-core-0] at org.jboss.wsf.stack.cxf.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:91)
[Server:server-core-0] at org.jboss.wsf.stack.cxf.transport.ServletHelper.callRequestHandler(ServletHelper.java:169)
[Server:server-core-0] at org.jboss.wsf.stack.cxf.CXFServletExt.invoke(CXFServletExt.java:87)
[Server:server-core-0] at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:185) [cxf-rt-transports-http-2.4.9-redhat-2.jar:2.4.9-redhat-2]
[Server:server-core-0] at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:108) [cxf-rt-transports-http-2.4.9-redhat-2.jar:2.4.9-redhat-2]
[Server:server-core-0] at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) [jboss-servlet-api_3.0_spec-1.0.1.Final-redhat-2.jar:1.0.1.Final-redhat-2]
[Server:server-core-0] at org.jboss.wsf.stack.cxf.CXFServletExt.service(CXFServletExt.java:135)
[Server:server-core-0] at org.jboss.wsf.spi.deployment.WSFServlet.service(WSFServlet.java:140) [jbossws-spi-2.0.4.GA-redhat-1.jar:2.0.4.GA-redhat-1]
[Server:server-core-0] at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.1.Final-redhat-2.jar:1.0.1.Final-redhat-2]
[Server:server-core-0] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
[Server:server-core-0] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[Server:server-core-0] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
[Server:server-core-0] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
[Server:server-core-0] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
[Server:server-core-0] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
[Server:server-core-0] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
[Server:server-core-0] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:372)
[Server:server-core-0] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
[Server:server-core-0] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:679)
[Server:server-core-0] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931)
[Server:server-core-0] at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_09-icedtea]
[Server:server-core-0] Caused by: java.lang.NullPointerException
[Server:server-core-0] at org.apache.xerces.dom.ParentNode.nodeListItem(Unknown Source) [xercesImpl-2.9.1-redhat-3.jar:]
[Server:server-core-0] at org.apache.xerces.dom.ParentNode.item(Unknown Source) [xercesImpl-2.9.1-redhat-3.jar:]
[Server:server-core-0] at org.switchyard.config.DOMConfiguration.getFirstChild(DOMConfiguration.java:490) [switchyard-config-0.7.0.Final.jar:0.7.0.Final]
[Server:server-core-0] at org.switchyard.config.model.BaseModel.getFirstChildModel(BaseModel.java:270) [switchyard-config-0.7.0.Final.jar:0.7.0.Final]
[Server:server-core-0] at org.switchyard.config.model.composite.v1.V1BindingModel.getMessageComposer(V1BindingModel.java:144) [switchyard-config-0.7.0.Final.jar:0.7.0.Final]
[Server:server-core-0] at org.switchyard.component.soap.config.model.SOAPBindingModel.getSOAPMessageComposer(SOAPBindingModel.java:100) [switchyard-component-soap-0.7.0.Final.jar:0.7.0.Final]
[Server:server-core-0] at org.switchyard.component.soap.InboundHandler.invoke(InboundHandler.java:201) [switchyard-component-soap-0.7.0.Final.jar:0.7.0.Final]
[Server:server-core-0] at org.switchyard.component.soap.endpoint.BaseWebService.invoke(BaseWebService.java:113) [switchyard-component-soap-0.7.0.Final.jar:0.7.0.Final]
[Server:server-core-0] at org.switchyard.component.soap.endpoint.BaseWebService.invoke(BaseWebService.java:43) [switchyard-component-soap-0.7.0.Final.jar:0.7.0.Final]
[Server:server-core-0] ... 36 more
[Server:server-core-0]
[Server:server-core-0] 16:42:35,890 WARNING [org.apache.cxf.phase.PhaseInterceptorChain] (http-server04.localhost/192.168.0.4:9003-4) Application {http://www.openuri.org/}BS_FRONTEND#{http://www.openuri.org/}FRONTEND has thrown exception, unwinding now: org.apache.cxf.interceptor.Fault
[Server:server-core-0] at org.jboss.wsf.stack.cxf.JBossWSInvoker.createFault(JBossWSInvoker.java:247)
[Server:server-core-0] at org.jboss.wsf.stack.cxf.JBossWSInvoker._invokeInternal(JBossWSInvoker.java:202)
[Server:server-core-0] at org.jboss.wsf.stack.cxf.JBossWSInvoker.invoke(JBossWSInvoker.java:127)
[Server:server-core-0] at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58) [cxf-rt-core-2.4.9-redhat-2.jar:2.4.9-redhat-2]
[Server:server-core-0] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_09-icedtea]
[Server:server-core-0] at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [rt.jar:1.7.0_09-icedtea]
[Server:server-core-0] at java.util.concurrent.FutureTask.run(FutureTask.java:166) [rt.jar:1.7.0_09-icedtea]
[Server:server-core-0] at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) [cxf-rt-core-2.4.9-redhat-2.jar:2.4.9-redhat-2]
[Server:server-core-0] at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:107) [cxf-rt-core-2.4.9-redhat-2.jar:2.4.9-redhat-2]
[Server:server-core-0] at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263) [cxf-api-2.4.9-redhat-2.jar:2.4.9-redhat-2]
[Server:server-core-0] at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) [cxf-rt-core-2.4.9-redhat-2.jar:2.4.9-redhat-2]
[Server:server-core-0] at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:207) [cxf-rt-transports-http-2.4.9-redhat-2.jar:2.4.9-redhat-2]
[Server:server-core-0] at org.jboss.wsf.stack.cxf.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:91)
[Server:server-core-0] at org.jboss.wsf.stack.cxf.transport.ServletHelper.callRequestHandler(ServletHelper.java:169)
[Server:server-core-0] at org.jboss.wsf.stack.cxf.CXFServletExt.invoke(CXFServletExt.java:87)
[Server:server-core-0] at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:185) [cxf-rt-transports-http-2.4.9-redhat-2.jar:2.4.9-redhat-2]
[Server:server-core-0] at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:108) [cxf-rt-transports-http-2.4.9-redhat-2.jar:2.4.9-redhat-2]
[Server:server-core-0] at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) [jboss-servlet-api_3.0_spec-1.0.1.Final-redhat-2.jar:1.0.1.Final-redhat-2]
[Server:server-core-0] at org.jboss.wsf.stack.cxf.CXFServletExt.service(CXFServletExt.java:135)
[Server:server-core-0] at org.jboss.wsf.spi.deployment.WSFServlet.service(WSFServlet.java:140) [jbossws-spi-2.0.4.GA-redhat-1.jar:2.0.4.GA-redhat-1]
[Server:server-core-0] at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.1.Final-redhat-2.jar:1.0.1.Final-redhat-2]
[Server:server-core-0] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
[Server:server-core-0] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
[Server:server-core-0] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
[Server:server-core-0] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
[Server:server-core-0] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
[Server:server-core-0] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
[Server:server-core-0] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
[Server:server-core-0] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:372)
[Server:server-core-0] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
[Server:server-core-0] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:679)
[Server:server-core-0] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931)
[Server:server-core-0] at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_09-icedtea]
[Server:server-core-0] Caused by: java.lang.NullPointerException
[Server:server-core-0] at org.apache.xerces.dom.ParentNode.nodeListItem(Unknown Source) [xercesImpl-2.9.1-redhat-3.jar:]
[Server:server-core-0] at org.apache.xerces.dom.ParentNode.item(Unknown Source) [xercesImpl-2.9.1-redhat-3.jar:]
[Server:server-core-0] at org.switchyard.config.DOMConfiguration.getFirstChild(DOMConfiguration.java:490) [switchyard-config-0.7.0.Final.jar:0.7.0.Final]
[Server:server-core-0] at org.switchyard.config.model.BaseModel.getFirstChildModel(BaseModel.java:270) [switchyard-config-0.7.0.Final.jar:0.7.0.Final]
[Server:server-core-0] at org.switchyard.config.model.composite.v1.V1BindingModel.getMessageComposer(V1BindingModel.java:144) [switchyard-config-0.7.0.Final.jar:0.7.0.Final]
[Server:server-core-0] at org.switchyard.component.soap.config.model.SOAPBindingModel.getSOAPMessageComposer(SOAPBindingModel.java:100) [switchyard-component-soap-0.7.0.Final.jar:0.7.0.Final]
[Server:server-core-0] at org.switchyard.component.soap.InboundHandler.invoke(InboundHandler.java:201) [switchyard-component-soap-0.7.0.Final.jar:0.7.0.Final]
[Server:server-core-0] at org.switchyard.component.soap.endpoint.BaseWebService.invoke(BaseWebService.java:113) [switchyard-component-soap-0.7.0.Final.jar:0.7.0.Final]
[Server:server-core-0] at org.switchyard.component.soap.endpoint.BaseWebService.invoke(BaseWebService.java:43) [switchyard-component-soap-0.7.0.Final.jar:0.7.0.Final]
[Server:server-core-0] at sun.reflect.GeneratedMethodAccessor41.invoke(Unknown Source) [:1.7.0_09-icedtea]
[Server:server-core-0] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09-icedtea]
[Server:server-core-0] at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09-icedtea]
[Server:server-core-0] at org.jboss.ws.common.invocation.AbstractInvocationHandlerJSE.invoke(AbstractInvocationHandlerJSE.java:111)
[Server:server-core-0] at org.jboss.wsf.stack.cxf.JBossWSInvoker._invokeInternal(JBossWSInvoker.java:182)
[Server:server-core-0] ... 31 more
[Server:server-core-0]
Can you please give some suggestions on the above?
Thank you in advance
Best regards,
Dragos