30 August 2012 by ludovicianul
If you just add JAXB1 and JAXB2 jars into the same classpath you may end up with the following exception:
You are trying to run JAXB 2.0 runtime but you have old JAXB 1.0 runtime earlier in the classpath. Please remove the JAXB 1.0 runtime for 2.0 runtime to work correctly.
The ideal solution would be to migrate everything to JAXB2 and remove the JAXB1 dependencies, but if you have certain constrains around this (and there usually are a lot) like: time, legacy systems, too much effort to retest everythig, etc there is an easy solution to have the old code run smooth and in the same time write the new code using the latest version of JAXB.
Here are the steps you need to follow:
- Download jax1-impl-XXX.jar, where XXX is something like 2.x.x (this can be found in the JAXB2 distribution)
- Remove your old jaxb-impl.jar (version 1) from the classpath
- Add the new jaxb1-impl-XXX.jar into the classpath