wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes ClassCast Exception while invoking EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "ClassCast Exception while invoking EJB" Watch "ClassCast Exception while invoking EJB" New topic
Author

ClassCast Exception while invoking EJB

Lokeswar Reddy
Greenhorn

Joined: Aug 13, 2013
Posts: 2
We are in process of upgrading our MQ version from 6 to 7. Our weblogic version is 10.3.6.

When we are processing a MQ response we are getting a class cast exception while looking up and invoking an EJB.

Here is the code snippet for exception :

try
{
Object obj = ctx.lookup(getSJBName());
obj.toString();


EJBHome home =
(EJBHome)javax.rmi.PortableRemoteObject.narrow(obj.getClass(), EJBHome.class);

Method create = home.getClass().getDeclaredMethod("create", new Class[0]);
genericRemote = (SessionRemote)create.invoke(home, new Object[0]);

remoteMap.put(this.getClass().getName(), genericRemote);
}
catch (Exception e)
{
Log.caught("Exception:"+e, this);
Log.thrown("LokException:"+e, this);
throw new LokException(e);
}


From log I can see :

Mon Aug 12 02:31:25 MDT 2013:null: Getting the SJB namecom.nest.lok.session.primitive.absErrSJBHomeMon Aug 12 02:31:25 MDT 2013:null: Got the Object for SJB lookup
Mon Aug 12 02:31:25 MDT 2013:null: Created Object : ClusterableRemoteRef(-5212375303722029986S::lok_app:admin_lok [-5212375303722029986S::lok_app:admin_lok/353])/353
Mon Aug 12 02:31:25 MDT 2013:null:Created EJB home for object = ClusterableRemoteRef(-5212375303722029986S::lok_app:admin_lok [-5212375303722029986S::lok_app:admin_lok/353])/353
Mon Aug 12 02:31:25 MDT 2013:null: Created EJB home for object
Mon Aug 12 02:31:25 MDT 2013:null: Created Create method
Mon Aug 12 02:31:25 MDT 2013:lokApp:<Exception Caught>Exception:java.lang.ClassCastException: com.nest.lok.session.primitive.absErrSJB_oncb4y_EOImpl_1036_WLStub cannot be cast to com.nest.lok.session.SessionRemote
Mon Aug 12 02:31:25 MDT 2013:lokApp:<Exception Thrown>LokException:java.lang.ClassCastException: com.nest.lok.session.primitive.absErrSJB_oncb4y_EOImpl_1036_WLStub cannot be cast to com.nest.lok.session.SessionRemote
Mon Aug 12 02:31:25 MDT 2013:null:Exception: com.nest.lok.session.primitive.absErrSJB_oncb4y_EOImpl_1036_WLStub cannot be cast to com.nest.lok.session.SessionRemote
com.nest.lok.exception.LokException: com.nest.lok.session.primitive.absErrSJB_oncb4y_EOImpl_1036_WLStub cannot be cast to com.nest.lok.session.SessionRemote
at com.nest.lok.message.GenericMessage.createSessionRemote(GenericMessage.java:138)
at com.nest.lok.message.GenericMessage.query(GenericMessage.java:505)
at com.nest.lok.abs.ABSPacketInfo.getIdForErrorMessage(ABSPacketInfo.java:696)
at com.nest.lok.abs.ABSPacketInfo.mapConfirmationDetail(ABSPacketInfo.java:1083)
at com.nest.lok.abs.ABSPacketInfo.storeConfirmation(ABSPacketInfo.java:1181)

Please help me.
Lokeswar Reddy
Greenhorn

Joined: Aug 13, 2013
Posts: 2

I found that the new mq jars (related to version 7) are causing the issue. But not sure how to fix it. Please help me.
German Gonzalez-Morris
Ranch Hand

Joined: Nov 16, 2009
Posts: 155

This issue is more related to WebLogic Server than generic EJB question.
Anyway, are you using mq 7 for all your created components ?
(server and client side?).

http://devwebcl.blogspot.com/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ClassCast Exception while invoking EJB
 
Similar Threads
NamingException
Invoking EJB methods using reflection
ClassCast Exception on EJB remote object lookup
Quick refresher.....
to understand which *.MF to use