-
1. Re: ClassCastException when casting to same object.
sanjay05222 May 26, 2015 2:13 PM (in response to jboss234)You have to find all the jars where you have this class DataSourceDT and then have this class only load form one place. It goes with out saying that Class loading class comparison includes three attributes of Class class name , class id which is provided by class loader , Your Class DataSourceDT Seems to be loaded by Different Class loaders and hence above error is bound to happen .
thanks
Sanjay Gautam
-
2. Re: ClassCastException when casting to same object.
jboss234 May 26, 2015 2:25 PM (in response to sanjay05222)Thanks Sanjay for reply,
EAR file has WAR and JAR file. This class exist in both of them.
Web layer use Cocoon (XSPs, XMAPs) framework, I tried to remove this file from WAR. Now it started throwing com.myclass.report package does not exist error.Thanks,
-
3. Re: ClassCastException when casting to same object.
sanjay05222 May 26, 2015 2:45 PM (in response to jboss234)I think you there is no direct answer but , I believe if your XSPs are using this class then probably it have had to be in the war so removing it from there might now help. Secondly this ear , how are you deploying , I mean there is option to deploy ear in which all the ear level can access war and jar level stuff are you doing that class loading strategy ? described in this documentation Class Loading in Widlfy ear-subdeployments-isolated
Secondly the framework can also create the issues as they may have different class loaders strategy , I faced the similar issue in the JBPMN , SOAP WebService Work Item Handler. which uses the CXF apis to create runtime XML/Java objects . I had to write the work Item handler totally new as the out of the box didnt used the right method provided by CXF apis.
Thanks
Sanjay Gautam
-
4. Re: ClassCastException when casting to same object.
jboss234 May 26, 2015 3:05 PM (in response to jboss234)I am not specifying any class loading strategy.
How to load the classes with one classloader only.
Thanks,
Dhaval
-
5. Re: ClassCastException when casting to same object.
jaysensharma May 27, 2015 12:35 AM (in response to jboss234)Dhaval,
You need to make sure that you only have one JAR file that contains the class "com.myclass.report.DataSourceDT". (inside your application or inside custom modules)
-
6. Re: ClassCastException when casting to same object.
sanjay05222 May 27, 2015 2:20 PM (in response to jaysensharma)Many time it happens when with frameworks generating code at runtime and then instantiating the classes using their classloader instead of the one from one's application trails. but I can say that wildfly modular class loader still not so solid or there is not enough to the point documentations about its real functioning . I personally didnt have great fun migrating my applications to wildfly. there are still lots of conflicts do arise.