Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JiBX 1.2.1
-
Fix Version/s: JiBX 1.2.2
-
Component/s: core
-
Labels:None
-
Number of attachments :
Description
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.
Activity
| Field | Original Value | New Value |
|---|---|---|
| Fix Version/s | JiBX 1.2.2 [ 15120 ] | |
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Resolution | Fixed [ 1 ] | |
| Assignee | Dennis Sosnoski [ dsosnoski ] |
| Status | Resolved [ 5 ] | Closed [ 6 ] |
Any update on this issue, as I am running into the same problem, and have been unable to find another work around.