Post your deployment descriptors.
Have you changed the <jndi-name>s in jboss.xml?
Those must be unique, jboss uses the <ejb-name>
as the <jndi-name> if you don't specify it.
I don't have jboss.xml files, because I don't want the EJBS to have different names. I want a Web app that can test multiple versions of an ejb, and so I want to bundle multiple versions of the EJB, each in its own JAR, in an EAR along with the WAR for my testing Web app. I don't want to have to give each EJB a different name; I want to keep their JARS as they are.
The spec says I can do this, but JBoss is not letting me.
I've included the DDs below.
-- application.xml for EAR --
<?xml version="1.0" encoding="UTF-8"?>
-- ejb-jar.xml for Ejb1 --
<!-- EJB1 -->
-- ejb-jar.xml for Ejb2 --
<!-- EJB2 -->
Re-read my previous post.
The spec does not define the jndi bindings.
-- jboss.xml for Ejb1 --
<!-- EJB1 -->
-- jboss.xml for Ejb2 --
<!-- EJB2 -->
Right, but I'm not trying to give two EJBs different names in my jboss.xml. I'm trying to have two EJBs with the same name, *but in different jar files*, in an EAR together, and to reference them with different names, e.g. in a Web app's DD using <ejb-link>s.
The idea is that I want to be able to bundle multiple versions of an EJB inside an EAR for QA, and all I want to do is edit a Web app DD. I don't want to muck with the EJB DDs.
The EJB spec clearly says this is possible, but JBoss isn't allowing it.
I thank you for pointing out the jboss.xml workaround, but in this case it won't quite do it.
Why is it a workaround?
The "deployer" is responsible for binding to jndi and
Each ejb must have a unique <jndi-name>, it is a
If in app1 in you have
and in app2 you have
they will both get the jndi-name "User".
Instead you should have some strategy that binds the
ejbs to unique names across a server e.g.
You cannot do what you are trying to do anyway.
If you have different versions of the same class
in the same classloader space you are going to
hit a lot of problems.
It's a workaround because the spec defines a method for resolving name problems within an EAR (via <ejb-link>), but JBoss doesn't appear to support that, though you can use jboss.xml to accomplish roughly, but not exactly, the same thing.
If I'm wrong, and JBoss does in fact allow mutiple EJBs with the same name to coexist in an EAR provided the referencing app uses the ejb.jar#ejbname syntax, with no need for jboss.xml or any other vendor-specific file, then I'm wrong. (That was, basically, my initial question.)
However, I take your point that in my case it's a moot issue, because I'm trying to have two versions of a class inside a ClassLoader namespace (=EAR?), and I'm going to have problems with that regardless. I *could* just rename one of the classes, but that's worse than just renaming an EJB.
Thank you Adrian,