geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Xiao-fei Song <xfsong_ch...@yahoo.com>
Subject RE: jndi lookup in remote client for geronimo v2
Date Mon, 02 Jul 2007 08:24:25 GMT

Hi,

Just wanted to let you know I modified a little bit about the code:

        props.setProperty("java.naming.factory.initial",
"org.apache.openejb.client.RemoteInitialContextFactory");
        props.setProperty("java.naming.provider.url", "127.0.0.1:4201");
        props.setProperty("java.naming.security.principal", "system");
        props.setProperty("java.naming.security.credentials", "manager");
        
        Context ic = new InitialContext(props);
        System.out.println("ic = " + ic);
        
        Object objRef = ic.lookup("MySessionRemoteHome");
        System.out.println("objRef = " + objRef);
        
        test.abc.MySessionRemoteHome home =
(test.abc.MySessionRemoteHome)PortableRemoteObject.narrow(objRef,
test.abc.MySessionRemoteHome.class);
        System.out.println("home = " + home);
        
        test.abc.MySessionRemote remote = home.create();
        System.out.println("remote = " + remote);
        
        String message = remote.getString();
        System.out.println("message = " + message);


and it works okay on geronimo 1.2 beta. So this really makes me confused, is
this a regression or intended to be. Can someone in this alias please
respond me?

Thanks,
Chris


Xiao-fei Song wrote:
> 
> Hi Mark,
> 
> Thanks for your response.
> 
> 1. For the time being, I don't really care if the client is really
> "remote". From my tests, it looks like only "127.0.0.1" is accepted
> otherwise the connects just failed. I don't know where the documentation
> can be found on this.
> 
> 2. Yes I assume all the libraries are there for the EJB call. And they
> are:
> 
> cglig-nodep
> geronimo-kernel
> openejb-core
> openejb-client
> j2ee.jar (from j2ee ri)
> 
> 3. Unfortunately it does not work with "ejb/MySessionRemoteHome" and here
> is what I got:
> 
> ic = javax.naming.InitialContext@1e51060
> Exception in thread "main" javax.naming.NameNotFoundException:
> /ejb/MySessionRemoteHome does not exist in the system.  Check that the app
> was successfully deployed.
>         at
> org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:231)
>         at javax.naming.InitialContext.lookup(Unknown Source)
>         at apachegclient.TestClient.main(TestClient.java:43)
> 
> 
> I would say my first experiences with Genonimo is frustrated because I
> just spent a whole day on a very simple task. Anyway, if you have the
> sample code (both the ejb and the ejb client) that works with geronimo v2,
> please send it to my email address.
> 
> Thanks,
> Chris
> 
> 
> 
> Mark Aufdencamp wrote:
>> 
>> Hi Chris, 
>> 
>> I'll give it a shot at helping you.  I've been able to do this thanks to
>> much help from others on this list.
>> 
>> Are you truly doing this as a remote client from a different machine
>> than the server?  If so, the IP addres your using for the naming
>> provider should be the server address, rather than the local loopback
>> address.
>> 
>> Do you have all of the required remote client libraries in the class
>> path for the remote EJB call?  I can look back at my notes and provide
>> these if you need them.
>> 
>> I believe the remote name will probably be proceeded by "ejb".  As in
>> "ejb/MySessionRemoteHome".
>> 
>> I can dig up some code of my own that works if you'ld like.
>> 
>> Hope this helps some.
>> 
>> Mark Aufdencamp
>> Mark@Aufdencamp.com
>> 
>>> -------- Original Message --------
>>> Subject: jndi lookup in remote client for geronimo v2
>>> From: Xiao-fei Song <xfsong_chris@yahoo.com>
>>> Date: Fri, June 29, 2007 7:04 am
>>> To: user@geronimo.apache.org
>>> 
>>> Hi guys,
>>> 
>>> I have developed an EJB 2.x stateless session using netbeans, and I
>>> want to write a very simple stand alone ejb client to access it in
>>> geronimo v2. The code looks like below:
>>> 
>>> 
>>>         props.setProperty("java.naming.factory.initial",
>>> "org.openejb.client.RemoteInitialContextFactory");
>>>         props.setProperty("java.naming.provider.url", "127.0.0.1:4201");
>>>         //props.setProperty("java.naming.security.principal",
>>> "testuser");
>>>         //props.setProperty("java.naming.security.credentials",
>>> "testpassword");
>>>         
>>>         Context ic = new InitialContext(props);
>>>         System.out.println("ic = " + ic);
>>>         
>>>         Object objRef = ic.lookup("MySessionRemoteHome");
>>> 
>>> I read the documentation and it looks like the only way to lookup in
>>> the remote client is through jndi-name in openejb-jar.xml. And I have
>>> done that as below:
>>> 
>>> <?xml version="1.0"?>
>>>   <openejb-jar
>>>     xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1"
>>>     xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.1"
>>>     xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2">    
>>>    
>>>    <enterprise-beans>
>>>       <session>
>>>         <ejb-name>MySessionBean</ejb-name>
>>>         <jndi-name>MySessionRemoteHome</jndi-name>
>>>       </session>
>>>     </enterprise-beans>
>>>   </openejb-jar>
>>> 
>>> After the ejb is deployed to geronimo, I ran the client and found
>>> below error:
>>> 
>>> ic = javax.naming.InitialContext@1e51060
>>> Exception in thread "main" javax.naming.NameNotFoundException:
>>> /MySessionRemoteHome does not exist in the system.  Check that the app
>>> was successfully deployed.
>>>         at
>>> org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:231)
>>>         at javax.naming.InitialContext.lookup(Unknown Source)
>>>         at apachegclient.TestClient.main(TestClient.java:43)
>>> 
>>> 
>>> Anyone has any idea what's going on?
>>> 
>>> Thanks,
>>> Chris
>>> 
>>>        
>>> ---------------------------------
>>> Ready for the edge of your seat? Check out tonight's top picks on
>>> Yahoo! TV. 
>>>  
>>> ---------------------------------
>>> Now that's room service! Choose from over 150,000 hotels 
>>> in 45,000 destinations on Yahoo! Travel to find your fit.
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/jndi-lookup-in-remote-client-for-geronimo-v2-tf3999496s134.html#a11389626
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Mime
View raw message