| Author |
Weblogic and EJB3 JNDI lookup
|
Ravi Kiran Va
Ranch Hand
Joined: Apr 18, 2009
Posts: 2234
|
|
Hi ,
I got screwed up using JBOSS , (shows error for every thing) decided to use Weblogic 11 from now on for practicing ejbs
Learnt that i need to write Container specific code for lookups
Please tell me what should be the lookup name when used in Weblogic
Inside my servlet i want to call this bean
what should be inside the Lookup please share your ideas
|
Save India From Corruption - Anna Hazare.
|
 |
Deepak Bala
Bartender
Joined: Feb 24, 2006
Posts: 6588
|
|
|
The JNDI name with which the EJB is bound.
|
SCJP 6 articles - SCJP 5/6 mock exams - SCJP Mocks - SCJP 5 Mock exam (Word document ) - SCJP 5 Mock exam in Java.Inquisition format
|
 |
Ravi Kiran Va
Ranch Hand
Joined: Apr 18, 2009
Posts: 2234
|
|
Can you tell me In this case what will be that JNDI Name (As i mentioned the interface and the class name )
Thanks in advance
|
 |
Deepak Bala
Bartender
Joined: Feb 24, 2006
Posts: 6588
|
|
You, as a bean provider will mention the JNDI binding name in a EJB configuration file. In WL the files to lookout for are ejb-jar.xml and weblogic-ejb-jar.xml. These should be configured with a JNDI name.
If you use EJB 3 the process is a little different and uses annotations
|
 |
Ravi Kiran Va
Ranch Hand
Joined: Apr 18, 2009
Posts: 2234
|
|
I am using annotations only so not bothered with the xml files for the time being .
And EJB 3 JNDI lookup is server specific . so what will be the JNDI look up for for weblogic11 if Remote name is SimpleBean and the Bean class implementation name is SimpleBeanImpl
|
 |
Deepak Bala
Bartender
Joined: Feb 24, 2006
Posts: 6588
|
|
And EJB 3 JNDI lookup is server specific
JNDI lookups are not supposed to be server specific. They are not. The bean will be bound to the name that you requested it to be bound to. Did you mention a JNDI name ? What does your JNDI tree look like ?
|
 |
Joe Harry
Ranch Hand
Joined: Sep 26, 2006
Posts: 8795
|
|
Deepak Bala wrote:
JNDI lookups are not supposed to be server specific. They are not. The bean will be bound to the name that you requested it to be bound to. Did you mention a JNDI name ? What does your JNDI tree look like ?
Well, as per the specifications it should be so i.e., they should not be server specific. But based on my experience working with EJB 3 on Weblogic last year, I found out that the same JNDI name that I used for a Stateless Session Bean (that I originally deployed to JBoss) did not work when I deployed that to Weblogic. I had to change the JNDI name to some format Weblogic expects. I have a couple of posts that describes the problems and the exceptions that I faced. A search for these posts in the EJB / SCBCD forum might return you some information.
|
SCJP 1.4, SCWCD 1.4 - Hints for you, SCBCD Hints - Demnachst, SCDJWS - Auch Demnachst
Did a rm -R / to find out that I lost my entire Linux installation!
|
 |
Deepak Bala
Bartender
Joined: Feb 24, 2006
Posts: 6588
|
|
Interesting. Given that I have not used EJB 3 I cannot verify that.
I had to change the JNDI name to some format Weblogic expects
Can you give me the post link. I tried searching the posts that you started but could not find the one you are talking about
|
 |
Joe Harry
Ranch Hand
Joined: Sep 26, 2006
Posts: 8795
|
|
|
I was able to find this one...http://www.coderanch.com/t/429377/EJB-Certification-SCBCD/certification/NamingException-during-lookup
|
 |
Joe Harry
Ranch Hand
Joined: Sep 26, 2006
Posts: 8795
|
|
|
I remember playing with the mappedName attribute of the @EJB annotation to fix some NamingException problems, but I do not remember them now. Almost a year since I worked on EJB 3.
|
 |
Ravi Kiran Va
Ranch Hand
Joined: Apr 18, 2009
Posts: 2234
|
|
Found out the answer , might be useful for someone .
This should be MapedName#package.RemoteBeanName
|
 |
Deepak Bala
Bartender
Joined: Feb 24, 2006
Posts: 6588
|
|
Ravi Kiran Varre wrote:
Found out the answer , might be useful for someone .
This should be MapedName#package.RemoteBeanName
Weird ! Thanks for sharing that. I ll go through EJB3 to try and understand why the JNDI name is what it is
|
 |
 |
|
|
subject: Weblogic and EJB3 JNDI lookup
|
|
|