dev@glassfish.java.net

Re: What is the default mapped-name, if any, for an MDB in EJB3?

From: Peter Williams <Pete.Williams_at_Sun.COM>
Date: Thu, 18 May 2006 18:36:28 -0700

Comments inline...

Hong Zhang wrote:

> Hi, Peter
>
>> What is the default mapped-name, if any, for an MDB in EJB3?
>
>
> I don't think the current appserver implementation provides any
> default mapped-name (or global jndi-name) for MDB in EJB3. It does
> provide some defaults for ejb2.x/ejb3.0 session bean and ejb2.0 entity
> bean.
>
>> I have an EJB Module (JavaEE5) with a single message driven bean,
>> annotated via just "@MessageDriven".
>>
>> No mapped name, no ejb-jar.xml, and trivial sun-ejb-jar.xml (e.g no
>> jndi name for this bean is specified there).
>>
>> When this module is deployed, what is the jndi-name of the JMS
>> Resource it is looking for? The bean is named "NewMessage", in
>> package "test". I've tried several permutations of
>> [ejb/][test.][NewMessage] for naming the JMSResource and all
>> deployments result in the same error (that there is no JMS Resource
>> -- but the error does not indicate the name it is looking for).
>>
>> Verifier, by the way, says the EJB Module is fine, no errors or
>> warnings.
>>
>> So, if mapped-name is not specified, what does the server use for a
>> default? Anything? Does this scenario require that the jndi-name be
>> specified in sun-ejb-jar.xml or can I make this work without doing
>> that (or using mapped-name either).
>
>
>
> So in your case, you would need to
>
> 1. provide mapped-name through deployment descriptor (or mappedName
> attribute within the @javax.ejb.MessageDriven annotation).
> OR
> 2. specify the global jndi-name in sun-ejb-jar.xml
>
> Note: when both are present, the jndi-name in sun-ejb-jar.xml
> overrides the value specified through mapped-name element (or the
> mappedName attribute).

Thanks for this information.

I can work with this. I was hoping for a default name though :(

I will have to generate a jndi-name for the NetBeans user in cases where
they do not specify a mapped name in the MDB wizard. This is trivial,
but if they later add a mapped name to the bean, it may cause a bit of
runtime confusion since they will also have to manually delete the
jndi-name we created for them. There is no easy way to inform them
about this.

I will file a bug against the verifier then since it should have flagged
my lack of both mapped-name and jndi-name as an error.

-Peter

>
> You could look at this mdb dev test as an example:
> http://fisheye5.cenqua.com/viewrep/glassfish/appserv-tests/devtests/ejb/ejb30/hello/mdb
>
>
> Thanks,
>
> - Hong
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>