You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Rune Engseth <ra...@nextra.com> on 2000/08/14 15:10:27 UTC

EJB/Tomcat vs. EJB/J2EE?


I have the following problem:

I'm using tomcat for my servlets and jsp's.
I have also deployed an EJB using the J2EE server
and deployment tool.
My servlet is doing all the JNDI lookup things, and 
calls a method on the EJB :

- **
Context initial = new InitialContext();
Object objref = initial.lookup("EMailer");
EMailerHome home = (EMailerHome)PortableRemoteObject.narrow(
		   		objref, 
		   		EMailerHome.class);
EMailer mailer = home.create();
mailer.sendMail(param, param, ...)
- **

If deploying my servlet on the J2EE server, this works fine.
However, when I deploy my servlet on Tomcat, I get the following error
when trying to cast the object using the narrow method:


Class: com.sun.corba.ee.internal.iiop.CDRInputStream$1 ( my debug info !!)
Exception null
java.lang.ClassCastException
        at 
com.sun.corba.ee.internal.javax.rmi.PortableRemoteObject.narrow(Porta
bleRemoteObject.java:296)
        at javax.rmi.PortableRemoteObject.narrow(Unknown Source)
        at 
comlet.server.servlet.ComletServlet.setupEMailer(ComletServlet.java:6
4)
        at 
comlet.server.servlet.ComletServlet.doGet(ComletServlet.java:32)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.ja
va:503)
        at 
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.ja
va:597)
        at 
org.apache.tomcat.servlets.InvokerServlet.service(InvokerServlet.java
:257)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.ja
va:503)
        at 
org.apache.tomcat.core.ContextManager.service(ContextManager.java:559
)
        at 
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processCon
nection(Ajp12ConnectionHandler.java:156)
        at 
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.j
ava:338)
        at java.lang.Thread.run(Unknown Source)



I have made sure that the correct class file is in the class path etc, so
why do I get this error on Tomcat and not on the J2EE server??

regards,
Rune Engseth
Nextra AS 
NORWAY