4 Replies Latest reply on May 27, 2011 6:17 AM by armdev

    JBoss 6/EJB 3.1 - Lookup from client app under Tomcat

    armdev

      HI All, I start usiing JBoss 6 and have the first big problem.

       

      Could not lookup EJB 3.1 bean from client application what work undet Tomcat.

       

      Previous times I added jbossall-client.jar to my web app libraries and all was ok.

       

      But now I do the same but can not lookup, Also jbossall-client.jar in JBoss 6 too small.

       

      Here is a standart code for lookup

       

      static void testFacade() {     

              InitialContext context = null;

       

              Properties props = new Properties();

              props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");

              props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");

              props.setProperty("java.naming.provider.url", "jnp://localhost:1099");

              try {

                  context = new InitialContext(props);

                

                 

                  UserFacadeRemote manager = (UserFacadeRemote) context.lookup("realty/UserFacade/remote");

                  Object ob = context.getNameInNamespace();

                 

                  manager.businessMethod();

              } catch (Exception e) {

                 

                  System.out.println(e);

              }

          }

       

      Here isa exception

       

      javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]

       

      Please help, if someone already fix this problem pls reply.

       

      Best Regards,