The Artima Developer Community
Sponsored Link

Java Answers Forum
JNDI-NAME and EJB-REF

2 replies on 1 page. Most recent reply: Sep 3, 2003 4:59 AM by Rebecca Scully

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Rebecca Scully

Posts: 2
Nickname: rs
Registered: Sep, 2003

JNDI-NAME and EJB-REF Posted: Sep 2, 2003 9:55 PM
Reply to this message Reply
Advertisement
Hi,

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?


Senthoorkumaran Punniamoorthy

Posts: 335
Nickname: senthoor
Registered: Mar, 2002

Re: JNDI-NAME and EJB-REF Posted: Sep 3, 2003 1:08 AM
Reply to this message Reply
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.

-----------------------------------------------------------

http://kb.atlassian.com/content/orion/docs/deployment/ejb-jar.xml.html

Rebecca Scully

Posts: 2
Nickname: rs
Registered: Sep, 2003

Re: JNDI-NAME and EJB-REF Posted: Sep 3, 2003 4:59 AM
Reply to this message Reply
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.

Flat View: This topic has 2 replies on 1 page
Topic: why java swing components are not working with Microsoft VM? Previous Topic   Next Topic Topic: multiple .jar files in CLASSPATH ?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use