[ 
http://jira.codehaus.org/browse/JIBX-289?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dennis Sosnoski resolved JIBX-289.
----------------------------------

         Assignee: Dennis Sosnoski
       Resolution: Fixed
    Fix Version/s: JiBX 1.2.2

So if I understand this correctly, the problem occurs when trying to compile a 
binding using precompiled bindings with maven. The code which loads the 
precompiled binding information uses the ClassFile classloader, which only 
works off URLs and ignores the maven Classworks classloader.

The code has been changed for the 1.2.2 release to have the ClassFile 
classloader use ClassFile.class.getClassLoader() as the parent classloader, so 
based on your tests this should take care of the problem.

> 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
>            Assignee: Dennis Sosnoski
>             Fix For: JiBX 1.2.2
>
>
> 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

        

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
jibx-devs mailing list
jibx-devs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to