A little update. I have two ear files containing different applications. But both ear files have some common jar files. If I remove my other ear file, it works fine my class loader can load my class using Class.forName.
Does anyone know how the classloader tree in JBoss looks?
Okay I am having a monologue here, but since I have started I might as well finish. I found this link:
http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=forums/ basically explains that the different ear files have the same class loader. To get different class loaders for each ear file put a jboss-app.xml in your earfile and an entry like this:
That worked like a charm for me.