Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

PortableRemoteObject.narrow() throws ClassCastException

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have deployed my sample EJB on standalone oc4j.jar using JDeveloper.
I have also successfully tested my EJB application through JDeveloper by
connecting to standalone oc4j.jar.
Now I want to invoke the EJB from a servlet.
I have written the code in the servlet as follows.
Hashtable oEnv = new Hashtable(); // Max needed + 1
oEnv.put(Context.SECURITY_PRINCIPAL, "admin");
oEnv.put(Context.SECURITY_CREDENTIALS, "admin");
oEnv.put(Context.PROVIDER_URL, "ormi://Sanjeev/myejb");
System.out.println("Setting initial context");
InitialContext ic = new InitialContext(oEnv);
System.out.println("looking up");
Object homeObject = ic.lookup("java:comp/env/MyEJBBean");
System.out.println("Look up successful=");
home =
System.out.println("Got home");
It is able to perform look up, but at the time of type casting, I am thrown
java.lang.ClassCastException : MyEJBHome_StatelessSessionHomeWrapper1
The orion-ejb-jar.jar which is generated by the Container by itself has the
following code.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE orion-ejb-jar PUBLIC "-//Evermind//DTD Enterprise JavaBeans 1.1
runtime//EN" "">
<orion-ejb-jar deployment-version="" deployment-time="f7f191a26c">
<session-deployment name="MyEJBBean" location="MyEJBBean"
persistence-filename="MyEJBBean" />
<security-role-mapping name="<default-ejb-caller-role>"
impliesAll="true" />
I want to know what kind of error is this and what is
For your information, I have deployed EJB using EAR file (that contains the
ejb jar file only and not the war file) on standalone oc4j.jar and I have
placed the servlet in default-web-app directory under WEB-INF/classes.,
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hope all your classes are of the same version.
There will be plenty of time to discuss your objections when and if you return. The cargo is this tiny ad:
We need your help - Coderanch server fundraiser
    Bookmark Topic Watch Topic
  • New Topic