1 Reply Latest reply on Jun 29, 2013 4:14 PM by wdfink

    JBoss 7.1.1.Final remote EJB JNDI lookup

    throwable

      Hello,

       

      I have a web application that uses remote EJBs deployed on JBoss server. When I start it in standalone mode using embedded Jetty container it works fine. It does JNDI lookups and invokes EJBs well. When I package it as .war and deploy on the same JBoss server it fails on creating InitialContext:

       

      java.lang.ClassNotFoundException: org.jboss.naming.remote.client.ejb.RemoteNamingEjbClientContextSelector from [Module "org.jboss.remote-naming:main" from local module loader @290fbc (roots: /opt/soctx/netloader-jboss/modules)]

                org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

                org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

                org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

                org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

                org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

                org.jboss.naming.remote.client.InitialContextFactory.setupEjbContext(InitialContextFactory.java:414)

                org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:115)

                javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)

                javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)

                javax.naming.InitialContext.init(InitialContext.java:223)

                javax.naming.InitialContext.<init>(InitialContext.java:197)

       

      These are my InitialContext properties:

       

       



      jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");


      jndiProperties.put(Context.PROVIDER_URL, "remote://xxx:4447");


      jndiProperties.put(Context.SECURITY_PRINCIPAL, "qqq");


      jndiProperties.put(Context.SECURITY_CREDENTIALS, "aaa");


      jndiProperties.put("jboss.naming.client.ejb.context", true);

       

       

      I saw that remote-naming module must be placed to deployment's dependencies. I tried these ways:

       

      1. Added module to jboss:ee subsystem

      <subsystem xmlns="urn:jboss:domain:ee:1.0">

                          <global-modules>

                                    <module name="org.jboss.remote-naming" slot="main"/>

                                    <module name="org.jboss.ejb-client" slot="main"/>

                          </global-modules> 

      </subsystem>

       

      2. Added jboss-deployment-structure.xml to .war

      <?xml version="1.0" encoding="UTF-8"?>

      <jboss-deployment-structure>

        <deployment>

          <dependencies>

                    <module name="org.jboss.remote-naming" />

          </dependencies>

                </deployment>

      </jboss-deployment-structure>

       

      3. Added client jars to .war via maven dependencies:

       



      <dependency>
        
      <groupId>org.jboss.as</groupId>
        
      <artifactId>jboss-as-ejb-client-bom</artifactId>
        
      <version>7.1.0.Final</version>
        
      <type>pom</type>
        
      <scope>provided</scope>

      </dependency>

       

       

      But I always get the same error. I saw that this class org.jboss.naming.remote.client.ejb.RemoteNamingEjbClientContextSelector is present in the module's .jar.

      Is it possible to invoke remote beans from JBoss instance?

       

      Regards,

      Antón