Author |
Message
|
diaozuxin |
Posted: Tue Mar 20, 2012 10:40 am Post subject: when call ejb , return CAST exception(in WMB) |
|
|
Newbie
Joined: 27 Jun 2010 Posts: 5
|
Dear all,
I meet a strange and interesting problem, i.e ,when I call an EJB on a Weblogic Server in JavaCompute Node, it returns me
Text:CHARACTER:java.lang.ClassCastException: com.ejb.HelloWorld_evy8hi_HomeImpl_1030_WLStub incompatible with com.interfaces.HelloWorldHome
But I when I call the EJB in a java project. It's OK.
I have put the EJB client jar file into the lib path of the java project referenced by message flow. Also I put the weblogic.jar into a user lib.
In the java project this seems OK. But why it throw exception in javacompute node? |
|
Back to top |
|
 |
mqsiuser |
Posted: Tue Mar 20, 2012 11:19 am Post subject: Re: when call ejb , return CAST exception(in WMB) |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
Can you use a WebService-Interface (to call on the Weblogic-AS) (instead of "remote objects")?
Also consider that Broker is not an AppServer:
WAS to WAS EJB-Calls: ok
WAS to WebLogic EJB-Calls: probably ok
Broker: EJB-Calls... probably not ok _________________ Just use REFERENCEs |
|
Back to top |
|
 |
kimbert |
Posted: Tue Mar 20, 2012 2:13 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
It looks as though you are picking up a different class when you run within the JavaCompute node. That's probably because the class path is different, or perhaps because a different class loader is being used. I'm pretty sure it's possible to configure the JVM to tell you about every class that it loads. Then you can search the output for your class name and (hopefully) see where it's going wrong.
Others may have better suggestions. |
|
Back to top |
|
 |
diaozuxin |
Posted: Tue Mar 20, 2012 7:10 pm Post subject: |
|
|
Newbie
Joined: 27 Jun 2010 Posts: 5
|
Dear Kimbert,
What you think is very similar to mine, I have thought the problem come from the classloader, but how to configure the Message Broker JVM, and trace out all loading classpath? |
|
Back to top |
|
 |
mqsiuser |
Posted: Tue Mar 20, 2012 8:52 pm Post subject: |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
Which version (of EJB) do you use? (2.1, 3.0, 3.1)?
With 2.1 you will have a remote&home interface and before the CAST you'll have to do a narrow. _________________ Just use REFERENCEs |
|
Back to top |
|
 |
kimbert |
Posted: Wed Mar 21, 2012 12:33 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Use mqsichangeproperties specifying the 'ComIbmJVMManager' resource to set the properties on the JVM. If you don't know the property name, you can use mqsireportproperties to get a list of available properties. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Mar 21, 2012 5:11 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You should use a JavaClassloader Configurable Service and specify the needed locations to ensure that your Java Compute node will get the right classes from the right place.
No need to set specific properties on the ComIBMJVMManager, and no need to put jar files in shared-classes or etc. |
|
Back to top |
|
 |
mqsiuser |
Posted: Thu Mar 22, 2012 2:08 am Post subject: Re: when call ejb , return CAST exception(in WMB) |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
diaozuxin wrote: |
Text:CHARACTER:java.lang.ClassCastException: com.ejb.HelloWorld_evy8hi_HomeImpl_1030_WLStub incompatible with com.interfaces.HelloWorldHome |
This is not a "Class not found exception", but a "Stub doesn't fit to native Class" CAST exception.
The narrow might take care ... and narrow down from an "Object" to the proper (native) Class (not the stub).
From how I understand it, in newer EJB-Versions the narrow is not necessary (any more)... and then the CAST must do that "implicitly/includingly"... which might explain why it works in one place and doesn't in the other: What EJB-versions do you use (in each place)? _________________ Just use REFERENCEs |
|
Back to top |
|
 |
|