geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aaron Mulder" <>
Subject Re: NameNotFoundException with EJB created with Eclipse Geronimo plugin
Date Mon, 07 Aug 2006 18:03:54 GMT
On 8/7/06, Four Sticks <> wrote:
> Hi Aaron,
> Thank you!  I was able to get it working with your help.  In looking
> at the code generated for the EJB, I noticed three things were wrong:
> 1) The TigerUtil class generated by WebTools was not looking the EJB
> up correctly.

There may be a way to influence this.  If the JNDI name is wrong, you
can try changing the ejb-ref-name in web.xml so that the resulting
JNDI name will match what's used by TigerUtil.  Or if TigerUtil lacks
the java:comp/env/ prefix, there may be an XDoclet element to make it
use that prefix.

Also, make sure you're looking at the right method in TigerUtil --
sometimes it has one for local EJBs and one for remote EJBs, and you
need to make sure you're looking at the one for local EJBs.  Actually
I have a vague memory of XDoclet generating a Util class with 3
methods but I don't remember under what circumstances.  Just check it
and see if there's a closer match in there.  :)

Also, it's OK for a lookup to use PortableRemoteObject.narrow, though
it's not necessary unless you use CORBA in your application (and,
actually, never necessary for local EJBs AFAICT).  If the TigerUtil
class uses that it's OK, it should just waste some CPU cycles not
cause actual problems.

> 2) The TigerLocal interface generated by the WebTools did not have the
> method declared in it that I added to the TigerBean during the
> tutorial.

That's unfortunate -- there may be a special way to add a method to
the implementation class that causes it to be added to the interfaces
automatically.  I don't know that much about Eclipse, though.  You
might also try just cancelling the home/remote interfaces if you don't
plan on accessing this EJB from callers outside the same JVM.
Finally, if you edit the EJB implementation class, you can probably
manually add an XDoclet tag to the implementation method that
indicates that it should be exposed in the local interface -- I have a
vague memory of setting some XDoclet parameter on the method to
"local", "remote", or "both", so if you see one there listed as
"remote", try changing it to "both".  Or something like that.  :)

> 3) Web.xml did not have the EJB reference that you mentioned.

Yeah, that's something you probably need to add by hand -- or using a
wizard somewhere on the web app side.  EJB references are generally
not added automatically when you create an EJB.  Normally, for
example, if you have loads of entity EJBs and a few session EJBs, the
web app would only have references to some or all of the session EJBs.


> Number 3 may be due to the fact that I'm unfamiliar with the Eclipse
> WebTools for EJB's and the Geronimo plugin. Things have changed a lot
> since the tutorial was published, and my guess is there may be a step
> in creating an EJB that I missed.
> Numbers 2 and 1 are just plain wrong.  Both of the generated files
> have a comment stating that they are XDoclet generated code and should
> be not be editted.  But if I edit these files to fix the EJB look-up
> in TigerUtil to match what you posted, and to add the missing method
> definition to the TigerLocal interface, I can get the tutorial example
> to work.  I have to be careful to only re-compile the fixed code. (If
> I re-build everything, unfortunately, then the files get regenerated
> and and the fixes over-written the incorrect code and wiped out.)
> I'm not sure if I bumped my head into a bug in Eclipse WebTools 1.5 or
> the Geronimo plugin.  My guess is that it's a problem in WebTools.  I
> spent a Sunday trying to figure this out, so your response was a great
> help in understanding what WebTools and the Geronimo plugin were
> doing.
> Thanks again for your help,
> Gaston
> On 8/6/06, Aaron Mulder <> wrote:
> > All right, this is just scratching the surface, but...
> >

View raw message