1 Reply Latest reply on Dec 15, 2011 3:34 PM by ctomc

    What is the JNDI parameter in ejb3 deployment?

    aupres

      I made ear project which contained war and jar project. Deployment is succeeded.

      Problem is JNDI in JSP client. I put some codes like below:

       

      Context ctx = new InitialContext();

      IEJBHelloWorldPort hello = (IEJBHelloWorldPort) ctx.lookup("EJBHelloWorldBean/remote"); //throws exception

       

      But JBoss throws exception like this :

       

      javax.naming.NameNotFoundException

       

      Deployment messages of EJB3 jar are

       

      19:36:24,319 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-1) JNDI bindings for session bean named EJBHelloWorldBean in deployment unit subdeployment "EJBHelloWorldBean.jar" of deployment "EJBHelloWorldEAR.ear" are as follows:

       

      java:global/EJBHelloWorldEAR/EJBHelloWorldBean/EJBHelloWorldBean!com.aaa.ejb3.IEJBHelloWorldPort
      java:app/EJBHelloWorldBean/EJBHelloWorldBean!com.aaa.ejb3.IEJBHelloWorldPort
      java:module/EJBHelloWorldBean!com.aaa.ejb3.IEJBHelloWorldPort
      java:global/EJBHelloWorldEAR/EJBHelloWorldBean/EJBHelloWorldBean
      java:app/EJBHelloWorldBean/EJBHelloWorldBean
      java:module/EJBHelloWorldBean

       

      19:36:24,444 INFO  [org.jboss.web] (MSC service thread 1-1) registering web context: /EJBHelloWorldWeb
      19:36:24,491 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed "EJBHelloWorldEAR.ear"

       

      Then what is the JNDI lookup parameter? Pls, inform me. Thanks in advanced.

       

      Best regards.

        • 1. Re: What is the JNDI parameter in ejb3 deployment?
          ctomc

          JNDI name is any one of those that you got in log file.

           

          so if you do:

           

          Context ctx = new InitialContext();
          IEJBHelloWorldPort hello = (IEJBHelloWorldPort) ctx.lookup("java:module/EJBHelloWorldBean");
          

           

          it should work, and also you are trying to get remote bean, but you do not deploy it... that is also a reason why it does not work.

           

           

          cheers,

          tomaz