Getting java.rmi.RemoteException: EJB Exception Eventhough classpath, XMLs, Beans are correctly defined and deployed

Mitesh picture Mitesh · Nov 16, 2010 · Viewed 7.3k times · Source

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); 

Answer

andbi picture andbi · Nov 16, 2010

java.lang.NoClassDefFoundError: com/misasia/admin/setupmaster/SetupMasterHome

means that SetupMasterHome.class is missing in server/module classpath while executing ControlBean's loadSetupMaster method. Adding appropriate jar will solve the problem.