我在调试这个问题时遇到了麻烦。我正在将我的代码从 Java 1.4 迁移到 JDK 6,将 Weblogic 8.1.5 迁移到 Weblogic 10.3。我已经使用 weblogic 的 DDConverver 实用程序转换了 EJB 的部署描述符。Beans 由无状态会话和实体 bean (2.1) 组成。应用程序以JSP 为前端,EJB 为中间件。在记录时,我正在调用一个内部调用实体 bean 并加载相同的会话 bean。当会话 bean 调用实体 bean 时,我得到以下异常。会话调用成功,唯一的问题是来自会话 bean 的实体调用。
我正在为此使用开发环境。JSP 存储在 C:\MisasiaAppln10.3_DEV\misasia\autodeploy\misasia EJB 部署在 C:\MisasiaAppln10.3_DEV\misasia\servers\AdminServer\upload
异常详情:
java.rmi.RemoteException: EJB Exception: ; nested exception is:
java.lang.NoClassDefFoundError: com/misasia/admin/setupmaster/SetupMasterHome
at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:205)
at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:222)
at com.misasia.admin.ctrlsession.controlSession_ho24d0_EOImpl_1030_WLStub.login(Unknown Source)
at jsp_servlet.__index._jspService(__index.java:197)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:408)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:318)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3498)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: java.lang.NoClassDefFoundError: com/misasia/admin/setupmaster/SetupMasterHome
at com.misasia.admin.ctrlsession.controlBean.loadSetupMaster(controlBean.java:149)
at com.misasia.admin.ctrlsession.controlBean.login(controlBean.java:119)
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:597)
at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:126)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:114)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:15)
at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
at com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:30)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:126)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:114)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
at $Proxy60.login(Unknown Source)
at com.misasia.admin.ctrlsession.controlSession_ho24d0_EOImpl.login(controlSession_ho24d0_EOImpl.java:840)
at com.misasia.admin.ctrlsession.controlSession_ho24d0_EOImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:172)
... 18 more
Caused by: java.lang.ClassNotFoundException: com.misasia.admin.setupmaster.SetupMasterHome
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:283)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:256)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:176)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
... 44 more
示例代码:
从 JSP 调用会话(这很好)
env.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
env.put(Context.PROVIDER_URL, "t3://localhost:7001");
ic = new InitialContext(env);
ctrlHome = (controlHome)ic.lookup("controlSessionEJB");
ctrl = (control)ctrlHome.create();
会话中的实体调用(失败)
Object refsetup = ic.lookup("java:comp/env/ejb/SetupMasterEJB");
// This is the line which gives an error
SetupMasterHome setuph = (SetupMasterHome)PortableRemoteObject.narrow(refsetup, SetupMasterHome.class);