File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JBoss/WildFly and the fly likes three day headache - ClassCastException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "three day headache - ClassCastException" Watch "three day headache - ClassCastException" New topic

three day headache - ClassCastException

Goran Markovic
Ranch Hand

Joined: Sep 26, 2008
Posts: 399
I'm new to JBoss, and till now only I've used Tomcat.
However I wanted to deploy some application on JBoss, which I've previously deployed successfully on Tomcat.
The simple servlet/Jsp based application, I can engage on IBoss.
But any of my other application, inside what I use additional technologies like:
Struts2, Hibernate 3, String 2x, which also successfully were deployed on Tomcat, cannot be engaged on JBoss.
The exception I get is :

However, if I remove Xerces.jar from my application's lib directory, and redeploy application, I get little changed exception :

I would appreciate if someone indicate at problem solution... Thanks
Peter Johnson

Joined: May 14, 2008
Posts: 5852

I'm guessing that your app contains a JAR file containing javax.xml.parsers.DocumentBuilderFactory. Please list the contents of your WAR file (use "jar -tf xxx.war")

JBoss In Action
Goran Markovic
Ranch Hand

Joined: Sep 26, 2008
Posts: 399
I founded that it's an issue about class loading. The classes which my application use have been already loaded by application level classloader.
I try to exclude some files potentially loaded by an application classloader, and it's work. However, some of excluded classes was crucial for engaging some parts of application.
Then I try to 'fine grain' what libraries are used by application loader, and what libraries are not, so the later one will be present in my application. After such a selection, sever was start at all. I figure out that I need to perform isolated classloading. There is a n article on JBoss community forum, but I still cannot perform such an isolation so only libraries stored in my application/lib, to be used?! Even I do not that solution, The also good one will be if someone explain me either how to use libraries of JBoss, but not to be in conflict with unique application libraries?
Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10441

This will be a good start

[My Blog] [JavaRanch Journal]
Goran Markovic
Ranch Hand

Joined: Sep 26, 2008
Posts: 399
Well, I read it by probably I didn't figure out at right way. As I understand, to make isolated class loading (to constrain loading of applications libraries) I should make this elemnts in jboss-web.xml, file, place it in the WEB-INF/ directorium of my web application, and than make .war file, which will be deployed.
This is the content of jboss-web.xml file :

Is it ok? Also I'm in doubt, what need to stay here

where test.war is the name of war.In the article you post here says :

Please, correct me in my mistakes ...
Goran Markovic
Ranch Hand

Joined: Sep 26, 2008
Posts: 399
I have done everything I could found from either books, or jboss specification, or from any place on net, and it still wot work. I've configured server.xml file to use isolated lcass loading, and also make modification in jboss-web.xml file to perform isolated classs loading but it wont!?!?
This is the content of mentioned files:


and this is all configuration I could fined on mentioned locations and it wont work. I would really appreciate HELP!?
I agree. Here's the link:
subject: three day headache - ClassCastException
It's not a secret anymore!