geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Mulder <ammul...@alumni.princeton.edu>
Subject Re: JNDI Name not found...
Date Thu, 24 Nov 2005 15:49:43 GMT
Hans,

Geronimo doesn't use JNDI names the way you're trying to use them. 
The only thing we use an EJB's JNDI name for is for remote clients to
access.  I'm assuming the lookup code you posted was from a web
component or something else running on the server side.  You should
declare an ejb-ref in your J2EE deployment descriptor, either with an
ejb-link there or with a Geronimo deployment plan that also contains
an ejb-ref and points to a specific ejb.  Then the lookup should use
the java:comp/env namespace.

So, for example:

<web-app
   ...
  <ejb-ref>
    <ejb-ref-name>ejb/BusinessHome</ejb-ref-name>
    ...
    <ejb-link>BusinessBean</ejb-link>
  </ejb-ref>
</web-app>

h = (BusinessHome) PortableRemoteObject.narrow(
    ictx.lookup("java:comp/env/ejb/BusinessHome"),
    BusinessHome.class);

As a side note, this method of using an ejb-ref and java:comp/env/
lookup will be portable across all J2EE servers, whereas as you've
discovered if you try to look up an EJB in the "global" JNDI name
space it will work on some and not work on others.

Thanks,
    Aaron

On 11/24/05, Hans Prueller <hans.prueller@gmx.net> wrote:
>  hi again,
>
>  meanwhile I succeeded in deploying a little test .ear migrated from JOnAS
> to Geronimo. Now
>  I have a problem with the JNDI lookup of the beans on the web tier:
>
>  the JNDI name is defined in the geronimo deployment plan as follows:
>
>   <enterprise-beans>
>                  <session>
>                      <ejb-name>BusinessBean</ejb-name>
>                      <jndi-name>BusinessHome</jndi-name>
>                  </session>
>  [ ... ]
>
>  the lookup is done like that:
>
>  BusinessHome h = null;
>          try
>          {
>              h = (BusinessHome) PortableRemoteObject.narrow(ictx
>                      .lookup("BusinessHome"), BusinessHome.class);
>          }
>          catch (NamingException e)
>          {
>              logger.log(Level.SEVERE, "cannot get bean home '"
>                      + "BusinessHome" + "':" + e);
>              addActionError("cannot_get_home");
>          }
>
>  When I test the app, I get a cannot_get_bean_home error. Is there any
> prefix or something
>  else that I forgot? Or did I configure something wrong?
>
>  Any tips are appreciated!
>
>  regards,
>  Hans
>  --
>
> *****
> virtually hanzz...
> http://hanzz.zapto.org
> *****
>

Mime
View raw message