Hey

Sebastien Alborini wrote:
> I don't agree with your fix:
> 
> - bind(ctx, ref.getName(), new LinkRef(ref.getLink()));
> + bind(ctx, ref.getName(), new
> 
>LinkRef(getApplication().getContainer(ref.getLink()).getBeanMetaData().getJndiName()));
> 
> For this to work, the referenced bean must already be deployed, or
> getApplication().getContainer(ref.getLink()) will return null.  This is
> not lazy-loading anymore!

Incorrect. The application deployment is in phases (construction,
initialization, starting), and this phase is initialization, and
JNDI-name setting is in construction. So it does indeed work :-)

> I think the problem came from Ingo's xml files, as he found later: the
> <ejb-link> should match the ejb-name / jndi-name of the referenced bean
> (User vs wb/User).  Then bind(ctx, ref.getName(), new
> LinkRef(ref.getLink())) should work (it worked before for testbeans).

Won't work, since new LinkRef(ref.getLink()) will point to the global
namespace, and if EJB-name != JNDI-name it will fail. 

> (btw this is broken anyway for compound names, we should create
> intermediate subcontexts.)

Not with you.. the code *does* create intermediate subcontexts (look at
"bind" method at bottom of Container class). 

> There should be more documentation about declaring internal/external
> ejb-refs, so here is my 1st try, comments appreciated:
> 
> - jndi-name: beans are deployed under a jndi name. This name is the
> jndi-name tag in jboss.xml.  If no jndi-name is provided, then the
> default is jndi-name = ejb-name (from ejb-jar.xml).

Correct. This is the global namespace BTW.

> - ejb references can be internal: a bean A references another bean B in
> the same application unit.  To declare an internal ejb-reference, add an
> ejb-ref tag in bean A's section of your ejb-jar.xml file.  The ejb-link
> tag must be present and must match the jndi-name of the referenced
> bean.  Nothing is needed in jboss.xml

Incorrect. ejb-link must match the ejb-name of the referenced bean, but
we LinkRef to its JNDI-name, since that is the only binding we can
easily access.

> - ejb references can also be external: a bean A references another bean
> C which lives in another application, possibly in another server.  To
> declare an external ejb-reference, add an ejb-ref tag in bean A's
> section of your ejb-jar.xml file.  The ejb-link must not be present.
> Also add an ejb-ref tag in bean A's section of your jboss.xml file.  The
> jndi-name tag must be present and must be the full jndi name of the
> referenced bean.

Correct. A full name is of the form
"protocol://host:1234/name/in/other/server"

/Rickard

-- 
Rickard �berg

Email: [EMAIL PROTECTED]
http://www.telkel.com
http://www.jboss.org
http://www.dreambean.com


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to