0 Replies Latest reply on Jul 30, 2004 4:39 AM by bostjan_2

    Embedded Tomcat remote EJB interface lookup

    bostjan_2 Newbie

      Hi,

      I have following problem:
      Have EJB application where I have only remote interface (Session facade) and I am also using
      jboss-app.xml :

      <?xml version='1.0' encoding='UTF-8'?>
      <!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD J2EE Application 1.3V2//EN" "http://www.jboss.org/j2ee/dtd/jboss-app_3_2.dtd">
      <jboss-app>
       <loader-repository>myejb:loader= myejb.ear</loader-repository>
      </jboss-app>

      while I have more then one instances of the same application, but different settings.

      My jboss.xml :
      <?xml version="1.0" encoding="UTF-8"?>
      <jboss>
       <enterprise-beans>
       <session>
       <ejb-name>FacadeSessionEJB</ejb-name>
       <jndi-name>ejb/my_ejb/FacadeSessionEJB</jndi-name>
       </session>
      ...

      The problem is when I lookup for this interface from separately WAR file from Servlet like:
      Hashtable env = new Hashtable();
      env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
      env.put(Context.PROVIDER_URL, "localhost:1099");
      env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
      final InitialContext context=new InitialContext(env);
      
      FacadeSessionEJBHome ome facadeSessionEJBHome =
       (FacadeSessionEJBHome)PortableRemoteObject.narrow(context.lookup("ejb/my_ejb/FacadeSessionEJB"), FacadeSessionEJBHome.class);
       FacadeSessionEJB myrefEJB= facadeSessionEJBHome.create();

      I get on embedded Tomcat an error, but when I do the same thing in standalone (other process on the same machine) Tomcat it works just fine?
      What I am doing wrong ???

      Thanx Bostjan