Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Why can't I invoke a ejb in Tomcat?

843836Aug 30 2003 — edited Aug 30 2003
Hi everyone:

I invoke a ejb in Tomcat(the ejb is in the weblogic in the same computer with tomcat).The jsp code is:

/////////////////first method//////////////////////
Context ctx=new InitialContext();
Object obj=ctx.lookup("ejb/Hello");
Hellohome home=(Hellohome)PortableRemoteObject.narrow(obj,Hellohome.class);
Hello hello=home.create();
out.println(hello.getHello());
///////////////second method//////////////////
Hashtable ht=new Hashtable();
Context ctx=null;
ht.put(ctx.PROVIDER_URL, "t3://127.0.0.1:7001" ); // t3://127.0.0.1:7001
ht.put(ctx.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
ctx = new InitialContext();
Hellohome home= (Hellohome) javax.rmi.PortableRemoteObject.narrow (ctx.lookup ("HelloEJB"),Hellohome.class);
Hello hello=home.create();
out.println(hello.getHello());
Is there any different?If I want to invoke the EJB which is in the weblogic.The Tomcat says:
//////////////////////////////////////////////
Name HelloEJB is not bound in this Context

But I bound it in the weblogic and I add the "
<ejb-ref>
<ejb-ref-name>HelloEJB</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>lyoejb.Hellohome</home>
<remote>lyoejb.Hello</remote>
<ejb-link>Hello.jar#HelloEJB</ejb-link>
</ejb-ref>"

in the ejb-jar.xml. And I copy the j2ee.jar,wlclient.jar,Hello.jar to Tomcat/....web-inf/lib

How to setting the web.xml in the Tomcat?

Comments

Processing
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Sep 27 2003
Added on Aug 30 2003
12 comments
222 views