You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Mark Taylor <mt...@gmail.com> on 2009/08/07 21:32:14 UTC

@EJB mappedName property support

Hi,

Thanks for the jndi name formatting lower case support.  Now I have
another problem:

When running JUnit tests with OpenEJB in embedded mode, I have many
beans that reference other beans via the @EJB mappedName property.  It
does not appear that OpenEJB 3.1.1 supports this, ie I get the
following error:

WARN  [OpenEJB] Injection data not found in enc:
jndiName='net.mycompany.bean.ComplexBean/myBean', target=class
net.mycompany.bean.ComplexBean/myBean


Is there an option that controls this?  If not, is it be possible to
support the @EJB mappedName property for an injected bean such as:

@Stateless
public class ComplexBean implements ComplexBeanLocal {
  @EJB(mappedName="MyStatelessBean/local")
   MyStatelessBeanLocal mybean;
  ...
}

Where:

@Stateless
public class MyStatelessBean implements MyStatelessBeanLocal {
  ...
}

Thanks,

Mark

Re: @EJB mappedName property support

Posted by David Blevins <da...@visi.com>.
Currently our @EJB.mappedName support allows you to map the reference  
using the OpenEJB deployment id of the bean (which by default will be  
the ejb-name, which is itself default of the simple name of the bean  
class).

We could probably add support so that it could reference a JNDI name  
as an alternative.  Some flag you turn on perhaps.

Just a note that using @EJB.mappedName is not portable and there are  
other ways to narrow down reference when there is more than one bean  
that implements a particular business interface.  Have you tried using  
the @EJB.beanName attribute?

-David

On Aug 7, 2009, at 12:32 PM, Mark Taylor wrote:

> Hi,
>
> Thanks for the jndi name formatting lower case support.  Now I have
> another problem:
>
> When running JUnit tests with OpenEJB in embedded mode, I have many
> beans that reference other beans via the @EJB mappedName property.  It
> does not appear that OpenEJB 3.1.1 supports this, ie I get the
> following error:
>
> WARN  [OpenEJB] Injection data not found in enc:
> jndiName='net.mycompany.bean.ComplexBean/myBean', target=class
> net.mycompany.bean.ComplexBean/myBean
>
>
> Is there an option that controls this?  If not, is it be possible to
> support the @EJB mappedName property for an injected bean such as:
>
> @Stateless
> public class ComplexBean implements ComplexBeanLocal {
>   @EJB(mappedName="MyStatelessBean/local")
>    MyStatelessBeanLocal mybean;
>   ...
> }
>
> Where:
>
> @Stateless
> public class MyStatelessBean implements MyStatelessBeanLocal {
>  ...
> }
>
> Thanks,
>
> Mark
>