我试图从两个Tomcat 6.0.14实例调用JBoss 5.1.0上的EJB。一台机器工作正常,而另一台机器不工作。代码是Struts操作,类似于:
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());
}
我最终在catch块中为记录器调用附加了一个断点,因为对logger的调用没有产生任何输出。
调试器显示Exception是一个NPE,但它没有消息。日志显示在分配接口后立即调试调用工作正常,文本类似于“获得jboss.j2ee的代理:ear = ear.ear,jar = ear-internal-3.0.0.jar,name = MyInterfaceImpl,service = EJB3实现[interface com.myco.MyInterface]“。
我没有轻松访问服务器端,因此无法在那里附加调试器,我也无法轻松访问源代码(我使用JDecompiler找出在jdb中放置断点的位置 - 代码是内部代码,我只是不在正确的部门工作!)
我无法看到,在上面的代码中,myInterface可能为null,所以对我来说,NPE要么来自服务器端,要么来自Tomcat的内部。
两台机器的配置之间存在一些细微的差别,但没有任何迹象表明NPE被抛入代码中。主要配置差异是:
有没有人有任何想法?
(机器在RHEL5上运行,JDK 1.60_18)
我已经设法将其从系统中取出 - 看起来它是this错误,但是如果两个Tomcats上的客户端jar都相同,那么错误会发生在两者上还是没发生?< / p>
[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)]
答案 0 :(得分:0)
解决方案是在Tomcat的lib目录中存在jboss-aspect-jdk50-client_4.2.2.jar
- 删除此文件允许应用程序正常工作。