users@glassfish.java.net

Re: Help with sun-ejb-jar.xml setup for Remote EJB reference syntax

From: <glassfish_at_javadesktop.org>
Date: Fri, 01 Jun 2007 10:29:50 PDT

> So do we have to create a <ejb-ref> entry inside
> every EJB that wants to do a lookup?

Not always. If you use each @EJB injection corresponds to a <ejb-ref> behind the sense. Even if you don't have <ejb-ref>, or no ejb-jar.xml at all, you can still look up the injected EJB resource. For example,
 
when you have
@EJB(name="fooejbref")
private FooRemote fooRemote;

Without any <ejb-ref> or even ejb-jar.xml, you can look up like this:
InitialContext ic = new InitialContext();
FooRemote foo = (FooRemote) ic.lookup("java:comp/env/fooejbref");


> e did try creating a <ejb-name> using the interface
> class, but it complained that it couldn't find the
> bean. But we don't have a concrete implementation
> for it on this server.
> Do we need to create an fake bean that implements the
> interface?

No.

-cheng

>
> -Mike
[Message sent by forum member 'cf126330' (cf126330)]

http://forums.java.net/jive/thread.jspa?messageID=220051