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

1

5

Hello Everybody i'm new in EJB3, i know how to deploy Session Bean (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);
Cycloparaffin answered 1/9, 2010 at 3:20 Comment(1)
#4764460Flita
S
6
  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

Stott answered 1/9, 2010 at 10:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.