Wildfly 20 升级和 OpenJRE 8 – 在模块路径或类路径上找不到 JAXB-API 的实现

huangapple go评论73阅读模式
英文:

Wildfly 20 Upgrade and OpenJRE 8 - Implementation of JAXB-API has not been found on module path or classpath

问题

我们正在使用 openjre-8.0.252.09-hotspot,从 Wildfly 10 升级到 Wildfly 20,在此过程中遇到了以下问题,尽管:

  • jaxb-impl-2.1.13.jar 已经存在于 WEB-INF\lib 中
  • rt.jar(在 openjre 中)包含:com.sun.xml.internal.bind.v2.ContextFactory

我尝试了以下操作,但并未成功:

  1. 将 jaxb-api-2.1.jar 添加到 lib 中。
  2. 使用 openjdk 替代 openjre。

为什么应用程序无法找到已经存在于 rt.jar 中的 com.sun.xml.internal.bind.v2.ContextFactory 类?
还有其他我遗漏的内容吗?
我尝试过搜索,但所有答案都与 Java 9 及以上版本有关,而与 openjre-8 无关。

错误信息:

Caused by: javax.xml.bind.JAXBException: 在模块路径或类路径上找不到 JAXB-API 的实现。
 - 附带链接的异常:
[java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory 来自 [模块“deployment.myproject.war” 来自服务模块加载程序]]
	at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:155)
	at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:141)
	at javax.xml.bind.ContextFinder.find(ContextFinder.java:314)
	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:478)
	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:435)
	at org.apache.camel.spring.handler.CamelNamespaceHandler.createJaxbContext(CamelNamespaceHandler.java:187)
英文:

We are using openjre-8.0.252.09-hotspot, upgraded from Wildfly 10 to Wildfly 20, and started facing following issue, although:

  • jaxb-impl-2.1.13.jar is already present in WEB-INF\lib
  • rt.jar (in openjre) has: com.sun.xml.internal.bind.v2.ContextFactory

I have tried adding the following which did not work:

  1. jaxb-api-2.1.jar to the lib.
  2. used openjdk instead of openjre

Why is the application not able to find the com.sun.xml.internal.bind.v2.ContextFactory class which is already present in rt.jar ?
Is there something else that I am missing ?
I tried searching, but all the answers are related to java 9 and above, but no answers fro openjre-8.

Error:

Caused by: javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
 - with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory from [Module "deployment.myproject.war" from Service Module Loader]]
	at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:155)
	at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:141)
	at javax.xml.bind.ContextFinder.find(ContextFinder.java:314)
	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:478)
	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:435)
	at org.apache.camel.spring.handler.CamelNamespaceHandler.createJaxbContext(CamelNamespaceHandler.java:187)

答案1

得分: 0

RootCause:
应用程序的WebInf/lib中有一个jar文件,其中的jaxb.properties文件包含以下条目:
javax.xml.bind.context.factory=com.sun.xml.internal.bind.v2.ContextFactory

删除此条目解决了此问题。

英文:

RootCause:
One of the jar in application's WebInf/lib had jaxb.properties which had following entry:
javax.xml.bind.context.factory=com.sun.xml.internal.bind.v2.ContextFactory

Removing this resolved the issue.

huangapple
  • 本文由 发表于 2020年9月21日 16:21:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/63988580.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定