users@glassfish.java.net

Re: Local vs Remote GF JNDI Names

From: Alexis Moussine-Pouchkine <alexis.mp_at_sun.com>
Date: Tue, 23 Dec 2008 15:35:24 +0100

Does your EJB have a remote interface? The wizard in NB generates a
local interface only by default.
-Alexis

On Dec 21, 2008, at 20:02, Garth Keesler wrote:

> Thanx for the quick reply. I've spent a lot of time working thru
> that FAQ with no success. In particular working with the first part
> dealing with stand-alone SE access to EJB's. I've also tried
> specifying the specific JNDI name in the @stateless(mappedName...)
> syntax but also with no luck. I'm still trying to figure out why an
> EJB module deployed to a local GF has the JNDI name but not when I
> deploy it to the remote GF server. One more bit of info, NetBeans
> indicates that the newly-deployed module failed to enable but when I
> use the admin console, it appears to have done so successfully. Is
> there something special I have to do in NB to deploy remotely?
>
> Thanx again...
>
> Alexis Moussine-Pouchkine wrote:
>> 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
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>