Search code examples
jbossderby

How to solve ClassCastException for same class in Jboss EAP 6.5


I have created and deployed one war for my application.

I wanted to use derby for integration testing so I created one module in Jboss.

At run time I am getting ClassCastException for same class, since the class is getting loaded twice: first from war, then from my module's jar.

To elaborate, my war, say application.war contains myderby.jar and under my module i have added myderby.jar .My class, say Custom.java, is present in myderby.jar.


Solution

  • If you want a jar to be accessible to multiple WARs, JARs, or an EAR and a WAR/JAR - or in fact any such combination, you can include it as a global module. Here's how it can be done.

    This might also help.