我正在使用 EJB3.0 WAS8 和 Spring 3。我的 Web 组件位于 Web 服务器上,并且已将 EAR 部署在 App 服务器上。我的 Web 组件工作正常,直到它必须进行上下文查找。当我去 InitialContext 时,我得到以下异常:
type Exception report
message Handler processing failed; nested exception is java.lang.NoClassDefFoundError: com.ibm.ws.exception.WsException
description The server encountered an internal error (Handler processing failed; nested exception is java.lang.NoClassDefFoundError: com.ibm.ws.exception.WsException) that prevented it from fulfilling this request.
exception
org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoClassDefFoundError: com.ibm.ws.exception.WsException
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:812)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:709)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:613)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:536)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause
java.lang.NoClassDefFoundError: com.ibm.ws.exception.WsException
java.lang.ClassLoader.defineClassImpl(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:275)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:74)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2901)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1170)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
java.lang.ClassLoader.defineClassImpl(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:275)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:74)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2901)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1170)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
java.lang.J9VMInternals.verifyImpl(Native Method)
java.lang.J9VMInternals.verify(J9VMInternals.java:72)
java.lang.J9VMInternals.initialize(J9VMInternals.java:134)
com.ibm.websphere.naming.WsnInitialContextFactory.<clinit>(WsnInitialContextFactory.java:68)
java.lang.J9VMInternals.initializeImpl(Native Method)
java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
java.lang.Class.forNameImpl(Native Method)
java.lang.Class.forName(Class.java:174)
javax.naming.spi.NamingManager$3.run(NamingManager.java:873)
javax.naming.spi.NamingManager$3.run(NamingManager.java:870)
java.security.AccessController.doPrivileged(AccessController.java:228)
javax.naming.spi.NamingManager.factoryForName(NamingManager.java:869)
javax.naming.spi.NamingManager.factoryForName(NamingManager.java:820)
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:246)
javax.naming.InitialContext.initializeDefaultInitCtx(InitialContext.java:318)
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:348)
javax.naming.InitialContext.internalInit(InitialContext.java:286)
javax.naming.InitialContext.<init>(InitialContext.java:211)
com.paam.util.ServiceLocator.getInitialContext(ServiceLocator.java:43)
com.paam.util.RemoteObjectCall.remoteObj(RemoteObjectCall.java:14)
com.paam.delegates.PAAMDelegate.InsertPAAMDetails(PAAMDelegate.java:18)
com.paam.controllers.NewPaamController.newpaamsubmit(NewPaamController.java:77)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
java.lang.reflect.Method.invoke(Method.java:611)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java:626)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:150)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:354)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:342)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:763)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:709)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:613)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:536)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause
java.lang.ClassNotFoundException: com.ibm.ws.exception.WsException
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
java.lang.ClassLoader.defineClassImpl(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:275)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:74)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2901)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1170)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
java.lang.ClassLoader.defineClassImpl(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:275)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:74)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2901)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1170)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
java.lang.J9VMInternals.verifyImpl(Native Method)
java.lang.J9VMInternals.verify(J9VMInternals.java:72)
java.lang.J9VMInternals.initialize(J9VMInternals.java:134)
com.ibm.websphere.naming.WsnInitialContextFactory.<clinit>(WsnInitialContextFactory.java:68)
java.lang.J9VMInternals.initializeImpl(Native Method)
java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
java.lang.Class.forNameImpl(Native Method)
java.lang.Class.forName(Class.java:174)
javax.naming.spi.NamingManager$3.run(NamingManager.java:873)
javax.naming.spi.NamingManager$3.run(NamingManager.java:870)
java.security.AccessController.doPrivileged(AccessController.java:228)
javax.naming.spi.NamingManager.factoryForName(NamingManager.java:869)
javax.naming.spi.NamingManager.factoryForName(NamingManager.java:820)
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:246)
javax.naming.InitialContext.initializeDefaultInitCtx(InitialContext.java:318)
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:348)
javax.naming.InitialContext.internalInit(InitialContext.java:286)
javax.naming.InitialContext.<init>(InitialContext.java:211)
com.paam.util.ServiceLocator.getInitialContext(ServiceLocator.java:43)
com.paam.util.RemoteObjectCall.remoteObj(RemoteObjectCall.java:14)
com.paam.delegates.PAAMDelegate.InsertPAAMDetails(PAAMDelegate.java:18)
com.paam.controllers.NewPaamController.newpaamsubmit(NewPaamController.java:77)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
java.lang.reflect.Method.invoke(Method.java:611)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java:626)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:150)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:354)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:342)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:763)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:709)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:613)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:536)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
PS:我在定义的日志中没有收到此异常。在我的 tomcat 日志目录中生成了一个 localhost 日志文件。并且错误被打印在那里。
如果有人知道问题是什么,请提出相同的解决方案。