I would be careful with the "required" java:comp/env/ portion, depending on
how it is declared orion doesnt necessarily bind the home to the right
context. We found this out when we were looking at the orion primer
tutorial. the home object there was actually bound to the root context (i.e.
no java:comp/env/) a good tool to look at these things is Forte For Java. It
has a JNDI browser built into it.
Al
----- Original Message -----
> From: Nick Newman [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 14, 2000 1:45 PM
> To: Orion-Interest
> Subject: Re: EJB question
>
>
> Hi Kit,
>
> I'm not sure that I tell you for SURE why it failed, but here are a few
> thoughts.
>
> Firstly, I think that some of the code you write is unnecessary. What I
> would have written is:
>
> Context context = new InitialContext(); // No properties required
>
> Object homeObject = context.lookup("java:comp/env/MyCart"); // Note the
> required "java:comp/env/" prefix
>
> CartHome home =
> (CartHome)PortableRemoteObject.narrow(homeObject,CartHome.class);
>
> Cart cart = home.create(); // No cast required - home.create() returns a
Cart
>
> But that probably didn't cause your problem. I would guess that it was
> caused by a discrepancy between the class types specified in the XML and
in
> the code.
>
> Firstly note that in the WEB-INF/web.xml you should have a section looking
> something like the following:
>
> <ejb-ref>
> <ejb-ref-name>MyCart</ejb-ref-name>
> <ejb-ref-type>Session</ejb-ref-type>
> <home>com.acme.MyCartHome</home>
> <remote>com.acme.MyCart</remote>
> </ejb-ref>
>
> (If you don't, the "lookup" will fail, even though it may have worked
> without the "java:comp/env/" prefix.)
>
> Then the error you have seems to be saying that what is in the <home> part
> of the xml doesn't match the CartHome class that is being used in your
Java
> code.
>
> Hope this helps!
>
> Nick
>
>