Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Weblogic and EJB3 JNDI lookup

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JNDI name with which the EJB is bound.
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10123
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10123
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was able to find this one...http://www.coderanch.com/t/429377/EJB-Certification-SCBCD/certification/NamingException-during-lookup
 
Joe Harry
Ranch Hand
Posts: 10123
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Found out the answer , might be useful for someone .

This should be MapedName#package.RemoteBeanName
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic