Calling an ejb from a web service, not using jboss-net
cduncan Feb 27, 2004 2:29 PMI have successfully created a web service that uses castor to unmarshall a complex xml string. I am using JBoss as my application server. I decided not to use jboss-net so that I would have the flexibility to move to a different application server down the road. So I am deploying the axis.war to my server/deploy directory in JBoss. This process is described in the following link.
http://www.amitysolutions.com.au/documents/Axis-technote.pdf
I also have an Enterprise application deployed in JBoss. The problem I am having is that I am trying to make a call to a Stateless Session Bean in my Enterprise Application from the web service. This seems like it should be pretty straight forward since I have created a simple client program and was able to get a handle to the ejb and make the call on it without any problems. However, when I try to make the call to the ejb from my web service, I get a RemoteException when trying to call create on the Home interface.
Here is the stacktrace:
2004-02-27 14:02:31,397 ERROR [org.jboss.ejb.plugins.LogInterceptor] RuntimeException: java.lang.NullPointerException at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invokeHome(StatelessSessionContainer.java:592) at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:206) at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invokeHome(StatelessSessionInstanceInterceptor.java:51) at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:88) at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:243) at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:74) at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:92) at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:120) at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93) at org.jboss.ejb.StatelessSessionContainer.internalInvokeHome(StatelessSessionContainer.java:310) at org.jboss.ejb.Container.invoke(Container.java:694) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549) at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:101) at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:83) at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46) at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:45) at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:173) at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85) at $Proxy45.create(Unknown Source) at com.invisioninc.optimizer.web.PackageOptimizerSOAPBindingImpl.getService(PackageOptimizerSOAPBindingImpl.java:107) at com.invisioninc.optimizer.web.PackageOptimizerSOAPBindingImpl.runPOEngine(PackageOptimizerSOAPBindingImpl.java:59) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:402) at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:309) at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:333) at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71) at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150) at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120) at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:481) at org.apache.axis.server.AxisServer.invoke(AxisServer.java:323) at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:854) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:339) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360) at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:294) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:558) at org.mortbay.http.HttpContext.handle(HttpContext.java:1714) at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:507) at org.mortbay.http.HttpContext.handle(HttpContext.java:1664) at org.mortbay.http.HttpServer.service(HttpServer.java:863) at org.jboss.jetty.Jetty.service(Jetty.java:460) at org.mortbay.http.HttpConnection.service(HttpConnection.java:775) at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:939) at org.mortbay.http.HttpConnection.handle(HttpConnection.java:792) at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:201) at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289) at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:455) 2004-02-27 14:02:31,444 ERROR [com.invisioninc.optimizer.web.PackageOptimizerSOAPBindingImpl] RemoteException caught while trying to instantiate OptimizerPilot ejb 2004-02-27 14:02:31,444 ERROR [STDERR] java.rmi.ServerException: RuntimeException; nested exception is:
I am not sure what the problem could be. I am going to try deploying the axis.war inside my EAR file to see if that makes a difference. I did not do that from the start since I thought the web service would act the same as any other ejb client program.
If anyone has any suggestions in the meantime let me know.
Thanks,
Craig