3 Replies Latest reply on Sep 7, 2011 2:01 AM by sschulz

    NameNotFoundException in WAR

    sschulz Newbie

      Hey all!

       

      I have to test JBoss 7.0.1 with RAP for my company and am really confused since it seems so hard in comparison to the same installment with JBoss 6. 

       

      I have a really small bean for testing in my EAR:

       

      @Stateless(name = "TheAlmighty.PersonManager")
      public class PersonManagerBean implements PersonManager {
      
          @Override
          public String getGreeting() {
              return "Hello World!";
          }
      }
      
      @Remote
      public interface PersonManager {
      
            public String getGreeting();
      }
      

       

      JBoss seems to acknowledge that this bean exists:

       

      15:06:20,992 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-3) JNDI bindings for 
      session bean named TheAlmighty.PersonManager in deployment unit subdeployment "RAPTest_EJB.jar" of deployment "RAPTest.ear" are as follows:
      
              java:global/RAPTest/RAPTest_EJB/TheAlmighty.PersonManager!raptest.server.PersonManager
              java:app/RAPTest_EJB/TheAlmighty.PersonManager!raptest.server.PersonManager
              java:module/TheAlmighty.PersonManager!raptest.server.PersonManager
              java:global/RAPTest/RAPTest_EJB/TheAlmighty.PersonManager
              java:app/RAPTest_EJB/TheAlmighty.PersonManager
              java:module/TheAlmighty.PersonManager
      

       

      Now I try to access this bean on a deployed WAR file via:

       

                  Context context = new InitialContext();
                  PersonManager personMgr = (PersonManager) context
                          .lookup("java:app/RAPTest_EJB/TheAlmighty.PersonManager");
      

       

      But no matter what of the names above I  lookup the console of the server shows:

       

      15:07:31,211 ERROR [stderr] (UIThread [zF-i09RGn2sYilpWcZsFqAyN]) javax.naming.NameNotFoundException: java:app/RAPTest_EJB/TheAlmighty.PersonManager
      15:07:31,211 ERROR [stderr] (UIThread [zF-i09RGn2sYilpWcZsFqAyN])       at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:55)
      15:07:31,211 ERROR [stderr] (UIThread [zF-i09RGn2sYilpWcZsFqAyN])       at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:207)
      15:07:31,211 ERROR [stderr] (UIThread [zF-i09RGn2sYilpWcZsFqAyN])       at javax.naming.InitialContext.lookup(InitialContext.java:392)
      15:07:31,211 ERROR [stderr] (UIThread [zF-i09RGn2sYilpWcZsFqAyN])       at raptest.ServerView.performServerTest(ServerView.java:79)
      

       

      Would someone mind explaining what I'm doing wrong and how to correct it?

       

      (For this testing purpose I downloaded a brand new Eclipse and installed all the necessary tools, you can assume I have the newest version of everything, JBoss is 7.0.1final.)

       

      Thank you in advance.