users@glassfish.java.net

Re: Local vs Remote GF JNDI Names

From: Alexis Moussine-Pouchkine <alexis.mp_at_sun.com>
Date: Sun, 21 Dec 2008 19:39:04 +0100

Hello Garth,

I would suggest you read https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html
It most likely has answers to your questions.

cheers,
-Alexis

On Dec 21, 2008, at 19:13, Garth Keesler wrote:

> I'm a relative newbie exploring my first J2SE client accessing EJBs
> on a remote GF server (but still local to my LAN). I have created an
> EE 5 module (not application) which deploys successfully to both the
> local GF server as well as the remote GF server. The SE app runs
> successfully against the local GF but not the remote, giving a
> naming exception when looking up the JNDI name of the remote session
> bean. When I use "asadmin list-jndi-entries" on the local GF, the
> remote session beans show up but not when I use the same command on
> the remote server. The GF web console on each GF server shows the
> module correctly deployed. Is there some other magic I have to do to
> get the entries loaded into JNDI when deploying from NetBeans v6.5
> to a remote box? Again, all works fine when running against the
> locally-installed GF server.
>
> Most of the code is "borrowed" from various HowTos I've found on the
> web.
>
> Thanx,
> Garth
>
> Below is the SE code I'm playing with:
>
> /*
> * To change this template, choose Tools | Templates
> * and open the template in the editor.
> */
> package oescoretest;
>
> import OESCore.EJBs.Vendor;
> import OESCore.EJBs.VendorSessionRemote;
> import java.util.Properties;
> import javax.naming.Context;
> import javax.naming.InitialContext;
> import javax.naming.NamingException;
>
> /**
> *
> * @author garthk
> */
> public class Main
> {
>
> /**
> * @param args the command line arguments
> */
> public static void main(String[] args)
> {
> try
> {
> Properties props = new Properties();
> props.setProperty("java.naming.factory.initial",
>
> "com.sun.enterprise.naming.SerialInitContextFactory");
> props.setProperty("java.naming.factory.url.pkgs",
> "com.sun.enterprise.naming");
> props.setProperty("java.naming.factory.state",
>
> "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
> props.setProperty("org.omg.CORBA.ORBInitialHost",
> "gf1.gdkvpn.bogus");
> props.setProperty("org.omg.CORBA.ORBInitialPort", "3701");
>
> Context ic = new InitialContext(props);
> VendorSessionRemote vsb = (VendorSessionRemote)
> ic.lookup("com.oes.session.VendorSessionRemote");
> // TODO code application logic here
> Vendor v = (Vendor) vsb.fetch("poe");
> if (v == null)
> {
> System.out.println("No such Vendor.");
> }
> else
> {
> System.out.println(v.getVendorname());
> System.out.println(v.getMailingaddress());
> }
> }
> catch (NamingException ex)
> {
> //Logger.getLogger(Main.class.getName()).log(Level.SEVERE,
> null, ex);
> System.out.println(ex.getExplanation());
> }
> // TODO code application logic here
> }
> }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>