I've got a servlet accessing to a ssesion bean (facade). When tested with a POJO local client it works fine. Though, I've this ugly exception when trying it with a servlet executing remotely, in another app:
java.lang.ClassCastException at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293)
I am executing all this in Sun Java Studio Enterprise IDE, which uses Tomcat 4.1 and Sun Application Server 7.
I've got in my WEB-INF/lib/ folder the files j2ee-1.3.jar and the jar file of my bean module (package StockBeans).
The problem is that the servlet does access to the EJB jar file, because if I put it away, I get a NoClassDefFoundError. Plus, the servlet does connect to the orb listener of my webapp (if I type another port I get an exception) and the server can see my deployed application (if I undeploy it... guess what).
In the ejb jar file, Stock extends EJBObject and StockHome extends EJBHome (it's remote for sure). His JNDI Name is "ejb/Stock". May the error be produced because the JNDI name of the bean is the same as when I try to lookup? Or is it mandatory?
Joined: Mar 01, 2005
I solved my problem.
I was using an ejb jar created with "export ejb jar". I didn't noticed that when the module is inside an application, another option comes up: "export client ejb jar".
I feel so stupid. All this time wasted...
author & internet detective