geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aaron Mulder" <ammul...@alumni.princeton.edu>
Subject Re: Unable to make a simple SessionBean lookup
Date Wed, 12 Jul 2006 20:07:33 GMT
I'm not sure your INITIAL_CONTEXT_FACTORY is correct -- org.jnp
doesn't look right to me.

Thanks,
    Aaron

On 7/12/06, Rafael Barrera Oro <rafael@akyasociados.com.ar> wrote:
> I am trying to make a simple lookup for a simple SessionBean and,
> altough it throws no exception, nothing happens as i can wait forever if
> i want before the lookup is completed, maybe it has something to with
> the incomplete openejb-jar.xml or incosistent properties passed to the
> InitialContext, i really have no clue whatsoever.
>
> this is the code of the client class:
>
> import java.rmi.RemoteException;
> import java.util.Properties;
>
> import javax.naming.Context;
> import javax.naming.InitialContext;
> import javax.naming.NamingException;
> import javax.rmi.PortableRemoteObject;
>
> import beans.Rafa;
> import beans.RafaHome;
>
> public class Client {
>
>     /**
>      * @param args
>      */
>     public static void main(String[] args) {
>         Context ctx;
>         Rafa rafa;
>         RafaHome home;
>         Object obj;
>
>         Properties props;props = new Properties();
>
>         props.put(Context.INITIAL_CONTEXT_FACTORY,
> "org.jnp.interfaces.NamingContextFactory");
>         props.put("java.naming.provider.url", "127.0.0.1");
>
>
>
>         try{
>             ctx = new InitialContext(props);
>             obj = ctx.lookup("YATest/YATest");
>             home = (RafaHome)PortableRemoteObject.narrow(obj,
> RafaHome.class);
>             rafa = home.create();
>             rafa.test();
>
>         }
>         catch(Exception e){
>             System.out.println("ERROR: " + e.getMessage());
>         }
>     }
>
> }
>
> openejb.jar.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.0"
> xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.0"
> xmlns:pkgen="http://www.openejb.org/xml/ns/pkgen-2.0"
> xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"
> xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.0"
> configId="YATest/YATest" parentId="MyWebProject/MyWebProject">
>   <enterprise-beans/>
> </openejb-jar>
>
> ejb-jar.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ejb-jar id="ejb-jar_ID" version="2.1"
> xmlns="http://java.sun.com/xml/ns/j2ee"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
>     <display-name>
>     YATest</display-name>
>     <enterprise-beans>
>         <session>
>             <ejb-name>Rafa</ejb-name>
>             <home>beans.RafaHome</home>
>             <remote>beans.Rafa</remote>
>             <ejb-class>beans.RafaEJB</ejb-class>
>             <session-type>Stateless</session-type>
>             <transaction-type>Container</transaction-type>
>         </session>
>     </enterprise-beans>
> </ejb-jar>
>
> If i look in the Geronimo console i see there is an EJB Jar deployed
> under the component name: YATest/YATest, so i am sure the bean is being
> deployed.
>
> Any help will be greatly appreciated, thanks in advance
>
> Rafael
>

Mime
View raw message