• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to use an EJB, deployed in another server?

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have 2 websphere test-environments running on same machine but with different ports. I have deployed the EJB on one server say server1 & I have an web project runnning on another server say server2. I have copied the home & remote interfaces to Web application running on server2. When I try to access the EJB of server1 from servlet of server2, it is giving exception
javax.naming.NameNotFoundException: ejb/com/ejb/MyEJBHome. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound

The jndi name of my EJB is "ejb/com/ejb/MyEJBHome". Why I have the exception & what is solution to this? After getting exception I stop the server2 & then given the reference of the ejb-jar file to web application & then started server2 by rebuilding the web-application. But still I have same exception when I call my servlet . How can I solve this problem?
 
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sounds like your JNDI lookup is looking up the bean in the wrong server.
 
Author
Posts: 531
Mac OS X Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok , you are trying to access an EJB which is not in the same server that your jndi client resides.
so you should initiate the InitialContext with correct parameters.
what does correct parameters mean ?
at least :
Correct PROVIDER_URL and correct INITIAL_CONTEXT_FACTORY
so check this page and configure the initial context with corect port jndi endpoint url , then you will have no problem.


http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/rnam_example_prop2.html
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic