glassfish
  1. glassfish
  2. GLASSFISH-7959

ejb lookup faild when resource adapter with remote interface deployed

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: v2.1.1
    • Fix Version/s: 4.0
    • Component/s: ejb_container
    • Labels:
      None
    • Environment:

      Operating System: Linux
      Platform: Linux

    • Issuezilla Id:
      7,959
    • Status Whiteboard:
      Hide

      v3_exclude

      Show
      v3_exclude

      Description

      I'm using Sun Java System Application Server 9.1_02 (build b04-fcs)
      I also reproduced this problem using GlassFish v3 (build 44)

      Scenerio:
      I have two Enterprise Applications (EAR) TEST-MODULE (EAR_1) and SMS-ACTIVE (EAR_2)
      one Web Application (WAR_1) and one Connector Module (RAR_1)

      EAR_1 : TEST-MODULE have one ejb (EJB_1):

      @Stateless(mappedName = "ejb/sms/active/module/EJBCActivityTest")
      @Remote(

      {ActivityProcessableRemote.class}

      )
      public class EJBCActivityTest implements ActivityProcessableRemote {

      public void doInit()

      { Logger.getLogger(this.getClass().getName()).info("doInit"); }

      }

      EAR_2 : SMS-ACTIVE have one ejb (EJB_2):

      @Stateless(mappedName = "ejb/sms/active/SMSMainBean")
      @TransactionAttribute(value = TransactionAttributeType.NOT_SUPPORTED)
      public class SMSMainBean implements SMSBeanRemote
      public void onTextMessage(String message) {
      InitialContext ctx;
      try

      { ctx = new javax.naming.InitialContext(); Object lookup = ctx .lookup("ejb/sms/active/module/EJBCActivityTest"); ActivityProcessableRemote activity = (ActivityProcessableRemote) lookup; activity.doInit(); } catch (NamingException e) { e.printStackTrace(); }

      }

      }

      WAR_1 : Servlet (SERVLET_1) with <load-on-startup>1</load-on-startup> in
      web.xml (this servlet is packaged in SMS-ACTIVE.ear)

      ublic final class LifeCycleServlet extends javax.servlet.http.HttpServlet
      implements javax.servlet.Servlet {

      private transient java.util.logging.Logger logger;


      @Override
      public void init() throws ServletException {
      // start first part of code
      getLogger().info("--------- part 1");
      InitialContext ctx;
      try { ctx = new javax.naming.InitialContext(); Object lookup = ctx .lookup("ejb/sms/active/module/EJBCActivityTest"); ActivityProcessableRemote activity = (ActivityProcessableRemote) lookup; activity.doInit(); }

      catch (NamingException e)

      { e.printStackTrace(); }
      // end first part of code
      // start second part of code
      getLogger().info("--------- part 2");
      try { ctx = new javax.naming.InitialContext(); Object lookup = ctx .lookup("ejb/sms/active/SMSMainBean"); SMSBeanRemote activity = (SMSBeanRemote) lookup; activity.onTextMessage("message"); } catch (NamingException e) { e.printStackTrace(); }

      // end second part of code

      super.init();
      }

      public java.util.logging.Logger getLogger()

      { return logger == null ? logger = Logger .getLogger(LifeCycleServlet.class.getName()) : logger; }

      }

      So, in first part of (see servlet code listening) this code servlet call EJB_1
      from SERVLET_1 and in second part it call EJB_2 which call EJB_1.

      First part of this code always successes.
      But in some cases the second part of this code crashed with exception:

      javax.naming.NamingException: ejb ref resolution error for remote business
      interfacepl.smi.sms.active.process.ActivityProcessableRemote [Root exception is
      java.lang.IllegalArgumentException: object is not an instance of declaring class]
      at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:425)
      (...)
      Caused by: java.lang.IllegalArgumentException: object is not an instance of
      declaring class
      (...)

      I described the cases when this code crashed here:
      Case 1.
      Step 1. deploy RAR_1 with ActivityProcessableRemote.class (remote interface of
      EJB_1) on glassfish
      Step 2. deploy EAR_1
      Step 3. deploy EAR_2
      Step 3. deploy WAR_1 – init method of SERVLET_1 is called
      OUTCOME:
      First part of code: OK
      Second part of code: Exception.

      Case 2.
      Step 1. deploy EAR_1
      Step 2. deploy EAR_2
      Step 3. deploy RAR_1 with ActivityProcessableRemote.class (remote interface of
      EJB_1) on glassfish
      Step 4. deploy WAR_1 – init method of SERVLET_1 is called
      OUTCOME:
      First part of code: OK
      Second part of code: OK.

      Case 3.
      Step 1. deploy EAR_1
      Step 2. deploy EAR_2
      Step 3. deploy WAR_1 – init method of SERVLET_1 is called
      (RAR_1 is not on the glassfish)
      OUTCOME:
      First part of code: OK
      Second part of code: OK.

      Case 4.
      Step 1. deploy RAR_1 without definition of ActivityProcessableRemote interface
      Step 2. deploy EAR_1
      Step 3. deploy EAR_2
      Step 3. deploy WAR_1 – init method of SERVLET_1 is called
      OUTCOME:
      First part of code: OK
      Second part of code: OK.

      Conclusion:
      Problem occurred only when definition of ejb interface are deployed in RAR_1
      before EAR_2 is deployed.

      Full exception:
      [#|2009-04-22T05:54:52.542+0000|WARNING|sun-appserver9.1|javax.enterprise.system.stream.err|_ThreadID=16;_ThreadName=httpWorkerThread-4848-0;_RequestID=ecfcfc68-5b91-4c18-97c4-064f5ad358bb;|
      javax.naming.NamingException: ejb ref resolution error for remote business
      interfacepl.smi.sms.active.process.ActivityProcessableRemote [Root exception is
      java.lang.IllegalArgumentException: object is not an instance of declaring class]
      at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:425)
      at
      com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:74)
      at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
      at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:403)
      at javax.naming.InitialContext.lookup(InitialContext.java:392)
      at pl.smi.sms.active.manager.SMSMainBean.onTextMessage(SMSMainBean.java:40)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.rFull exception:
      [#|2009-04-22T05:54:52.542+0000|WARNING|sun-appserver9.1|javax.enterprise.system.stream.err|_ThreadID=16;_ThreadName=httpWorkerThread-4848-0;_RequestID=ecfcfc68-5b91-4c18-97c4-064f5ad358bb;|
      javax.naming.NamingException: ejb ref resolution error for remote business
      interfacepl.smi.sms.active.process.ActivityProcessableRemote [Root exception is
      java.lang.IllegalArgumentException: object is not an instance of declaring class]
      at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:425)
      at
      com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:74)
      at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
      at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:403)
      at
      javaxeflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at
      com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1067)
      at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:176)
      at
      com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2895)
      at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3986)
      at
      com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:203)
      at
      com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:77)
      at $Proxy23.onTextMessage(Unknown Source)
      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.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:154)
      at
      com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:687)
      at
      com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:227)
      at
      com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1846)
      at
      com.sun.corba.ee.impl.protocol.SharedCDRClientRequestDispatcherImpl.marshalingComplete(SharedCDRClientRequestDispatcherImpl.java:183)
      at
      com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.invoke(CorbaClientDelegateImpl.java:219)
      at
      com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:192)
      at
      com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:152)
      at
      com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:225)
      at
      pl.smi.sms.active.manager._SMSBeanRemote_Remote_DynamicStub.onTextMessage(pl/smi/sms/active/manager/_SMSBeanRemote_Remote_DynamicStub.java)
      at
      pl.smi.sms.active.manager._SMSBeanRemote_Wrapper.onTextMessage(pl/smi/sms/active/manager/_SMSBeanRemote_Wrapper.java)
      at pl.smi.sms.active.LifeCycleServlet.init(LifeCycleServlet.java:48)
      at javax.servlet.GenericServlet.init(GenericServlet.java:254)
      at
      org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1178)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1007)
      at
      org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4808)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:5196)
      at com.sun.enterprise.web.WebModule.start(WebModule.java:326)
      at
      org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:973)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:957)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:688)
      at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1584)
      at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1222)
      at
      com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:182)
      at
      com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:278)
      at
      com.sun.enterprise.admin.event.AdminEventMulticaster.invokeModuleDeployEventListener(AdminEventMulticaster.java:974)
      at
      com.sun.enterprise.admin.event.AdminEventMulticaster.handleModuleDeployEvent(AdminEventMulticaster.java:961)
      at
      com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:464)
      at
      com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:176)
      at
      com.sun.enterprise.admin.server.core.DeploymentNotificationHelper.multicastEvent(DeploymentNotificationHelper.java:308)
      at
      com.sun.enterprise.deployment.phasing.DeploymentServiceUtils.multicastEvent(DeploymentServiceUtils.java:226)
      at
      com.sun.enterprise.deployment.phasing.ServerDeploymentTarget.sendStartEvent(ServerDeploymentTarget.java:298)
      at
      com.sun.enterprise.deployment.phasing.ApplicationStartPhase.runPhase(ApplicationStartPhase.java:132)
      at
      com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:108)
      at
      com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:919)
      at
      com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:591)
      at
      com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:635)
      at
      com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.start(ApplicationsConfigMBean.java:744)
      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.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:375)
      at
      com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:358)
      at
      com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:464)
      at
      com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
      at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
      at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
      at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:90)
      at $Proxy1.invoke(Unknown Source)
      at
      com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:304)
      at
      com.sun.enterprise.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:174)
      at
      com.sun.enterprise.admin.jmx.remote.server.callers.InvokeCaller.call(InvokeCaller.java:69)
      at
      com.sun.enterprise.admin.jmx.remote.server.MBeanServerRequestHandler.handle(MBeanServerRequestHandler.java:155)
      at
      com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.processRequest(RemoteJmxConnectorServlet.java:122)
      at
      com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.doPost(RemoteJmxConnectorServlet.java:193)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
      at
      org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
      at
      org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:290)
      at
      org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
      at
      org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
      at
      org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
      at
      org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
      at org.apache.catalina.core.StandardHostValve.invoke(Sta|#]

      [#|2009-04javax.naming.NamingException: ejb ref resolution error for remote
      business interfacepl.smi.sms.active.process.ActivityProcessableRemote [Root
      exception is java.lang.IllegalArgumentException: object is not an instance of
      declaring class]
      at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:425)
      at
      com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:74)-22T05:54:52.543+0000|WARNING|sun-appserver9.1|javax.enterprise.system.stream.err|_ThreadID=16;_ThreadName=httpWorkerThread-4848-0;_RequestID=ecfcfc68-5b91-4c18-97c4-064f5ad358bb;|ndardHostValve.java:206)
      at
      org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
      at
      org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
      at
      org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
      at
      org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
      at
      org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
      at
      org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
      at
      org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
      at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
      at
      com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
      at
      com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
      at
      com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
      at
      com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
      at
      com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
      at
      com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
      at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
      at
      com.sun.enterprise.web.connector.grizzly.WorkerThreadImpl.run(WorkerThreadImpl.java:116)
      Caused by: java.lang.IllegalArgumentException: object is not an instance of
      declaring class
      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.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:372)
      ... 106 more

      #]

        Activity

        Hide
        rmalinowski added a comment -

        Created an attachment (id=2641)
        source and bin with maven poms

        Show
        rmalinowski added a comment - Created an attachment (id=2641) source and bin with maven poms
        Hide
        ksak added a comment -

        Marked v3_exclude

        Show
        ksak added a comment - Marked v3_exclude
        Hide
        marina vatkina added a comment -

        -> Cheng

        Show
        marina vatkina added a comment - -> Cheng
        Hide
        Tom Mueller added a comment -

        Reassigning to component lead as the assignee is no longer with the project.

        Show
        Tom Mueller added a comment - Reassigning to component lead as the assignee is no longer with the project.

          People

          • Assignee:
            marina vatkina
            Reporter:
            rmalinowski
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: