13 Replies Latest reply on Mar 12, 2012 5:31 AM by wdfink

    EJBException:Invalid invokation Exception while accessing fr

    upankar

      Hi,
      I get the exception (pasted below), when I try to invoke the create on home from a war app. Also, this is happening only when both jar and war are in the same JBOSS instance. This doesnt happen if i deploy them into two separate JBOSS instances, and then access the EJB from the war. Also, i am successfully able to invoke the EJB from a stand-alone client. Hence, i feel the bug is related to accessing the EJB from a war, both deployed in a single JBOSS instance. The version I am using is 4.0.2. Can anyone suggest a fix/workaround for this ?

      03:01:26,104 INFO [STDOUT] at java.lang.Thread.run(Thread.java:536)
      03:01:26,114 INFO [STDOUT] Caused by: javax.ejb.EJBException: Invalid invocation, check your deployment packaging, meth
      od=public abstract test.ejb.TestEJBInterface test.ejb.TestEJBHome.create() throws javax.ejb.CreateException,java.rmi.RemoteException

        • 1. Re: EJBException:Invalid invokation Exception while accessin
          ebrain13

          A complete stack trace would give more insight into your problem


          • 2. Re: EJBException:Invalid invokation Exception while accessin
            upankar

            Following is the full trace :

            04:03:33,714 INFO [STDOUT] java.rmi.ServerException: EJBException:; nested exception is:
            javax.ejb.EJBException: Invalid invocation, check your deployment packaging, method=public abstract test.ejb.TestEJBInterface test.ejb.TestEJBHome.create() throws javax.ejb.CreateException,java.rmi.RemoteExce
            ption
            04:03:33,714 INFO [STDOUT] at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:352)
            04:03:33,724 INFO [STDOUT] at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:125)
            04:03:33,724 INFO [STDOUT] at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInte
            rceptor.java:93)
            04:03:33,724 INFO [STDOUT] at org.jboss.ejb.SessionContainer.internalInvokeHome(SessionContainer.java:613)
            04:03:33,724 INFO [STDOUT] at org.jboss.ejb.Container.invoke(Container.java:894)
            04:03:33,724 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            04:03:33,724 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            04:03:33,724 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

            04:03:33,724 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:324)
            04:03:33,724 INFO [STDOUT] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
            04:03:33,724 INFO [STDOUT] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
            04:03:33,724 INFO [STDOUT] at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
            04:03:33,724 INFO [STDOUT] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
            04:03:33,724 INFO [STDOUT] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
            04:03:33,734 INFO [STDOUT] at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:15
            5)
            04:03:33,734 INFO [STDOUT] at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:104)
            04:03:33,734 INFO [STDOUT] at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:179)
            04:03:33,734 INFO [STDOUT] at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:165)
            04:03:33,734 INFO [STDOUT] at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
            04:03:33,734 INFO [STDOUT] at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
            04:03:33,734 INFO [STDOUT] at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:169)
            04:03:33,734 INFO [STDOUT] at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
            04:03:33,734 INFO [STDOUT] at $Proxy87.create(Unknown Source)

            • 3. Re: EJBException:Invalid invokation Exception while accessin
              ebrain13

               

              04:03:33,724 INFO [STDOUT] at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
              04:03:33,724 INFO [STDOUT] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
              04:03:33,724 INFO [STDOUT] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
              04:03:33,734 INFO [STDOUT] at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:15
              5)
              04:03:33,734 INFO [STDOUT] at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:104)
              04:03:33,734 INFO [STDOUT] at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:179)
              04:03:33,734 INFO [STDOUT] at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:165)



              Looking at the above lines in stack trace, tells me that there is local invocation of the bean being tried. The exception is right , check your deployment descriptor, especially jboss.xml for the jndi you are supposed to use for the remote lookup.

              HTH,
              Vikram.


              • 4. Re: EJBException:Invalid invokation Exception while accessin
                upankar

                Solved it with the following 3 steps:
                1] Edit conf/jboss-service.xml and make CallByValue as 'true' in NamingService as below

                <mbean code="org.jboss.naming.NamingService"
                name="jboss:service=Naming"
                xmbean-dd="resource:xmdesc/NamingService-xmbean.xml">
                true


                2] Edit deploy/ear-deployer.xml, and set Isloated and CallByValue as true

                3]Edit deploy\jbossweb-tomcat55.sar\META-INF\jboss-service.xml , and set Java2ClassLoadingCompilance and UseJbossWebLoader attributes as false

                Thanks Guys..

                - Upankar

                • 5. Re: EJBException:Invalid invokation Exception while accessin
                  jasoncao

                  By my testing , I found the last step should set value to true to solve this problem, because the orgin value is false in jboss.

                  true
                  true

                  Is this right?

                  • 6. Re: EJBException:Invalid invokation Exception while accessin
                    hcguersoy

                     

                    "jasoncao" wrote:
                    By my testing , I found the last step should set value to true to solve this problem, because the orgin value is false in jboss.

                    <attribute name="Java2ClassLoadingCompliance">true</attribute>
                     <attribute name="UseJBossWebLoader">true</attribute>


                    Is this right?


                    Hi,

                    yeah, i can confrim with. It works for me setting the last two flags to true.
                    I have loosed one day to check out why a simple lookup out of a servlet doesn't run anymore :-(



                    • 7. Re: EJBException:Invalid invokation Exception while accessin
                      n0mer

                       

                      "jasoncao" wrote:
                      By my testing , I found the last step should set value to true to solve this problem, because the orgin value is false in jboss.

                      <attribute name="Java2ClassLoadingCompliance">true</attribute>
                      <attribute name="UseJBossWebLoader">true</attribute>

                      Is this right?

                      Documentation (http://docs.jboss.org/jbossas/jboss4guide/r3/html/pr05.html#conf) proposes to set them "false"...

                      • 8. Re: EJBException:Invalid invokation Exception while accessin
                        xiaofengme

                        I use the same version JBoss AS, I meet the very problem too. I modify related configurations according to tips here, now the problem does not exist;

                        But I get another problem, when I package related war (web module) and jar (Ejb module) into one ear (J2ee application module) and deploy them into JBoss AS, I get exceptions.

                        The problem is very surprising, when I deploy the two module separately into the server, the problem does not exist.

                        Detailed exception stack trace lists here, please teach me how to solve it, thanks:

                        14:22:33,578 ERROR [[/amri-web]] Cannot instantiate class: org.jnp.interfaces.Na
                        mingContextFactory
                        javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interf
                        aces.NamingContextFactory. Root exception is
                        java.lang.ClassCastException: org.jnp.interfaces.NamingContextFactory
                        at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
                        59)
                        at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:250
                        )
                        at javax.naming.InitialContext.init(InitialContext.java:226)
                        at javax.naming.InitialContext.(InitialContext.java:202)
                        at XXXXXXXXXXXXXXXXXXXXXXXXXXXX.init(GlobalInit.java:70)
                        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
                        java:1091)
                        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:92
                        5)
                        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
                        t.java:3857)
                        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
                        118)
                        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
                        .java:759)
                        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:73
                        9)
                        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)

                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
                        java:39)
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
                        sorImpl.java:25)
                        at java.lang.reflect.Method.invoke(Method.java:585)
                        at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:
                        503)
                        at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:1
                        50)
                        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                        at org.apache.catalina.core.StandardContext.init(StandardContext.java:50
                        05)
                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
                        java:39)
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
                        sorImpl.java:25)
                        at java.lang.reflect.Method.invoke(Method.java:585)
                        at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:
                        503)
                        at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:1
                        50)
                        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                        at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal(TomcatD
                        eployer.java:274)
                        at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeploy(TomcatDeployer.
                        java:91)
                        at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:357)

                        at org.jboss.web.WebModule.startModule(WebModule.java:68)
                        at org.jboss.web.WebModule.startService(WebModule.java:46)
                        at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanS
                        upport.java:272)
                        at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMB
                        eanSupport.java:222)
                        at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
                        sorImpl.java:25)
                        at java.lang.reflect.Method.invoke(Method.java:585)
                        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
                        er.java:141)
                        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
                        at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
                        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
                        java:249)
                        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                        at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
                        ler.java:897)
                        at $Proxy0.start(Unknown Source)
                        at org.jboss.system.ServiceController.start(ServiceController.java:418)
                        at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
                        sorImpl.java:25)
                        at java.lang.reflect.Method.invoke(Method.java:585)
                        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
                        er.java:141)
                        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
                        at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
                        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
                        java:249)
                        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
                        at $Proxy28.start(Unknown Source)
                        at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:39
                        4)
                        at org.jboss.deployment.MainDeployer.start(MainDeployer.java:964)
                        at org.jboss.deployment.MainDeployer.start(MainDeployer.java:956)
                        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:775)
                        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:738)
                        at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
                        sorImpl.java:25)
                        at java.lang.reflect.Method.invoke(Method.java:585)
                        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
                        er.java:141)
                        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
                        at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractIntercept
                        or.java:121)
                        at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
                        at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelM
                        BeanOperationInterceptor.java:127)
                        at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
                        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
                        java:249)
                        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
                        at $Proxy8.deploy(Unknown Source)
                        at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymen
                        tScanner.java:325)
                        at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentS
                        canner.java:501)
                        at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
                        doScan(AbstractDeploymentScanner.java:204)
                        at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(A
                        bstractDeploymentScanner.java:277)
                        at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanS
                        upport.java:272)
                        at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMB
                        eanSupport.java:222)
                        at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
                        sorImpl.java:25)
                        at java.lang.reflect.Method.invoke(Method.java:585)
                        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
                        er.java:141)
                        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
                        at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
                        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
                        java:249)
                        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                        at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
                        ler.java:897)
                        at $Proxy0.start(Unknown Source)
                        at org.jboss.system.ServiceController.start(ServiceController.java:418)
                        at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
                        sorImpl.java:25)
                        at java.lang.reflect.Method.invoke(Method.java:585)
                        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
                        er.java:141)
                        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
                        at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
                        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
                        java:249)
                        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
                        at $Proxy4.start(Unknown Source)
                        at org.jboss.deployment.SARDeployer.start(SARDeployer.java:273)
                        at org.jboss.deployment.MainDeployer.start(MainDeployer.java:964)
                        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:775)
                        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:738)
                        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:722)
                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
                        java:39)
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
                        sorImpl.java:25)
                        at java.lang.reflect.Method.invoke(Method.java:585)
                        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
                        er.java:141)
                        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
                        at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractIntercept
                        or.java:121)
                        at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
                        at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelM
                        BeanOperationInterceptor.java:127)
                        at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
                        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
                        java:249)
                        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
                        at $Proxy5.deploy(Unknown Source)
                        at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:434)
                        at org.jboss.system.server.ServerImpl.start(ServerImpl.java:315)
                        at org.jboss.Main.boot(Main.java:195)
                        at org.jboss.Main$1.run(Main.java:463)
                        at java.lang.Thread.run(Thread.java:595)

                        • 9. Re: EJBException:Invalid invokation Exception while accessin
                          rfr

                          For me, the solution to the problem was to remove the client jar from the /WEB-INF/lib directory, as suggested in an other post.

                          Normal or not?

                          • 10. Re: EJBException:Invalid invokation Exception while accessin
                            xiaofengme

                            There are no any JBoss itself's libraries int he war file!

                            What's the real reason?

                            • 11. Re: EJBException:Invalid invokation Exception while accessin
                              xiaofengme

                              File jbossall-client.jar does not exist the war
                              file.

                              Please confirm the real reason!

                              Thanks!

                              • 12. Re: EJBException:Invalid invokation Exception while accessin
                                vinsinraw

                                I had the similar issue, but on JBOSS 5.1.

                                I created an EJB project associated with an EAR and deployed the EAR.

                                Again I created new dynamic web project with a single servlet having logics to access my remote bean method. I deployed in the same JBOSS instance. I was getting the similar exception "javax.ejb.EJBException: Invalid invocation, check your deployment packaging......"

                                 

                                I did only two steps out of three and it worked for me.

                                 

                                1. Modified jboss-service.xml   @ \jboss-5.1.0.GA\server\default\conf\jboss-service.xml

                                Modify attribute CallByValue to true in the following code snippet.

                                 

                                <mbean code="org.jboss.naming.NamingService"

                                      name="jboss:service=Naming"

                                      xmbean-dd="resource:xmdesc/NamingService-xmbean.xml">

                                      <!-- The call by value mode. true if all lookups are unmarshalled using

                                         the caller's TCL, false if in VM lookups return the value by reference.

                                      -->

                                      <attribute name="CallByValue">true</attribute>

                                ...

                                ...

                                 

                                 

                                2. Modifed ear-deployer-jboss-beans.xml       @ \jboss-5.1.0.GA\server\default\deployers\ear-deployer-jboss-beans.xml

                                Again modify property CallByValue to true. Also modify property isolated to true.

                                 

                                Here is the code snippet for better view..

                                 

                                <!-- A flag indicating if the ear components should have in VM call

                                         optimization disabled.

                                      -->

                                      <property name="callByValue">true</property>

                                 

                                      <!-- Specify an unauthenticated identity -->

                                      <property name="unauthenticatedIdentity">anonymous</property>   

                                   </bean>

                                   <bean name="EARClassLoaderDeployer" class="org.jboss.deployment.EarClassLoaderDeployer">

                                      <!-- A flag indicating if ear deployments should have their own scoped

                                         class loader to isolate their classes from other deployments.

                                      -->     

                                      <property name="isolated">true</property>

                                   </bean>

                                • 13. Re: EJBException:Invalid invokation Exception while accessin
                                  wdfink

                                  You should not reactivate such old account.

                                   

                                  For better help on you problem you should please post the Exception.

                                  Also what if you reject your configuration changes ?