I have just recently started using EJBs and have run into a bit of a problem with regard to resolving ambiguous dependencies (for injection). I've attached a test application (containing source files [in WEB-INF/classes] as well as compiled class files and relevant deployment descriptors) that exhibits the problem I'm encountering.
To summarize, I have a local business interface named Greeter and two stateless session beans that implement that interface; the beans are named GreeterBeanA and GreeterBeanB. There is a third stateless session bean named HelperBean that contains an injection point for Greeter. I'm trying to use the ejb-jar.xml deployment descriptor to manually resolve the dependency (i.e. specify that one of GreeterBeanA and GreeterBeanB should be used to satisfy the Greeter dependency in HelperBean); however, Glassfish always gives me this error:
Exception while deploying the app : java.lang.RuntimeException: Cannot resolve reference Local ejb-ref name=com.example.HelperBean/greeter,Local 3.x interface =com.example.Greeter,ejb-link=null,lookup=null,mappedName=,jndi-name=,refType=Session because there are 2 ejbs in the application with interface com.example.Greeter
The same application works just fine on the latest JBoss release (6.0.0.M2). This seems to suggest that Glassfish ignores the deployment descriptor prior to scanning for annotations and effectively "short-circuits" the validation process by immediately exiting if there's an ambiguous dependency.
Is this intended behavior? In other words, is JBoss doing something non-standard to allow the application to deploy properly? Or am I just doing something totally wrong?
I'm using the latest release of Glassfish 3.0 with all available updates installed. The ejb-jar.xml deployment descriptor is configured for EJB 3.1.
Thanks in advance for your help!
[Message sent by forum member 'atomicknight' (atomknight033197_at_gmail.com)]
http://forums.java.net/jive/thread.jspa?messageID=391857