-
1. Re: jboss3 ejb-local-ref from servlet
wklauser Feb 8, 2002 3:45 PM (in response to miguel2)As far as my testing goes, this has always been possible with JBoss 3.0. The binding is a bit unexpected though, which might have stopped a few people from getting it working (including myself till 10 min. ago ;-)
All local homes seem to be bound as "local/<ejb-name>". So, if you have got a bean named CurrencyBean with a local home CurrencyHome, you would look it up like this:
InitialContext ic = new InitialContext();
CurrencyHome c = (CurrencyHome) ic.lookup("local/CurrencyBean");
Please note that there is no "java:" or "java:comp/env" or so involved here.
Kind regards, Wilfried -
2. Re: jboss3 ejb-local-ref from servlet
saylor09 Feb 8, 2002 6:49 PM (in response to miguel2)You may also want to note that you can redefine the local interface JNDI name in jboss.xml with <local-jndi-name>. For example:
<enterprise-beans>
<ejb-name>Product</ejb-name>
<local-jndi-name>product/ejb/local/Product</local-jndi-name>
</enterprise-beans>
so instead of....
(ProductLocalHome)context.lookup("local/Product");
you can do....
(ProductLocalHome)context.lookup("product/ejb/local/Product");
This was not in the dtd. I'm not sure if it' still not there, but you should be able to use it. -
3. Re: jboss3 ejb-local-ref from servlet
miguel2 Feb 8, 2002 7:44 PM (in response to miguel2)Two great answers !!
However, the following questions seem to be left open:
Using local-jndi-name do I need ejb-local-ref in my servlet ?
Should lookup via "local/Beanname" work without any reference in my servlet ?
(using jboss3/jetty from cvs)
Mige -
4. Re: jboss3 ejb-local-ref from servlet
saylor09 Feb 9, 2002 5:59 PM (in response to miguel2)local-jndi-name will redefine the global jndi name. You can either use the global name or use a reference defined with ejb-local-ref. However, the last I know of, Jetty does not support <ejb-local-ref>. But this may have changed recently.