In Tomcat, java.lang.LinkageError: JAXB 2.1 API is

2020-02-02 01:06发布

I am trying to load my webapp into Tomcat. It seems to be complaining that it has an older version of a JAR than my application. Should I remove that older JAR, use a newer version of Java, edit the bootstrap classloader (how?) or what?

Message: JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%205.5/webapps/SkillsDB/WEB-INF/lib/jaxb-impl.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class) needs 2.2 API. Use the endorsed directory mechanism to place jaxb-api.jar in the bootstrap classloader. (See http://java.sun.com/j2se/1.6.0/docs/guide/standards/)

Caused by: Executing action [getDocx] of controller [FormattedDocumentController] caused exception: java.lang.LinkageError: JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%205.5/webapps/SkillsDB/WEB-INF/lib/jaxb-impl.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class) needs 2.2 API. Use the endorsed directory mechanism to place jaxb-api.jar in the bootstrap classloader. (See http://java.sun.com/j2se/1.6.0/docs/guide/standards/)

3条回答
爱情/是我丢掉的垃圾
2楼-- · 2020-02-02 01:56

I don't know exactly why, but I solved it in following way.

I realized Tomcat was using a JVM (jre1.6.0_03) that was not the default one (jre1.6.0_26, in folder C:\Program Files\Java\jre6).

So I stopped Tomcat, launched the program "Configure Tomcat", in "Java" tabsheet chose "Use default" and then started again Tomcat.

查看更多
小情绪 Triste *
3楼-- · 2020-02-02 02:01

Put your JAXB 2.2 JARs in folder, you need first find out where this folder is using this:

System.out.println(System.getProperty("java.endorsed.dirs"));

Mine was d:\Tomcat 7.0\endorsed

查看更多
够拽才男人
4楼-- · 2020-02-02 02:07

Put your JAXB 2.2 JARs in

%JAVA_HOME%\lib\endorsed

It should work.

If your Java is installed in

C:\Program Files\Java

then you should put JAXB 2.2 JARs in:

C:\Program Files\Java\lib\endorsed

directory.

查看更多
登录 后发表回答