Hi,
Can I tried the following approach to lookup the EJBs instead of suggested by the document from http://www.amitysolutions.com.au/documents/JBossTomcatJNDI-technote.pdf Here is what I want to do to get the EJBs from tomcat: 1) use an InitialContext object to get the ENC variables that were declared in the web.xml file. For example, <env-entry> <env-entry-name> AppServerIPAddr1 </env-entry-name> <env-entry-value>localhost</env-entry-value> <env-entry-type>java.lang.String</env-entry-type> </env-entry> <env-entry> <env-entry-name> AppServerIPAddr1PortNumber </env-entry-name> <env-entry-value>1099</env-entry-value> <env-entry-type>java.lang.String</env-entry-type> </env-entry> <env-entry> <description>INITIAL CONTEXT FACTORY</description> <env-entry-name>initialContextFactory</env-entry-name> <env-entry-value> org.jnp.interfaces.NamingContextFactory </env-entry-value> <env-entry-type>java.lang.String</env-entry-type> </env-entry> <env-entry> <env-entry-name> urlPackagePrefixes </env-entry-name> <env-entry-value> org.jboss.naming:org.jnp.interfaces </env-entry-value> <env-entry-type>java.lang.String</env-entry-type> </env-entry> <ejb-ref> <description>Reference to UserController Bean</description> <ejb-ref-name>ejb/refToUserControllerBean</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <home> com.wlwa.Infra.BusinessLogic.SessionBeans.Controller.UserControllerRemoteHome </home> <remote> com.wlwa.Infra.BusinessLogic.SessionBeans.Controller.UserControllerRemote </remote> <ejb-link>UserControllerBean</ejb-link> </ejb-ref> InitialContext ctx = new InitialContext(); String applicationServer1IPAddress = (String) ctx.lookUp("AppServerIPAddr1"); String applicationServer1PortNumber = (String) ctx.lookUp("AppServerIPAddr1PortNumber"); String urlPackagePrefixes = (String) ctx.lookUp("urlPackagePrefixes"); String initialContextFactory = (String) ctx.lookUp("initialContextFactory"); 2) Now when I got all information to create a properties object to be used when create the new InitialContext object for lookup the EJBs outside of the tomcat space. String url = "jnp://" + applicationServer1IPAddress + ":" + applicationServer1PortNumber; Properties props = new Properties(); props.setProperty(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory); props.setProperty(Context.URL_PKG_PREFIXES, urlPackagePrefixes); props.setProperty(Context.PROVIDER_URL, url); InitialContext remoteCtx = new InitialContext(props); 3) Now I have a IinitailContext object that point to the Jboss JNDI service at port 1099. Then I use the following code to access the EJB home object: ... try { anEJBHome = (EJBHome) PortableRemoteObject.narrow(ctx.lookup("java:comp/env/ejb/refToUserControllerBean"), aHomeClass); } catch (ClassCastException classCastEx) { throw new EJBHomeFactoryException(classCastEx); } catch (NamingException namingEx) { throw new EJBHomeFactoryException(namingEx); } Here is the ejb declaration for the bean in ejb-jar.xml <enterprise-beans> <session> <display-name>User Access Controller Session Bean</display-name> <ejb-name>UserControllerBean</ejb-name> <home> com.wlwa.Infra.BusinessLogic.SessionBeans.Controller.UserControllerRemoteHome </home> <remote> com.wlwa.Infra.BusinessLogic.SessionBeans.Controller.UserControllerRemote </remote> <ejb-class> com.wlwa.Infra.BusinessLogic.SessionBeans.Controller.UserControllerEJB </ejb-class> <session-type>Stateless</session-type> <transaction-type>Container</transaction-type> </session> </enterprise-beans> Here is the declaration in jboss.xml Code: <jboss> <enterprise-beans> <session> <ejb-name>UserControllerBean</ejb-name> <jndi-name>UserControllerBeanJNDI</jndi-name> <resource-ref> <res-ref-name>jdbc/AlertDB</res-ref-name> <jndi-name>java:/jdbc/AlertDB</jndi-name> </resource-ref> </session> ...... <enterprise-beans> <jboss> The UserControllerBean was packaged under a jar file named InfraSessionBeansControllerModule.jar in an ear file named MyApp.ear that was deployed in Jboss server in the same box as the tomcat was running. However, I got NamingException org.jnp.server.NamingServer.getBinding(NamingServer.java:495) org.jnp.server.NamingServer.getBinding(NamingServer.java:503) org.jnp.server.NamingServer.getObject(NamingServer.java:509) org.jnp.server.NamingServer.lookup(NamingServer.java:253) Did anyone have try this way to access to EJBs from Tomcat. Or this is not a good way to lookup EJBs from the web container. Any comment or suggestion is greatly appreciated. Kam --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]