Hi,
I get a ClassCastException if I try to cast the EJSWrapper-Class returned from local EJB Lookup to the interface it implements.
The environment I use is WSADIE 5.1.1 with integrated Testenvironment.
I have defined two EARs. One with a Web-Application and one wich contains the EJB to call from the WebApp. Both run in the same appserver instance wich means both run in the same JVM and i should be able to use Local Interface of the EJB.
The EJB should use Libraries from the Server Environment while the WebApp uses newer Libs than the Server Environment offers(eg axis-rpc,wsdl4j,saaj). The Classloader-Policy of the EAR with the WebApp is set to PARENT_LAST while the Classloader-Policy of the EAR with the EJB is set to PARENT_FIRST.
I do a Lookup by using an EJB-Local-Reference. The returned object is an EJSLocalStatelessHome-Object, wich implements my LocalEJBInterface. But if i try to cast to Object to this interface a ClassCastException occurs.
The Classes of the EJB are packaged as follows:
EJBName.jar contains the EJB-Impl class, the Serverside Implementations for RMI/IIOP interaction an EJSWrapper classes. This jar is packaged with the EJB-EAR.
EJBClient.jar contains the Local- and Remote-Interface classes and the Stub-classes for EJBHome and EJB-Implementation. This jar is packaged wich both EARs, because of the interfaces, wich are needed in both projects.
The Classloader of the EAR with the WebApp has no access the jar with the EJB-Impl, the generated Ties- and EJSWrapperclasses because it is located in only the EJB-EAR. But the interface-class is contained in the WebApp-EAR as described above.
The exact Exception is as follows:
java.lang.ClassCastException: com/ibm/wsrf/EJSLocalStatelessBPEAdapterHome_c2546ef5 incompatible with com/ibm/wsrf/BPEAdapterLocalHome
java.lang.Throwable.<init>(Throwable.java)
java.lang.Throwable.<init>(Throwable.java)
java.lang.ClassCastException.<init>(ClassCastException.java:53)
org.tempuri.ResourceDiscoveryService.DiscoverySoapHttpBindingImpl.getResourceEPR(DiscoverySoapHttpBindingImpl.java)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java)
...
The EJSLocalStatelessBPEAdapterHome_c2546ef5 implements the BPEAdapterLocalHome interface.
Please, can anyone give me a hint how to solve this problem?
Thanks in advance, Michael