File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ClassCast Exception while invoking EJB

 
Lokeswar Reddy
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 233
Eclipse IDE Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?).
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic