I am trying to invoke an EJB on JBoss 5.1.0 from two instances of Tomcat 6.0.14. One machine is working fine, while the other’s isn’t working. The code is a Struts action doing something similar to:
try {
MyInterface myInterface = (MyInterface)Component.getInstance(MyInterface.class);
log.debug(new StringBuilder().append("Got a ").append(myInterface).toString());
myInterface.doSomething();
} catch (Exception e) {
logger.error(e.getMessage());
}
I ended up attaching a breakpoint to the logger call inside the catch block, as the call to logger produced no output whatsoever.
The debugger showed that the Exception was a NPE, but it has no message. The logging shows that the debug call immediately after the interface is assigned works fine, and the text is something like “Got a Proxy to jboss.j2ee:ear=ear.ear,jar=ear-internal-3.0.0.jar,name=MyInterfaceImpl,service=EJB3 implementing [interface com.myco.MyInterface]”.
I don’t have easy access to the server side, so cannot attach a debugger there, and I don’t have easy access to the source code either (I used JDecompiler to find out where to place a breakpoint in jdb – the code is in-house code, I just don’t work in the right department!)
I can’t see how, in the above code myInterface could be null, so for me the NPE is either coming from the server side, or the internals of Tomcat.
There are a few subtle differences between the configuration of the two machines, but nothing that suggests an NPE being thrown inside the code. The main configuration differences are:
- conf loaded from symlinks
- the working Tomcat client is on the same machine as the JBoss server, while the failing Tomcat client is on a separate machine on a different subnet (however, the proxy is returned, and I can see network traffic going to the correct ports on the JBoss server using tcpdump, so I don’t think it’s a networking issue)
Does anyone have any ideas?
(The machines are running on RHEL5 with JDK 1.60_18)
I have managed to get this out of the system – it looks like it is this bug, but surely if the client jars are the same on both Tomcats, the error would either happen to both or none?
[org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:379)
org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:53)
org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91)
org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:891)
org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:744)
org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:697)
org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:524)
org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:232)
org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:211)
org.jboss.remoting.Client.invoke(Client.java:1724)
org.jboss.remoting.Client.invoke(Client.java:629)
org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:61)
$Proxy9.invoke(Unknown Source)
org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)
org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)
$Proxy8.getRoster(Unknown Source)
com.mycompany.MyAction.execute(GetNotificationsAction.java:33)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
com.mycompany.filters.EncodingFilter.doFilter(EncodingFilter.java:23)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
java.lang.Thread.run(Thread.java:619)]
The solution was the presence of
jboss-aspect-jdk50-client_4.2.2.jarin Tomcat’s lib directory – removing this file allowed the application to work correctly.