开发者

How can i deploy Session Bean on another computer with Client JSP/Servlet

开发者 https://www.devze.com 2023-01-14 14:13 出处:网络
Hello Everybody i\'m new in EJB3, i know how to deploy Session Bean 开发者_StackOverflow(Stateless or stateful) on Glassfish server in one computer. My question is: how can i deploy session bean on Co

Hello Everybody i'm new in EJB3, i know how to deploy Session Bean 开发者_StackOverflow(Stateless or stateful) on Glassfish server in one computer. My question is: how can i deploy session bean on Computer A and Deploy Servlet or JSP on Computer B? It mean Computer A have Session Bean Source and Computer B have Servlet or JSP source. if use 1 computer i can use @EJB dependency inject lookup Session Bean but on another computer how can i do it for client code? Example for 1 computer

@EJB
private StatelessRemote remote ;

double Dosomething= remote.Dosomething();

out.println(Dosomething);


  1. Create a "client jar" with the remote interfaces, deploy in on the client

  2. Provide the app server client jar (not necessary in your scenario)

  3. Provide a jndi.properties on the classpath with the following content (assuming GlassFish to GlassFish communication):

    java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory
    java.naming.factory.url.pkgs=com.sun.enterprise.naming
    java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl
    org.omg.CORBA.ORBInitialHost=<hostname>
    org.omg.CORBA.ORBInitialPort=3700
    
  4. Use the mappedName attribute of the @EJB annotation to specify the global JNDI name of the target Remote EJB component (If there is no jndi-name set in sun-ejb-jar.xml - or no sun-ejb-jar.xml at all - the global jndi-name defaults to the fully qualified Remote 3.0 Business interface class name) :

    @EJB(mappedName="com.acme.app.StatelessRemote")
    private StatelessRemote remote;
    

Resources

  • GlassFish EJB FAQ
  • http://courses.coreservlets.com/Course-Materials/pdf/ejb3/EJB3-2-Session-Beans.pdf
0

精彩评论

暂无评论...
验证码 换一张
取 消