Dear reader,

I've been trying to let Tomcat remotely call an EJB (Enterprise Java Bean) from a JSP 
page. But so far without any result (but many different exceptions). I am new to 
Tomcat, so I guess I am missing something somewhere.

Tomcat runs in a separate JVM and so does the default J2EE server (so basically 2 
different locations). The EJB deployed at the J2EE servers JNDI name is ejb/AuthorRef. 
I've created a simple web.xml file that goes with the JSP, which content is:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd";>

<web-app>

<!-- EJB Reference -->
    <ejb-ref>
      <description>Author Bean</description>
      <ejb-ref-name>ejb/AuthorRef</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <home>ejbbeans.AuthorHome</home>
      <remote>ejbbeans.Author</remote>
    </ejb-ref>
</web-app>

The code in the JSP I used to locate the EJB is:

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.enterprise.naming.SerialInitContextFactory");
env.put(Context.PROVIDER_URL, "iiop://127.0.0.1:1050");
env.put("java.naming.factory.url.pkgs","com.sun.enterprise.naming");
InitialContext context = new InitialContext(env);
Object ref    = context.lookup("java:comp/env/ejb/AuthorRef");

The last line (of the code) causes an exception. Such as "object not bound to this 
Context" and alike. I don't know what I am doing wrong, or what I should do different 
as I haven't found any good documentation about this subject.  I hope someone knows 
what I should do. I am really stuck now.. at Suns Java forum no-one seems to know 
either... Thanx a lot in advance!

Regards Martijn



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to