How can I access EJB 2.1 session from EJB 3 session in JBoss 4.2.1.GA? The EJB 3 sessions and EJB 2.1 session are deployed in separate EJB jar files, but they are in the same EAR file, so they are part of the same J2EE application.
I have tried the following methods: Injecting EJB 2.1 home using EJB annotation, simply like this: @EJB private foo.bar.SomeLocalHome someHome; results in the error: java.lang.RuntimeException: could not resolve global JNDI name for @EJB for container WhatEver: reference class: foo.bar.SomeLocalHome ejbLink: not used by any EJBs Which is not true, because that LocalHome class is used by a EJB 2.1 session bean. Injecting local interface using EJB annotation: @EJB private foo.bar.SomeLocal some; results in the same error. Injections with beanName set: @EJB(beanName = "Some") private foo.bar.SomeLocalHome someHome; result in error java.lang.RuntimeException: Failed to populate ENC: env/foo.bar.WhatEver/someHome global jndi name was null Adding local reference to ejb-jar.xml, like so: <ejb-name>WhatEver</ejb-name> <ejb-local-ref> <ejb-ref-name>Some</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <local-home>foo.bar.SomeLocalHome</local-home> <ejb-link>Some</ejb-link> </ejb-local-ref> and injecting like so: @EJB(name = "Some") private SomeLocalHome someHome; fails because JBoss complains that "IGNORING DEPENDENCY ... too little information". Creating the local ref like so <ejb-name>WhatEver</ejb-name> <ejb-local-ref> <ejb-ref-name>Some</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <local-home>foo.bar.SomeLocalHome</local-home> foo.bar.SomeLocalHome <ejb-link>Some</ejb-link> </ejb-local-ref> fails because 15:25:51,749 WARN [EJBHandler] IGNORING DEPENDENCY: unable to find <ejb-local-ref> of interface foo.bar.SomeLocal and ejbLink of Some in ejb-jar.xml of WhatEver it might not be deployed yet Looking at the code (I think I found the correct place), the local-ref handling code simply ignores local-home, and seems to search for EJB that implements the local interface, which is daft when I want to link to EJB 2.1. Maybe injection without JNDI name (the first attempt above) fails for a similar reason? I'm currently looking up the local home interface manually (new InitialContext().lookup("Some")), and it works, but this is not very nice. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4106373#4106373 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4106373 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user