Possible class loading conflicts of precompiled bindings
--------------------------------------------------------

                 Key: JIBX-289
                 URL: http://jira.codehaus.org/browse/JIBX-289
             Project: JiBX
          Issue Type: Bug
          Components: core
    Affects Versions: JiBX 1.2.1
            Reporter: Karel A Sague


I'm working with maven 2.0.9 and JiBX 1.2.1.

   I've reported on the error previously at
http://www.mail-archive.com/jibx-users%40lists.sourceforge.net/msg03932.html

   It's being generated at BindingDirectory.getFactory(String bname,
String pack, ClassLoader loader), line 273

   "if (result instanceof IBindingFactory) {"

   "result" is loaded via a class loader initialized in
"org.jibx.binding.classes.ClassFile.setPaths(String[] paths)", line
2048:

   s_directLoader = new URLClassLoader(urls);

   This classloader's parent classloader is the system class loader.

   However IBindingFactory is loaded by RealmClassLoader which is part of
the Classworks clsas loading framework used by Maven.

   There are two fixes that in both cases should be considered according
to the use of the binding compiler. Both set the parent class loader to
the UrlClassLoader that loads the bindings:

   s_directLoader = new
URLClassLoader(urls,ClassFile.getClass().getClassLoader());

   or

   s_directLoader = new URLClassLoader(urls,
Thread.currentThread().getContextClassLoader());

  In both cases "result" which is the binding factory generated for the
precompiled project, is loaded via the parent class loaders which
s_directLoader will delegate to, thus, the "result instanceof
IBindingFactory" succeeds.

  I tested both solutions using the Maven JiBX plugin 1.2.1, Maven Antrun
plugin and invoking directly the compiler via the command line
successfully.



-- 
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

        

------------------------------------------------------------------------------
_______________________________________________
jibx-devs mailing list
jibx-devs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to