• 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

accesing ejb deployed in weblogic from tomcat

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
all friends
i have an ejb deployed on weblogic 8.1 now how do i call this ejbs from my tomcat
i am trying to follow the below code but its not working
Properties prop=new Properties();
prop.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
prop.put(Context.PROVIDER_URL,"t3://localhost:7001");
Context ctx=new InitialContext(prop);
Object ref=ctx.lookup("OrderManagement1");
System.out.println(" look up done");
orderManagementHome home=(orderManagementHome)javax.rmi.PortableRemoteObject.narrow(ref,orderManagementHome.class);
orderManagement1 orderManagement=home.create();
orderManagement.placeOrder("Cedric","J2EE server programming",1000);
orderManagement.add("recepient","message");
 
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please post your error message, it's very important.
 
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where is the code breaking? Try to test each step you made about discovering the bean (test against null). My first guess is that the lookup fails, so the JNDI name of the bean is not the one you use for retrieval.
 
alec stewart stewart
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am able to access ejb from tomcat when they are on the same machine.
the moment i try to access the same ejb from tomcat but from a different machine its states a problem in the inital context thing which is as follows

Properties prop=new Properties();
prop.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
System.out.println("got initial context factory");
prop.put(Context.PROVIDER_URL,"t3://localhost:7001");
Context ctx=new InitialContext(prop);
Object ref=ctx.lookup("OrderManagement1");
System.out.println(" look up done");
orderManagementHome home=(orderManagementHome)javax.rmi.PortableRemoteObject.narrow(ref,orderManagementHome.class);
orderManagement1 orderManagement=home.create();
orderManagement.add("recepient","message");
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
https://coderanch.com/t/314497/EJB-JEE/java/connect-between-EJB-anothe-EJB
 
Alexandru Popescu
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


prop.put(Context.PROVIDER_URL,"t3://localhost:7001");


is it clear why you can access the EJB on the same machine?
You need to put the provider URL from the remote machine.
 
Men call me Jim. Women look past me to this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic