使用EJB客户端jar时发生java.lang.NoClassDefFoundError

时间:2019-03-19 13:15:56

标签: java ejb noclassdeffounderror

我有几个项目通过EJB与“核心”项目交互。 这些项目大多数使用相同的core.ejb.client.jar。 但是,一个项目使用其自己的core.external.ejb.client.jar,这是通过复制该项目所需的唯一EJB的文件来完成的。 我有一个使用以下方法的EJB /接口:public Application findApp()

在该方法内,它创建Services实例,并在Services内导入“代码”类。 core.external.ejb.client.jar包含weblogic创建的相关EJB /接口文件和Application类。另一个core.ejb.client.jar包含许多其他类,包括Code.class

当我的项目调用findApp()时,出现以下错误,但是myportal中没有对Code类的引用。

  

错误org.apache.struts2.dispatcher.DefaultDispatcherErrorHandler-处理请求期间发生异常:对象myportal.web.actions.HomeAction@31c178d3的方法“执行”失败       ognl.MethodFailedException:对象myportal.web.actions.HomeAction@31c178d3的方法“执行”失败               在ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1556)〜[ognl-3.1.15.jar :?]               在ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:68)〜[ognl-3.1.15.jar :?]               在com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethodWithDebugInfo(XWorkMethodAccessor.java:98)〜[struts2-core-2.5.17.jar:2.5.17]               在com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethod(XWorkMethodAccessor.java:90)〜[struts2-core-2.5.17.jar:2.5.17]               在ognl.OgnlRuntime.callMethod(OgnlRuntime.java:1620)〜[ognl-3.1.15.jar :?]               在ognl.ASTMethod.getValueBody(ASTMethod.java:91)〜[ognl-3.1.15.jar :?]               在ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)〜[ognl-3.1.15.jar :?]               在ognl.SimpleNode.getValue(SimpleNode.java:258)〜[ognl-3.1.15.jar :?]               在ognl.Ognl.getValue(Ognl.java:470)〜[ognl-3.1.15.jar :?]               在ognl.Ognl.getValue(Ognl.java:434)〜[ognl-3.1.15.jar :?]               在com.opensymphony.xwork2.ognl.OgnlUtil $ 3.execute(OgnlUtil.java:401)〜[struts2-core-2.5.17.jar:2.5.17]       ...       由以下原因引起:java.lang.NoClassDefFoundError:core / common / business / Code;               在java.lang.Class.getDeclaredFields0(本机方法)〜[?:1.8.0_152]               在java.lang.Class.privateGetDeclaredFields(Class.java:2583)〜[?:1.8.0_152]               在java.lang.Class.getDeclaredField(Class.java:2068)〜[?:1.8.0_152]               在java.io.ObjectStreamClass.getDeclaredSUID(ObjectStreamClass.java:1803)〜[?:1.8.0_152]               在java.io.ObjectStreamClass.access $ 700(ObjectStreamClass.java:79)〜[?:1.8.0_152]               在java.io.ObjectStreamClass $ 2.run(ObjectStreamClass.java:494)〜[?:1.8.0_152]               在java.io.ObjectStreamClass $ 2.run(ObjectStreamClass.java:482)〜[?:1.8.0_152]               在java.security.AccessController.doPrivileged(本机方法)〜[?:1.8.0_152]               在java.io.ObjectStreamClass。(ObjectStreamClass.java:482)〜[?:1.8.0_152]               在java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:379)〜[?:1.8.0_152]               在java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:669)〜[?:1.8.0_152]               在java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1880)〜[?:1.8.0_152]               在java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1746)〜[?:1.8.0_152]               在java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2037)〜[?:1.8.0_152]               在java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1568)〜[?:1.8.0_152]               在java.io.ObjectInputStream.readObject(ObjectInputStream.java:428)〜[?:1.8.0_152]               在java.util.ArrayList.readObject(ArrayList.java:797)〜[?:1.8.0_152]               在sun.reflect.GeneratedMethodAccessor3.invoke(未知来源)〜[?:?]               在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)〜[?:1.8.0_152]               在java.lang.reflect.Method.invoke(Method.java:498)〜[?:1.8.0_152]               在java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1158)〜[?:1.8.0_152]               在java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2173)〜[?:1.8.0_152]               在java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2064)〜[?:1.8.0_152]               在java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1568)〜[?:1.8.0_152]               在java.io.ObjectInputStream.readObject(ObjectInputStream.java:428)〜[?:1.8.0_152]               在weblogic.rmi.extensions.server.CBVInputStream.readObject(CBVInputStream.java:64)〜[com.bea.core.weblogic.rmi.client.jar:12.2.1.3]               在weblogic.rmi.internal.ServerRequest.unmarshalReturn(ServerRequest.java:127)〜[com.bea.core.weblogic.rmi.client.jar:12.2.1.3]               在weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:555)〜[com.bea.core.weblogic.rmi.client.jar:12.2.1.3]               在weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:313)〜[com.bea.core.weblogic.rmi.client.jar:12.2.1.3]               在core.common.ejb.external.core_ExternalPortalEJB_vl7zv5_ExternalPortalInterfaceImpl_12213_WLStub.getApplicationList(未知源)〜[core.external.ejbclient.jar :?]               在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)〜[?:1.8.0_152]               在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)〜[?:1.8.0_152]               在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)〜[?:1.8.0_152]               在java.lang.reflect.Method.invoke(Method.java:498)〜[?:1.8.0_152]               在weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:86)〜[com.oracle.weblogic.ejb.jar:12.2.1.3]               在com.sun.proxy。$ Proxy752.getApplicationList(未知来源)〜[?:?]               在myportal.web.actions.HomeAction.execute(HomeAction.java:58)〜[_wl_cls_gen.jar :?]               在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)〜[?:1.8.0_152]               在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)〜[?:1.8.0_152]               在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)〜[?:1.8.0_152]               在java.lang.reflect.Method.invoke(Method.java:498)〜[?:1.8.0_152]               在ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:899)〜[ognl-3.1.15.jar :?]               在ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1544)〜[ognl-3.1.15.jar:?]

1 个答案:

答案 0 :(得分:0)

我愚蠢地只在搜索Code类的import语句。但是,Application类和Code类位于同一文件夹中,因此不需要import语句。 Application类是指代码类,这就是为什么我得到此错误。