It's hard to understand how the resulting home object could be null.
You should get a NamingException if the object is not present in JNDI.
However, people have reported problems with PortableRemoteObject when
running on JDK's other than Sun 1.4.2, so perhaps you should just try:
ChiselGatewayHome home = (ChiselGatewayHome)new
InitialContext().lookup("java:comp/env/ChiselGateway");
System.out.println("Home is "+home);
That should work from a web component such as a servlet or JSP, with
the web.xml settings you showed above.
If it still doesn't work, try undeploying or redeploying the
application and make sure you don't get a bunch of errors saying
something like "object should be stopped before die is called" (which
indicates that parts of the application never started, possibly due to
a bad reference or missing import or something like that).
Thanks,
Aaron
P.S. Note that the jndi-name specified in openejb-jar.xml is *only*
used for application clients. You might as well leave it out if
you're only going to be accessing the EJB from the web application --
it won't hurt and it might be less confusing.
On 2/6/06, Oscar Oreja <[EMAIL PROTECTED]> wrote:
>
>
> On 1/31/06, Oscar Oreja <[EMAIL PROTECTED]> wrote:
> > Hello David,
> >
> > Thanks for your interest and help.
> >
> > All the modules are packed on the ear. There are an app.war and
> appEJB.jar files within appEAR.ear. There are web.xml and geronimo-web.xml
> in app.war WEB-INF folder. On appEJB.jar META-INF are ejb-jar.xml and
> openejb-jar.xml. I have added 2 files more: db-plan.xml and jms-plan.xml
> within appEAR.ear and, on folder META-INF, the application.xml file.
> >
> > When I deploy the ear file I'm using a app-plan.xml.
> >
> > This is an example of the web.xml ejb-ref and the ejb-jar.xml related
> definition.
> >
> > web.xml
> > -------------------------------------------------------
> > ....
> > <ejb-ref>
> > <ejb-ref-name>ChiselGateway</ejb-ref-name>
> > <ejb-ref-type>Session</ejb-ref-type>
> >
> <home>com.whitestone.chisel.framework.ejb.chiselgateway.ChiselGatewayHome</home>
> >
> <remote>com.whitestone.chisel.framework.ejb.chiselgateway.ChiselGateway
> </remote>
> > <ejb-link>ChiselGateway</ejb-link>
> > </ejb-ref>
> >
> > ....
> >
> > ejb-jar.xml
> > ---------------------------------------------------------
> > <session>
> > <ejb-name>ChiselGateway</ejb-name>
> >
> <home>com.whitestone.chisel.framework.ejb.chiselgateway.ChiselGatewayHome</home>
> >
> <remote>com.whitestone.chisel.framework.ejb.chiselgateway.ChiselGateway</remote>
> > <ejb-class>
> com.whitestone.chisel.framework.ejb.chiselgateway.ChiselGatewayEJB</ejb-class>
> > <session-type>Stateless</session-type>
> > <transaction-type>Container</transaction-type>
> > </session>
> > ...
> >
> > openejb-jar.xml
> > --------------------------------------------------------
> > <session>
> > <ejb-name>ChiselGateway</ejb-name>
> > <jndi-name>ChiselGateway</jndi-name>
> > </session>
> >
> >
> > On the code, we use this to try to load the class from JNDI:
> >
> > Object objref = ic.lookup(jndiHomeName);
> > Object obj = PortableRemoteObject.narrow (objref, className);
> > home = (EJBHome)obj;
> >
> > The jndiHomeName is "ChiselGateway" on our application when we want to
> load the class above. We have tried to use too "java:comp/env/ChiselGateway"
> but it doesn't work.
> > The home object is null allways. We added some code to show bindings but
> all it show is from the namespace "". There is nothing more.
> >
> > Any idea why is it failing?
> >
> > Thank you for your help.
> >
> > Regards,
> >
> > Oscar
> >
>
>