• Post Reply Bookmark Topic Watch Topic
  • New Topic

ClassCastException on narrow

 
Alan Peltz
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have a project that we deploy to Jboss 3.2.1/Tomcat 4.1.24. We will call it proj1.ear. We have another project (proj2.ear) that has a stateless session bean (SessBeanProj2). SessBeanProj2 would really like to reuse a stateless session bean in proj1 (UsefulSessBeanProj1 � actually sits in proj1EJB.jar which is eared up in proj1.ear). Here�s a code snippet:
InitialContext ctx = new InitialContext();
Object fromJNDI = ctx.lookup("ejb/UsefulSBProj1");
Object usefulSbHome = PortableRemoteObject.narrow(fromJNDI, IUsefulSBProj1Home.class);
This throws a ClassCastException. The stacktrace is below.
I have been researching this for a bit, so I have heard some things about Classloaders and some about the Classpath, but I need some more specifics. If it is the classpath issue, what do I need on the classpath? Do I need the ear on the classpath? Or just proj1EJB.jar? I am putting these things on the Class-Path line in my manifest file � is this the correct way?
As you can see, I�m grasping. Any help would be much appreciated. Thanks!
Here is part of the stacktrace. I will give you the whole thing if you think it will be useful, but I didn�t think it would be:
java.lang.ClassCastException
at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
at com.ndwc.proj2.ejb.bo.SessBeanProj2.daMethod(SessBeanProj2.java:92)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:629)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!