Hi!
Rickard �berg wrote:
> Ok, "fixed". I actually did what I told Sebastien not to do: use
> LinkRefs to the global JNDI namespace. Works, but not perfect since it
> assumes globally bound JNDI beans (ok, a pedantic thing, but still).
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!
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).
(btw this is broken anyway for compound names, we should create
intermediate subcontexts.)
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).
- 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
- 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.
regards,
Sebastien
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]