Hi Dennis, This will happen if the JiBX classes were loaded by a different class loader (the container, etc) with a scope greater than the ear's classloader (not destoryed on hot deploy). Java uses the classloader AND the class to determine if a cast will succeed.
First load:
CL 1:
JiBX -> ref to client classes in CL 2
CL 2:
Client classes
--unload ear--
On reload:
CL 1:
JiBX -> ref to client classes in CL 2
CL 3:
Client classes
Bernhard needs to make sure that JiBX is NOT in his classpath and it's not in
any other deployment folder. More than likely, it's in his classpath. If it's
not in your classpath, you need to make sure your container supports deployment
isolation and make sure your JiBX jars are in EACH deployment. (If you are
using JBoss, this is NOT default, you have to configure it) You can't put them
in a central location like the app server's lib foler.
If CL 2 wasn't destroyed, the user would get a ClassCastException and if you
watch it in the debugger you see that it attempts to cast com.foo.Foo to
com.foo.Foo (the same class, different class loader)
If he is using JBoss, please refer to this:
http://www.jboss.org/wiki/Wiki.jsp?page=ClassLoadingConfiguration
Sorry for the long email,
Tony
-----Original Message-----
From: [EMAIL PROTECTED] on behalf of Dennis Sosnoski (JIRA)
Sent: Sat 4/29/2006 7:49 PM
To: [EMAIL PROTECTED]
Subject: [jibx-devs] [jira] Commented: (JIBX-108) wrong Classloader used
[ http://jira.codehaus.org/browse/JIBX-108?page=comments#action_64407 ]
Dennis Sosnoski commented on JIBX-108:
--------------------------------------
I'm not sure why this would occur offhand, but if you can send me full details
(including stack trace) I should be able to find a way around the problem.
Please first build the JiBX jars from your distribution with debug turned on so
you'll see line numbers - this can be done by going into the unzipped build
directory of the distribution and running "ant current".
> wrong Classloader used
> ----------------------
>
> Key: JIBX-108
> URL: http://jira.codehaus.org/browse/JIBX-108
> Project: JiBX
> Type: Bug
> Versions: JiBX 1.0.1
> Environment: JBoss 4.0.4cr2
> Reporter: Bernhard Neuhauser
>
>
> 1) deploy ear using jibx deserialisation inside
> 2) undeploy the ear
> 3) deploy the same ear again
> Now BindingDirectory.getFactory(class) leads to the following Exception:
> "java.lang.ClassNotFoundException: Invalid use of destroyed classloader"
> Jibx tries to load classes from the classloader used in 1) but this
> classloader is no longer valid.
> The problem is a blocker for hot deployment, because the whole server needs
> to be restarted to be able to deploy the ear again.
> Look at jaxb2; it seems like they had the same issue:
> https://jaxb.dev.java.net/faq/index.html
> (Q. Why can't I cast the unmarshalled object into the generated type)
> thx,
> Bernhard
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
jibx-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-devs
<<winmail.dat>>
