Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-6001

Unable to lookup remote JNDI EJBs

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • 7.1.1.Final
    • Remoting
    • None

      Based on the following arquillian test case:

      @RunWith(Arquillian.class)
      @RunAsClient
      public class RemoteDatabaseIntegratorTest {
      @Deployment(testable=false)
      public static JavaArchive createTestArchive()

      { return ShrinkWrap.create(JavaArchive.class,"myejb.jar") .addClasses(RemoteDatabaseIntegrator.class,RemoteDatabaseIntegratorImpl.class); }

      @ArquillianResource
      private Context context;

      private static final String JNDI_LOC = "java:module/RemoteDatabaseIntegratorImpl";

      private static final String[] JNDI_LOCS =

      { //"java:global/myejb/RemoteDatabaseIntegratorImpl!com.tad.arquillian.chp5.remoteejb.RemoteDatabaseIntegrator", //"java:app/myejb/RemoteDatabaseIntegratorImpl!com.tad.arquillian.chp5.remoteejb.RemoteDatabaseIntegrator", "java:module/RemoteDatabaseIntegratorImpl!com.tad.arquillian.chp5.remoteejb.RemoteDatabaseIntegrator", "java:jboss/exported/myejb/RemoteDatabaseIntegratorImpl!com.tad.arquillian.chp5.remoteejb.RemoteDatabaseIntegrator", //"java:global/myejb/RemoteDatabaseIntegratorImpl", //"java:app/myejb/RemoteDatabaseIntegratorImpl", "java:module/RemoteDatabaseIntegratorImpl" }

      ;

      @Test
      public void testDbServiceInjectionFailure() throws Exception{
      //Thread.sleep(1000000);
      //context.addToEnvironment(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.as.naming.InitialContextFactory");
      Hashtable<String,String> env = new Hashtable<String,String>();
      //env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.as.naming.InitialContextFactory");
      env.put(Context.PROVIDER_URL, "remote://127.0.0.1:4447");
      //env.put(Context.SECURITY_PRINCIPAL, "anon");
      //env.put(Context.SECURITY_CREDENTIALS, "anon123");
      Context context = new InitialContext(env);
      for(String JNDI_LOC : JNDI_LOCS) {
      try

      { RemoteDatabaseIntegrator dbIntegrator = (RemoteDatabaseIntegrator)context.lookup(JNDI_LOC); dbIntegrator.runQuery("select 1"); }

      catch (Exception e)

      { System.out.println("Failed to lookup by "+JNDI_LOC); e.printStackTrace(); }

      }
      }
      }

      I can see the JNDI locations populated, but cannot be retrieved, based on the following error:

      20:19:02,743 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-7) JNDI bindings for session bean named RemoteDatabaseIntegratorImpl in deployment unit deployment "myejb.jar" are as follows:

      java:global/myejb/RemoteDatabaseIntegratorImpl!com.tad.arquillian.chp5.remoteejb.RemoteDatabaseIntegrator
      java:app/myejb/RemoteDatabaseIntegratorImpl!com.tad.arquillian.chp5.remoteejb.RemoteDatabaseIntegrator
      java:module/RemoteDatabaseIntegratorImpl!com.tad.arquillian.chp5.remoteejb.RemoteDatabaseIntegrator
      java:jboss/exported/myejb/RemoteDatabaseIntegratorImpl!com.tad.arquillian.chp5.remoteejb.RemoteDatabaseIntegrator
      java:global/myejb/RemoteDatabaseIntegratorImpl
      java:app/myejb/RemoteDatabaseIntegratorImpl
      java:module/RemoteDatabaseIntegratorImpl

      20:19:02,912 INFO [org.jboss.as.server] (management-handler-thread - 2) JBAS018559: Deployed "myejb.jar"
      Failed to lookup by java:module/RemoteDatabaseIntegratorImpl!com.tad.arquillian.chp5.remoteejb.RemoteDatabaseIntegrator
      javax.naming.NameNotFoundException: java:module/RemoteDatabaseIntegratorImpl!com.tad.arquillian.chp5.remoteejb.RemoteDatabaseIntegrator
      at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:117)
      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:214)
      at javax.naming.InitialContext.lookup(InitialContext.java:411)
      at com.tad.arquillian.chp5.ejb.RemoteDatabaseIntegratorTest.testDbServiceInjectionFailure(RemoteDatabaseIntegratorTest.java:62)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
      at org.jboss.arquillian.junit.Arquillian$6$1.invoke(Arquillian.java:270)
      at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.execute(LocalTestExecuter.java:60)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
      at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
      at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
      at org.jboss.arquillian.container.test.impl.execution.ClientTestExecuter.execute(ClientTestExecuter.java:53)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

              dlloyd@redhat.com David Lloyd
              meetoblivion_jira John Ament (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: