You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Filippo Diotalevi <fi...@gmail.com> on 2006/12/04 16:25:34 UTC

EJB3 lookup and JndiNameStrategy

Hi,
  I finally managed to fix the trunk of openejb to be able to do the
lookup of a trivial EJB3 stateless bean (I can't invoke methods
though... I receive the exception attached at the end of this email...
still investigating on it)
Now I notice that openejb uses different types of JndiNameStrategy to
assign names to deployed ejbs, so that my ejb, whose remote interface
is org.acme.Calculator, becomes CalculatorBusinessRemote bean on JNDI.
Is this behaviour correct?

With Glassfish, the ejb takes the simple name of its business
interface, but I didn't find a clear statement in the specification
about the correct naming of ejb...

--
  Filippo  (ejb3 invokation exception follows)

 The bean instance null threw a system
exception:org.apache.xbean.recipe.MissingAccessorException: Unable to
create bean null attribute null: Unable to find a valid setter method:
public void org.acme.CalculatorImpl.setSessionContext(org.apache.openejb.core.stateless.StatelessContext)
org.apache.xbean.recipe.MissingAccessorException: Unable to create
bean null attribute null: Unable to find a valid setter method: public
void org.acme.CalculatorImpl.setSessionContext(org.apache.openejb.core.stateless.StatelessContext)
        at org.apache.xbean.recipe.ObjectRecipe.findSetter(ObjectRecipe.java:599)
        at org.apache.xbean.recipe.ObjectRecipe.create(ObjectRecipe.java:210)
        at org.apache.xbean.recipe.ObjectRecipe.create(ObjectRecipe.java:154)
        at org.apache.openejb.core.stateless.StatelessInstanceManager.getInstance(StatelessInstanceManager.java:94)
        at org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:113)

Re: EJB3 lookup and JndiNameStrategy

Posted by Mohammad Nour El-Din <no...@gmail.com>.
Hi Feilippo...

Well it is spread all over chapter#16, this was not specified for the task I
mentioned in my last reply, it is used in the specs as the default JNDI
reference name constructed for the referenced resources by an EJB, so I
suggested to use the same approach.


On 12/7/06, Filippo Diotalevi <fi...@gmail.com> wrote:

> > I think we can use the approach specified in the specs of EJB3.0 "Core
> > Contracts and Requirements", that we use the fully qualified name of the
> EJB
> > followed by the name of the interface(s) it supports. For example if we
> have
> > an EJB com.oejb3.examples.ExampleBean, and this EJB supports two biz
> > interfaces, so we can have two JNDI names as follows for each biz
> interface,
> > *java:comp/env/com.oejb3.examples.ExampleBean/BizIntfcOne*
> > and *java:comp/env/com.oejb3.examples.ExampleBean/BizIntfcTwo*. Thoughts
> ???
>
> Hi Mohammad, where did you find this fact mentioned in the specification?
>
> --
> Filippo
>



-- 
Thanks
- Mohammad Nour

Re: EJB3 lookup and JndiNameStrategy

Posted by Filippo Diotalevi <fi...@gmail.com>.
> I think we can use the approach specified in the specs of EJB3.0 "Core
> Contracts and Requirements", that we use the fully qualified name of the EJB
> followed by the name of the interface(s) it supports. For example if we have
> an EJB com.oejb3.examples.ExampleBean, and this EJB supports two biz
> interfaces, so we can have two JNDI names as follows for each biz interface,
> *java:comp/env/com.oejb3.examples.ExampleBean/BizIntfcOne*
> and *java:comp/env/com.oejb3.examples.ExampleBean/BizIntfcTwo*. Thoughts ???

Hi Mohammad, where did you find this fact mentioned in the specification?

--
  Filippo

Re: EJB3 lookup and JndiNameStrategy

Posted by David Blevins <da...@visi.com>.
On Dec 7, 2006, at 3:14 AM, Mohammad Nour El-Din wrote:

> Hi David and Filippo
>
> On 12/7/06, David Blevins <da...@visi.com> wrote:
>>
>>
>> On Dec 4, 2006, at 7:25 AM, Filippo Diotalevi wrote:
>>
>> > Now I notice that openejb uses different types of  
>> JndiNameStrategy to
>> > assign names to deployed ejbs, so that my ejb, whose remote  
>> interface
>> > is org.acme.Calculator, becomes CalculatorBusinessRemote bean on  
>> JNDI.
>> > Is this behaviour correct?
>> >
>> > With Glassfish, the ejb takes the simple name of its business
>> > interface, but I didn't find a clear statement in the specification
>> > about the correct naming of ejb...
>>
>> On this note, we can do whatever users think is most intuitive as
>> global JNDI isn't a spec defined thing -- per spec even client apps
>> are supposed to have a deployment descriptor and use ejb-ref and ejb-
>> local-ref tags (ick).
>>
>> The strategy concept was plumbed in so we could support just about
>> anything, we just don't yet have a mechanism for the user to say
>> which strategy they want.
>>
>> I like the interface simple name approach.  The only downside is that
>> more than one bean can easily implement the interface.
>>
>> What kind of thoughts do you have?  Any preferences?
>
>
> I think we can use the approach specified in the specs of EJB3.0 "Core
> Contracts and Requirements", that we use the fully qualified name  
> of the EJB
> followed by the name of the interface(s) it supports. For example  
> if we have
> an EJB com.oejb3.examples.ExampleBean, and this EJB supports two biz
> interfaces, so we can have two JNDI names as follows for each biz  
> interface,
> *java:comp/env/com.oejb3.examples.ExampleBean/BizIntfcOne*
> and *java:comp/env/com.oejb3.examples.ExampleBean/BizIntfcTwo*.  
> Thoughts ???

That's not a bad strategy.  I like it.  So that'd be:

java:comp/env/<ejbClass>/<interfaceSimpleName>

We could also do:

java:comp/env/<ejbName>/<interfaceSimpleName>

-David


Re: EJB3 lookup and JndiNameStrategy

Posted by Mohammad Nour El-Din <no...@gmail.com>.
Hi David and Filippo

On 12/7/06, David Blevins <da...@visi.com> wrote:
>
>
> On Dec 4, 2006, at 7:25 AM, Filippo Diotalevi wrote:
>
> > Now I notice that openejb uses different types of JndiNameStrategy to
> > assign names to deployed ejbs, so that my ejb, whose remote interface
> > is org.acme.Calculator, becomes CalculatorBusinessRemote bean on JNDI.
> > Is this behaviour correct?
> >
> > With Glassfish, the ejb takes the simple name of its business
> > interface, but I didn't find a clear statement in the specification
> > about the correct naming of ejb...
>
> On this note, we can do whatever users think is most intuitive as
> global JNDI isn't a spec defined thing -- per spec even client apps
> are supposed to have a deployment descriptor and use ejb-ref and ejb-
> local-ref tags (ick).
>
> The strategy concept was plumbed in so we could support just about
> anything, we just don't yet have a mechanism for the user to say
> which strategy they want.
>
> I like the interface simple name approach.  The only downside is that
> more than one bean can easily implement the interface.
>
> What kind of thoughts do you have?  Any preferences?


I think we can use the approach specified in the specs of EJB3.0 "Core
Contracts and Requirements", that we use the fully qualified name of the EJB
followed by the name of the interface(s) it supports. For example if we have
an EJB com.oejb3.examples.ExampleBean, and this EJB supports two biz
interfaces, so we can have two JNDI names as follows for each biz interface,
*java:comp/env/com.oejb3.examples.ExampleBean/BizIntfcOne*
and *java:comp/env/com.oejb3.examples.ExampleBean/BizIntfcTwo*. Thoughts ???

-David
>
>
>


-- 
Thanks
- Mohammad Nour

Re: EJB3 lookup and JndiNameStrategy

Posted by David Blevins <da...@visi.com>.
On Dec 4, 2006, at 7:25 AM, Filippo Diotalevi wrote:

> Now I notice that openejb uses different types of JndiNameStrategy to
> assign names to deployed ejbs, so that my ejb, whose remote interface
> is org.acme.Calculator, becomes CalculatorBusinessRemote bean on JNDI.
> Is this behaviour correct?
>
> With Glassfish, the ejb takes the simple name of its business
> interface, but I didn't find a clear statement in the specification
> about the correct naming of ejb...

On this note, we can do whatever users think is most intuitive as  
global JNDI isn't a spec defined thing -- per spec even client apps  
are supposed to have a deployment descriptor and use ejb-ref and ejb- 
local-ref tags (ick).

The strategy concept was plumbed in so we could support just about  
anything, we just don't yet have a mechanism for the user to say  
which strategy they want.

I like the interface simple name approach.  The only downside is that  
more than one bean can easily implement the interface.

What kind of thoughts do you have?  Any preferences?

-David



Re: EJB3 lookup and JndiNameStrategy

Posted by Filippo Diotalevi <fi...@gmail.com>.
On 12/4/06, Filippo Diotalevi <fi...@gmail.com> wrote:
> (I can't invoke methods
> though... I receive the exception attached at the end of this email...
> still investigating on it)
>
>  The bean instance null threw a system
> exception:org.apache.xbean.recipe.MissingAccessorException: Unable to
> create bean null attribute null: Unable to find a valid setter method:
> public void

Ok, this is also known as OPENEJB-259 ... it shouldn't be too
difficult to make a quick and dirty patch around it...

--
  Filippo