aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes accesing ejb deployed in weblogic from tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "accesing ejb deployed in weblogic from tomcat" Watch "accesing ejb deployed in weblogic from tomcat" New topic
Author

accesing ejb deployed in weblogic from tomcat

alec stewart stewart
Ranch Hand

Joined: Dec 23, 2003
Posts: 71
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");
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Please post your error message, it's very important.


SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
Alexandru Popescu
Ranch Hand

Joined: Jul 12, 2004
Posts: 995
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.


blog - InfoQ.com
alec stewart stewart
Ranch Hand

Joined: Dec 23, 2003
Posts: 71
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

Joined: Jul 04, 2003
Posts: 1312
http://www.coderanch.com/t/314497/EJB-JEE/java/connect-between-EJB-anothe-EJB
Alexandru Popescu
Ranch Hand

Joined: Jul 12, 2004
Posts: 995

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.
 
wood burning stoves
 
subject: accesing ejb deployed in weblogic from tomcat
 
Similar Threads
access remote session ejb on remote server
Topic: access remote session ejb on remote server
EJB's in two different Application Servers
WSAD InitialContext stalls
Cannot Access EJB on Weblogic ???