[jboss-jira] [JBoss JIRA] (WFLY-12274) EJB Bean with mappedName is not binding

Jaikiran Pai (Jira) issues at jboss.org
Tue Jul 9 03:22:00 EDT 2019


    [ https://issues.jboss.org/browse/WFLY-12274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13757010#comment-13757010 ] 

Jaikiran Pai commented on WFLY-12274:
-------------------------------------

More of a FYI - Back when we started redesiging AS7 and the EJB3.x spec support for it, we had decided to _not_ support "mappedName" on these component declaring annotation (like the @Stateless annotation in this example). The javadoc of this attribute states that this value can be anything and not necessarily a JNDI name and may not be supported by application server vendors[1]. I don't have a reference to the discussion where we had decided this (it mostly was a IRC or such discussion from what I remember).

[1] https://docs.oracle.com/javaee/6/api/javax/ejb/Stateless.html#mappedName()

> EJB Bean with mappedName is not binding
> ---------------------------------------
>
>                 Key: WFLY-12274
>                 URL: https://issues.jboss.org/browse/WFLY-12274
>             Project: WildFly
>          Issue Type: Bug
>          Components: EJB
>    Affects Versions: 16.0.0.Final, 17.0.0.Beta1, 17.0.1.Final
>            Reporter: Cheng Fang
>            Assignee: Cheng Fang
>            Priority: Major
>         Attachments: mapped-name.jar
>
>
> EJB Bean with mappedName is not binding , the mappedName is vendor specific, it is not portable, however @EJB(mappedName=...) is expecting a global JNDI path, but @Stateless(mappedName=...) does not appear to be binding anything.
> {code}
> @Stateless(name="HelloBean", mappedName="MappedHelloBean")
> public class HelloBean implements Hello {
> ...
> {code}
> {code}
> @Startup
> @Singleton
> public class TestSingleton {
>   @EJB(mappedName="MappedHelloBean")
>   private Hello ejb;
> ...
> {code}
> So the @EJB causes the TestSingleton to fail.
> {code}
> 22:12:55,637 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 72) MSC000001: Failed to start service jboss.deployment.unit."mapped-name.jar".component.TestSingleton.START: org.jboss.msc.service.StartException in service jboss.deployment.unit."mapped-name.jar".component.TestSingleton.START: java.lang.IllegalStateException: WFLYEE0042: Failed to construct component instance
> ...
> Caused by: javax.ejb.EJBException: java.lang.RuntimeException: WFLYNAM0059: Resource lookup for injection failed: env/com.jboss.examples.ejb.TestSingleton/ejb
> ...
> Caused by: java.lang.RuntimeException: WFLYNAM0059: Resource lookup for injection failed: env/com.jboss.examples.ejb.TestSingleton/ejb
> ...
> Caused by: javax.naming.NamingException: WFLYNAM0062: Failed to lookup env/com.jboss.examples.ejb.TestSingleton/ejb [Root exception is java.lang.RuntimeException: javax.naming.NameNotFoundException: MappedHelloBean -- service jboss.naming.context.java.MappedHelloBean]
> ...
> Caused by: java.lang.RuntimeException: javax.naming.NameNotFoundException: MappedHelloBean -- service jboss.naming.context.java.MappedHelloBean
> ...
> Caused by: javax.naming.NameNotFoundException: MappedHelloBean -- service jboss.naming.context.java.MappedHelloBean
> ...
> {code}
> [1] https://docs.oracle.com/javaee/6/api/javax/ejb/EJB.html#mappedName()



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the jboss-jira mailing list