Connecting to EJB beans from app. client from another machine

Discussions

General J2EE: Connecting to EJB beans from app. client from another machine

  1. I know how to setup an enterprise application with EJB and a web service so that the JSP pages, Servlets or the application client can use the EJBs. They are all working on the same machine though. Now I want to take the created application client and use it on an other machine. I want the application client to use the EJBs that are loaded onto the server. How can i do it ? How and where in the application client can I specify the IP address of the Application Server holding the EJBs ? I am using NetBeans 6.1 and Glassfish. Thanks for all your help
  2. What you need to do is to configure your InitialContext to refer to the Appserver's JNDI tree so that you do a lookup on the appserver to get the home interface. Following code snippet might help you: import java.util.Hashtable; import javax.naming.Context; import javax.naming.InitialContext; props.put(Context.PROVIDER_URL, providerUrl); props.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); ctx = new InitialContext(props); The providerUrl need to point to the server location. The protocol and port of this URL is very specific to the appserver. For weblogic, the protocol is called "t3".
  3. EJB 3 spec provide possibilities of creating app-clients without using lookup but dependency injection.Meaning Beans are called like in Web-apps.see netbeans sample:InterceptorStateless