1 2 3 Previous Next 31 Replies Latest reply on Oct 6, 2011 7:51 AM by notify Go to original post
      • 15. EJB 3.1 Global JNDI names
        jaikiran

        It should be working. JBoss AS6 binds to both EJB3.1 spec names as well as JBoss specific names. The log messages just print the JBoss specific JNDI names. Can you post the entire exception stacktrace and the exact code which shows the issue?

        • 16. Re: EJB 3.1 Global JNDI names
          luis.planella

          Sure. Here it is:

           

          The main class which looks up the remote interface

          public class RemoteTest {
              public static void main(String[] args) throws Exception {
                  InitialContext context = new InitialContext();
                  String jndiName = "java:global/cyclos4/UserSessionService!" +
                      UserSessionService.class.getName();
                  UserSessionService sessionService = (UserSessionService) context.lookup(jndiName);
                  System.out.println(sessionService.getAuthenticatedUser());
              }
          }
          

           

          The stack trace

          Exception in thread "main" javax.naming.NameNotFoundException: global not bound
               at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
               at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
               at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
               at org.jnp.server.NamingServer.lookup(NamingServer.java:396)
               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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
               at sun.rmi.transport.Transport$1.run(Transport.java:159)
               at java.security.AccessController.doPrivileged(Native Method)
               at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
               at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
               at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
               at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
               at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
               at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
               at java.lang.Thread.run(Thread.java:662)
               at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
               at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
               at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
               at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
               at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:728)
               at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688)
               at javax.naming.InitialContext.lookup(InitialContext.java:392)
               at org.cyclos.RemoteTest.main(RemoteTest.java:11)
          

           

          The jndi.properties file

          #jboss JNDI properties
          java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
          java.naming.provider.url=jnp://localhost:1099
          java.naming.factory.url.pkgs=org.jnp.interfaces
          
          ### The TimedSocketFactory connection timeout in milliseconds (0 == blocking) 
          jnp.timeout=0
          ### The TimedSocketFactory read timeout in milliseconds (0 == blocking) 
          jnp.sotimeout=0
          
          • 17. Re: EJB 3.1 Global JNDI names
            suikast42

            I get exactly the same Exception.

            • 18. EJB 3.1 Global JNDI names
              jaikiran

              Looks like you are doing the lookup from the remote standalone application. There's a known issue with that http://lists.jboss.org/pipermail/jboss-development/2010-November/016685.html

              • 19. Re: EJB 3.1 Global JNDI names
                suikast42

                I'm doing the lookup from a JUnit Testcase which is started by Arquillian. Either as IN_CONTAINER or AS_CLIENT is the same.

                • 20. Re: EJB 3.1 Global JNDI names
                  suikast42

                  I post the important part of my Arquillian TestCase.

                   

                  The deployment and the injection works wonderfull. But the lookup still fails.  I start the thestcase with the jbossas-remote-6 profile

                   

                      @Deployment

                      public static JavaArchive createTestArchive() {

                          JavaArchive arch = ShrinkWrap.create( JavaArchive.class, "test.jar" )

                          .addPackages( true,UserBean.class.getPackage()) // All EJB's

                          .addPackages( true, Customer.class.getPackage()) // All Entities

                          .addPackages( true,UserInContainerTestCase.class.getPackage()) // all Test Classes

                  //        .addClasses( UserInContainerTestCase.class, UserBeanRemote.class, UserBean.class, User.class, DBObject.class, UserIssueRole.class)

                  //        .addClasses( UserInContainerTestCase.class, UserBeanRemote.class)

                           .addManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));

                          return arch;

                      }

                     

                       @After

                       public void beforeTest(){

                           try {

                                   InitialContext pJndiContext = new InitialContext();

                                  NamingEnumeration<NameClassPair> nEn = pJndiContext.list( "java:global" );

                                  sLog.debug( "LIST" );

                                  while (nEn.hasMoreElements()) {

                                      sLog.debug( nEn.next() );

                                  }

                              } catch (Exception e1) {

                                  sLog.error( "ERROR",e1 );

                              }

                       }

                   

                       @EJB

                      private UserBeanRemote    ub;

                   

                      @Test

                      public void testTest(){

                          Assert.assertNotNull( ub );

                          sLog.info( "OK" );

                      }

                  • 21. Re: EJB 3.1 Global JNDI names
                    jaikiran

                    For the Arquillian related question, can you please create a new thread with the details, in the Arquillian forum? We can discuss it there, with other users/developers who are more familiar with it.

                    • 22. Re: EJB 3.1 Global JNDI names
                      suikast42

                      Thanks for fast reply,

                       

                      sure I can post the same question in Arquillian forum. But I mean this question i well placed here. Beacause  the same issue occurs if i try to lookup from outside the JBoss's VM. I'm right ?

                      • 23. Re: EJB 3.1 Global JNDI names
                        jaikiran

                        Sueleyman Vurucu wrote:

                         

                        Beacause  the same issue occurs if i try to lookup from outside the JBoss's VM. I'm right ?

                        Yes, outside JVM is a known issue. I thought you were also having problem when the Arquillian test was running IN_CONTAINER (i.e. same JVM). So I thought it might have to do something more specific to Arquillian.

                        • 24. Re: EJB 3.1 Global JNDI names
                          suikast42

                          Ok. You're right. I'll post this thread in Arquillian forum.

                          • 25. EJB 3.1 Global JNDI names
                            luis.planella

                            This is quite a critical bug, isn't it?

                            The standard jndi naming is an important feature in EJB 3.1, and not supporting renders JBoss 6 standards incompatible.

                            Should I report an issue or this is already being fixed?

                            • 26. EJB 3.1 Global JNDI names
                              jaikiran
                              • 27. EJB 3.1 Global JNDI names
                                luis.planella

                                Done: https://issues.jboss.org/browse/EJBTHREE-2233

                                Sorry for the delay. I was off all the weekend.

                                • 28. EJB 3.1 Global JNDI names
                                  mpiraccini

                                  Please fix that, for me it's a critical issue .

                                  • 29. EJB 3.1 Global JNDI names
                                    mcatalin23

                                    Is any workaround for this issue? EJBTHREE-2233