I have two different J2EE projects deployed in JBoss and I have an two EJBs with the same name (one in each project) but pointing to different tables in different databases.
I tried differing their jndi-names by setting one of them to ejb/User and the other to ejb/project2/User and then referencing them in the session beans with ejb-ref set to User and ref-name to ejb/User and ejb/project2/User respectively.
My compile is successful with my code for project2 like this but when I run it I get a run-time error indicating that the session bean is not bound.
I have checked the log to make sure the ejb was deployed successfully and there are no errors there. I have also checked the console and the session bean is there.
Can this not be done or am I doing this incorrectly?
when you say "two EJBs with the same name" what do you mean? Do you mean <ejb-name> element?
This is something I got from the web ------------------------------------------------------
<ejb-name>EmployeeService</ejb-name> The ejb-name element specifies an enterprise bean's name. This name is assigned by the ejb-jar file producer to name the enterprise bean in the ejb-jar file's deployment descriptor. The name must be unique among the names of the enterprise beans in the same ejb-jar file. The enterprise bean code does not depend on the name; therefore the name can be changed during the application-assembly process without breaking the enterprise bean's function. There is no architected relationship between the ejb-name in the deployment descriptor and the JNDI name that the Deployer will assign to the enterprise bean's home. The name must conform to the lexical rules for an NMTOKEN.
You guessed right. It is that the two ejbs have the same ejb-name. Thanks for the assistance.
I have got it working now. I changed it so that I don't set the ref-name for the ejb-ref in the session bean that references the entity bean and it worked.