获取 java.rmi.RemoteException:EJB 异常 即使类路径、XML、Bean 已正确定义和部署
我在调试这个问题时遇到了麻烦。我正在将代码从 Java 1.4 迁移到 JDK 6,将 Weblogic 8.1.5 迁移到 Weblogic 10.3。我已经使用 weblogic 的 DDConverver 实用程序转换了 EJB 的部署描述符。 Bean 由无状态会话和实体 Bean (2.1) 组成。应用程序由JSP作为前端和EJB作为中间件组成。在记录时,我正在调用一个会话 bean,该会话 bean 在内部调用实体 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);
I am having bad time debugging with this problem. I am migrating my codes from Java 1.4 to JDK 6 and Weblogic 8.1.5 to Weblogic 10.3. I have converted the deployment descriptors of EJBs using DDConverver utility of weblogic. Beans consists of stateless session and Entity beans (2.1). Application is made of JSP as front-end and EJBs as middle ware. While logging i am calling one session bean which internally called entity beans and loads the same. I am getting following exception when Session bean calls entity bean. Session call is successful, only the issue is entity call from session bean.
I am using development environment for this. JSPs are stored at
C:\MisasiaAppln10.3_DEV\misasia\autodeploy\misasia
EJBs are deployed at
C:\MisasiaAppln10.3_DEV\misasia\servers\AdminServer\upload
Exception Details:
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
Sample Codes:
Call of Session from JSP (THIS WORKS FINE)
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();
Call of Entity from Session (THIS FAILS)
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);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
意味着在执行 ControlBean 的
loadSetupMaster
方法时,server/module
类路径中缺少SetupMasterHome.class
。添加适当的jar即可解决问题。means that
SetupMasterHome.class
is missing inserver/module
classpath while executing ControlBean'sloadSetupMaster
method. Adding appropriate jar will solve the problem.