This is a classloader problem. In java, an object created in a classloader cannot be cast
to its superclass in another classloader. This is simply because two classes loaded using
the same class name from the same jar from two different class loader are different (see
Java Language Specification third edition-chapter 4.3.4).
In our case the deploy mojo creates a temporary classloader that contains
jbossall-client.jar each time it does a jmx call. That's the source of the problem. I
changed a bit the behaviour and store the temporary classloader as a static field. This
way, classes from jbossall-client.jar are loaded only once per jvm.
That's a hack to fix a hack and I wouldn't be surprise if that was creating some
other issues. Ideally, jbossall-client should be defined as a maven dependency (as
described in the comments of the classloader hack).
Note that doing
$ export MAVEN_OPTS=-verbose
and using java6 instead of java5 helps a lot to debug classloader issues.
I'll clean up my patch and send it soon.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4181665#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...