2 Replies Latest reply: Jul 22, 2011 2:02 AM by Savas Ali Tokmen RSS

    Remote EJB lookup

    Savas Ali Tokmen Newbie

      Hello

       

      I'm trying to do deploy an EJB on JBoss 7 and look it up remotely, this unfortunately fails.

       

      1) The EJB's code can be found here: http://svn.codehaus.org/cargo/resources/trunk/testdata/simple-ejb/ (it's an EJB2)

       

      2) I put the EJB's JAR file into the deployments folder. JBoss tells me:

       

      23:47:41,625 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) Starting deployment of "simple-ejb-1.1.2-SNAPSHOT.jar"

      23:47:41,830 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean named SampleEJB in deployment unit deployment "simple-ejb-1.1.2-SNAPSHOT.jar" are as follows:

       

          java:global/simple-ejb-1.1.2-SNAPSHOT/SampleEJB!org.codehaus.cargo.sample.testdata.ejb.SampleBean

          java:app/simple-ejb-1.1.2-SNAPSHOT/SampleEJB!org.codehaus.cargo.sample.testdata.ejb.SampleBean

          java:module/SampleEJB!org.codehaus.cargo.sample.testdata.ejb.SampleBean

          java:global/simple-ejb-1.1.2-SNAPSHOT/SampleEJB

          java:app/simple-ejb-1.1.2-SNAPSHOT/SampleEJB

          java:module/SampleEJB

       

      23:47:42,118 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed "simple-ejb-1.1.2-SNAPSHOT.jar"

       

      Looking good!

       

      3) To look up, I do the following:

       

      Properties props = new Properties();

      props.setProperty(

          Context.INITIAL_CONTEXT_FACTORY, "org.jboss.as.naming.InitialContextFactory");

      props.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.as.naming.interfaces");

      props.setProperty(Context.PROVIDER_URL, "jnp://localhost:" + port);

      Context jndi = new InitialContext(props);

      return (T) jndi.lookup("SampleEJB");

       

      ... and this throws a NameNotFoundException!

       

      What am I doing wrong here?