We have an application that gets dynamically extended with new classes that are placed into separate jar files. These jar files are placed in the default/lib directory. The application does not know about these classes beforehand, i.e. it has not manifest entry in any jar file to reference the newly added jars.
The base class of these classes is located in the ear file of our application.
The classs are instantiated with
Thread.currentThread().getContextClassLoader().loadClass(classname). We then get a ClassNotFoundException with the name of the base class in the msg field set.
java.lang.ClassNotFoundException: Unexpected error during load of: com.tkc.pass.batch.event.hellouniverse.HelloUniverseEventFactory, msg=com/tkc/pass/batch/processing/EventFactoryAbs at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:500) at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:374) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at org.jboss.util.loading.DelegatingClassLoader.loadClass(DelegatingClassLoader.java:77) at org.jboss.mx.loading.LoaderRepositoryClassLoader.loadClass(LoaderRepositoryClassLoader.java:78) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at org.jboss.util.loading.DelegatingClassLoader.loadClass(DelegatingClassLoader.java:77) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at com.tkc.pass.batch.server.service.Batch.getEventFactory(Batch.java:51) at com.tkc.pass.batch.server.service.Batch.generateEvent(Batch.java:87) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585)
I solved the problem by setting
<attribute name="Isolated">false</attribute>in the ear-deployer.xml file