Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Confused of Local Interface and Remote Interface

 
Stephen Lee
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am very new to EJB. After reading some materials and trying some samples, I understand the concept of Local Interface and Remote Interface. However, I am still confused of difference between Remote Interface and Local Interface. When should I use them?
I am now creating a servlet which calls a session bean while this session bean will call the entity bean for the data. The session bean is Remote Interface while I want to call the entity bean of Local Interface (I am trying to follow an example in the book of Mastering of EJB). However, it fails to call the entity bean. It says something of naming exception. When I call the entity bean with Remote Interface, it is successful. Why does this happen?
Stephen
 
SAFROLE YUTANI
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure you defined a JNDI name for the local interface? You need 1 JNDI name for the remote interface, and 1 JNDI name for the local interface. Both are usually specified in a vendor-specific deployment descriptor. For the case of Weblogic, this file is weblogic-jar.xml.
SAF
 
Karl Laird
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are they both deployed in the same naming context and container? To use the local interface beans must be colocated within the same EAR, and use the same naming context in the .xml descriptor
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic