geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Aufdencamp <m...@aufdencamp.com>
Subject RE: jndi lookup in remote client for geronimo v2
Date Fri, 29 Jun 2007 17:03:52 GMT
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.


Mime
View raw message