Loading Java classes is a mess, sorry. The main reason is that there are no strong names like those in the .NET world, and therefore the runtime linker accepts any match, primarily in the classpath, regardless of whether there was a version of the library with which it was compiled code. The OSGi system solves this problem, but it never received the usual adoption.
The error message you specified is:
java.lang.LinkageError: JAXB 2.1 API is loaded from bootstrap bootloader, but API 2.2 is required for this RI.
uncharacteristically useful and specific, in most cases, what happens instead, you should look at NoSuchMethodError or something like that. Over time, you will learn to recognize them as inconsistencies in the library version. In this case, the author (s) of the library wrote the code to recognize the general case of an error and print the best error message (bless).
Repeat, here is some information that I hope will set you on the correct track:
- Java class loaders are hierarchical, and resolution is from bottom to top
- but there is a blissful class loader at the root of the hierarchy responsible for loading the main runtime library.
- The shenanigans vendors have led many to get into the main runtime library, which really shouldn't have been there, as it is a shortcut to becoming dominant in the Darwinist selection process. JAXB is one of these things as you just found out. JAXB2 is actually pretty decent, but it develops regardless of the main runtime and, well, here we are.
- The JDK and JRE installation has a folder called
lib\endorsed , where you can add JAR files that must be loaded by the root loader, bypassing even what is in rt.jar .
In general, if you manually add the version of the JAXB library version 2.2 to %JAVA_HOME%\lib\endorsed , then it should override version 2.1 of the version and your web service client will be deployed. This should happen on every system that starts the web service client until the JDK is upgraded to version 7.x, which includes JAXB 2.2. If the same JVM runs other JAXB-based applications, they may or may not be damaged as a result.
Yes, it hurts. The tangent you can explore is the intentional use of the old version of Metro built for JAXB 2.1. As long as you are tied to the deployment on 1.6.0_03 , this may be the best option, even though some of the latest Metro improvements have been lost.
Updated: here 's a blog post on this topic. It contains some links to additional information.