1 Reply Latest reply on Feb 18, 2014 12:46 AM by runtobruce

    Jboss AS Migration from 4.0.3 to jboss 7.1.1, unable to call external @ejb.ejb-external-ref

    runtobruce

      Hi,

       

      I'm migrating my application from jboss 4.2.2 to jboss 7.1.1, facing lot of problems.

       

      Overview:

       

      I'm Using struts 1.1, EJB 2.1 using xdoclet 1.2.3 jars for generating the dependency files.(which is inevitable to use). I'm also having 2 dependent EAR (B.ear and C.ear)deployed in Jboss7/standalone/deployments. C.ear can able to start independently, and has EJB jars and war in it.. Also has a separate GUI for login. I'm having LDAP server for authenticating the users. Since B.ear has dependency over C.ear, so I did marked my dependencies in "jboss-deployment-structure.xml" in <dependencies> tag in B.ear.

      I've also changed my standalone-full.xml by configuring the datasources etc..

       

      While starting up the jboss 7 server AS like this..

       

      > standalone.bat --server-config:standalone-full.xml

       

      I'm getting the below ERROR, and stopping the server post error.

       

      11:31:32,042 ERROR [com.bk.bal.web.security.AuthCtextListener] (MSC service thread 1-8) javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.RuntimeException: Failed to setup EJB remote context]: javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.RuntimeException: Failed to setup EJB remote context]

       

          at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:36) [jboss-remote-naming-1.0.2.Final.jar:1.0.2.Final]

          at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:121) [jboss-remote-naming-1.0.2.Final.jar:1.0.2.Final]

          at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667) [rt.jar:1.6.0_27]

          at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288) [rt.jar:1.6.0_27]

          at javax.naming.InitialContext.init(InitialContext.java:223) [rt.jar:1.6.0_27]

          at javax.naming.InitialContext.<init>(InitialContext.java:197) [rt.jar:1.6.0_27]

          at com.bk.bal.ejb.security.RemoveActiveSessionsScheduledJobUtil.lookupHome(RemoveActiveSessionsScheduledJobUtil.java:16) [60babel-ejb.jar:]

          at com.bk.bal.babel.ejb.security.RemoveActiveSessionsScheduledJobUtil.getJBoss7Home(RemoveActiveSessionsScheduledJobUtil.java:60) [60babel-ejb.jar:]

          at com.bk.bal.babel.web.security.AuthCtextListener.contextInitialized(AuthCtextListener.java:91) [classes:]

          at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]

          at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]

          at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_27]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_27]

          at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_27]

       

      Caused by: java.lang.RuntimeException: Failed to setup EJB remote context

          at org.jboss.naming.remote.client.InitialContextFactory.setupEjbContext(InitialContextFactory.java:438) [jboss-remote-naming-1.0.2.Final.jar:1.0.2.Final]

          at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:115) [jboss-remote-naming-1.0.2.Final.jar:1.0.2.Final]

          ... 15 more

       

      Caused by: java.lang.reflect.InvocationTargetException

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_27]

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_27]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_27]

          at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_27]

          at org.jboss.naming.remote.client.InitialContextFactory.setupEjbContext(InitialContextFactory.java:420) [jboss-remote-naming-1.0.2.Final.jar:1.0.2.Final]

          ... 16 more

       

      Caused by: java.lang.SecurityException: EJB client context selector may not be changed

          at org.jboss.ejb.client.EJBClientContext.setSelector(EJBClientContext.java:181) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]

          at org.jboss.naming.remote.client.ejb.RemoteNamingEjbClientContextSelector.setupSelector(RemoteNamingEjbClientContextSelector.java:18) [jboss-remote-naming-1.0.2.Final.jar:1.0.2.Final]

          ... 21 more

       

      Also, there is a external EJB ref call from one of the EJBs from B.ear files to C.ear.

      I've defined my ejb-external-ref in one of the bean class to generate the xml elements in jboss.xml and ejb-jar.xml by xdoclet.

       

      @ejb.ejb-external-ref

      *    view-type="remote"

      *    jndi-name="ejb/c/UserFcad"

      *    ref-name="ejb/c/UserFcad"

      *    type="Session"

      *    home="com.bk.c.UserFcadRemoteHome"

      *    business="com.bk.c.UserFcadRemote"

       

      After referring the forums, I changed the jndi-name and ref-name like this,..

       

      jndi-name="ejb:C/24c/UserFcad!com.bk.c.UserFcadRemoteHome"

      ref-name="ejb:C/24c/UserFcad!com.bk.c.UserFcadRemoteHome"

       

      which generates the respective xml elements in

       

      --jboss.xml

       

      <ejb-ref>

                  <ejb-ref-name>ejb:C/24c/UserFcad!com.bk.c.UserFcadRemoteHome</ejb-ref-name>

                  <jndi-name>ejb:C/24c/UserFcad!com.bk.c.UserFcadRemoteHome</jndi-name>

               </ejb-ref>

       

      --ejb-jar.xml

       

      <session>

      ...

       

      <ejb-ref >

                  <ejb-ref-name>ejb:C/24c/UserFcad!com.bk.c.UserFcadRemoteHome</ejb-ref-name>

                  <ejb-ref-type>Session</ejb-ref-type>

                  <home>com.bk.c.UserFcadRemoteHome</home>

                  <remote>com.bk.c.UserFcadRemote</remote>

               </ejb-ref>

       

       

      # jboss-ejb-client.properties

       

      endpoint.name=client-endpoint

      remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false

      remote.connections=default

      remote.connection.default.host=127.0.0.1

      remote.connection.default.port = 4447

      remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

      remote.connection.x1.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT=false

      remote.connection.default.username=bAdmin

      remote.connection.default.password=cimesra

       

      # jndi.properties

      #

      java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory

      java.naming.factory.url.pkgs=org.jboss.ejb.client.naming

      jboss.naming.client.ejb.context=true

      java.naming.provider.url=remote://localhost:4447

      java.naming.security.principal=bAdmin

      java.naming.security.credentials=cimesra

       

       

      In console logs,

       

      12:23:34,019 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC00001: Failed to start service jboss.deployment.subunit."b.ear"."6b-ejb.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."b.ear"."6b-ejb.jar".INSTALL: Failed to process phase INSTALL of subdeployment "6b-ejb.jar" of deployment "b.ear"

          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_27]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_27]

          at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_27]

       

      Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011058: Failed to install component AdmnMgr

          at org.jboss.as.ee.component.deployers.ComponentInstallProcessor.deploy(ComponentInstallProcessor.java:100)

          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

          ... 5 more

       

      Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS014544: No EJB found with interface of type 'com.bk.c.UserFcadRemoteHome' for binding java:comp/env/ejb:C/24c/UserFcad!com.bk.c.UserFcadRemoteHome

          at org.jboss.as.ejb3.deployment.processors.EjbInjectionSource.getResourceValue(EjbInjectionSource.java:88)

          at org.jboss.as.ee.component.deployers.ComponentInstallProcessor.processBindings(ComponentInstallProcessor.java:245)

          at org.jboss.as.ee.component.deployers.ComponentInstallProcessor.deployComponent(ComponentInstallProcessor.java:189)

          at org.jboss.as.ee.component.deployers.ComponentInstallProcessor.deploy(ComponentInstallProcessor.java:93)

          ... 6 more

       

      Though, I've added only "ejb:C/24c/UserFcad!com.bk.c.UserFcadRemoteHome" in the jndi-name and ref-name in my facade bean class,

       

      Jboss 7 is looking up the EJB like this and throwing error.

       

      Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS014544: No EJB found with interface of type 'com.bk.c.UserFcadRemoteHome' for binding java:comp/env/ejb:C/24c/UserFcad!com.bk.c.UserFcadRemoteHome

       

      Why jboss is appending "java:comp/env/" in front of "ejb:C/24c/UserFcad!com.bk.c.UserFcadRemoteHome" which leads to ERROR.

       

      Getting EJB Name not found exception while EJB lookups-  javax.naming.NamingException and  java.lang.RuntimeException: Failed to setup EJB remote context etc..

      also, want to know how to deploy my EARs in sequence order?

      I'm using Same JVM, and the EARs are also deployed in same deployments folder in Jboss 7 AS.

      So wonder is my remote calling is correct.

       

      Any help is welcome.

       

      Thanks,

      Bruce

       

      Message was edited by: bruce L

        • 1. Re: Jboss AS Migration from 4.0.3 to jboss 7.1.1, unable to call external @ejb.ejb-external-ref
          runtobruce

          I've upgraded to Jboss EAP 6.1.0 Alpha (7.2.0), after tweaking the JNDI.properties and keeping the 24c.jar (ejb reference jar) in B.ear.

          upon keeping the jndi.properties in class path, the issue is resolved now.

           

          //commented this line

          #java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory

          //Added this line

          java.naming.factory.initial=org.jboss.as.naming.InitialContextFactory

           

          # jndi.properties

          #

          #java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory

          java.naming.factory.initial=org.jboss.as.naming.InitialContextFactory

          java.naming.factory.url.pkgs=org.jboss.ejb.client.naming

          jboss.naming.client.ejb.context=true

          java.naming.provider.url=remote://localhost:4447

          java.naming.security.principal=bAdmin

          java.naming.security.credentials=cimesra

           

          Its working as expected and able to retrieve records fine.