提问人:Harsh Raj 提问时间:11/10/2023 更新时间:11/10/2023 访问量:52
JAXB ClassNotFoundException:Java 17 中的 com.sun.xml.bind.v2.ContextFactory 错误
JAXB ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory error in Java 17
问:
我已经将一个库(基于 java 11 构建)添加到我现有的项目(java 17)中,添加它后,服务器拒绝启动并出现以下错误。我尝试添加 jaxb API 和运行时,但仍然遇到完全相同的错误。我还添加了一个带有内容的jaxb.properties文件,但它没有帮助。javax.xml.bind.JAXBContextFactory=com.sun.xml.bind.v2.ContextFactory
javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:278) ~[jaxb-api-2.3.1.jar:2.3.0]
at javax.xml.bind.ContextFinder.find(ContextFinder.java:397) ~[jaxb-api-2.3.1.jar:2.3.0]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:721) ~[jaxb-api-2.3.1.jar:2.3.0]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:662) ~[jaxb-api-2.3.1.jar:2.3.0]
at com.companyframework.configuration.impl.FwConfigurationService$FwJaxbParser.parseJaxbData(FwConfigurationService.java:282) ~[extra-configuration-9.10.2.jar:9.10.2]
at com.companyframework.configuration.impl.FwConfigurationService$FwJaxbParser.parseCompleted(FwConfigurationService.java:265) ~[extra-configuration-9.10.2.jar:9.10.2]
at com.companyframework.configuration.impl.FwConfigurationImpl.parseCfg(FwConfigurationImpl.java:708) ~[extra-configuration-9.10.2.jar:9.10.2]
at com.companyframework.configuration.impl.FwConfigurationImpl.uploadConfigurationInternal(FwConfigurationImpl.java:670) ~[extra-configuration-9.10.2.jar:9.10.2]
at com.companyframework.configuration.impl.FwConfigurationImpl.uploadConfiguration(FwConfigurationImpl.java:757) ~[extra-configuration-9.10.2.jar:9.10.2]
at com.companyframework.configuration.impl.FwConfigurationService$FwJaxbParser.upload(FwConfigurationService.java:223) ~[extra-configuration-9.10.2.jar:9.10.2]
at com.companyframework.configuration.impl.FwConfigurationService.getConfiguree(FwConfigurationService.java:95) ~[extra-configuration-9.10.2.jar:9.10.2]
at com.companyframework.core.CoreConfig.parse(CoreConfig.java:228) ~[extra-core-9.10.2.jar:9.10.2]
at com.companyframework.core.CoreConfig.<init>(CoreConfig.java:137) ~[extra-core-9.10.2.jar:9.10.2]
at com.companyframework.boot.FwContext.createConfig(FwContext.java:217) ~[extra-core-9.10.2.jar:9.10.2]
at com.companyframework.boot.FwContext.<init>(FwContext.java:102) ~[extra-core-9.10.2.jar:9.10.2]
at com.companyframework.boot.Startextra.startFW(Startextra.java:10) ~[extra-core-9.10.2.jar:9.10.2]
at com.companyrtc.sdk.server.serverstart.StartServer.startFramework(StartServer.java:109) ~[ABC-core-sdk-server-sdk-113.0.0-SNAPSHOT.jar:?]
at com.companyrtc.sdk.server.serverstart.StartServer.startServer(StartServer.java:71) ~[ABC-core-sdk-server-sdk-113.0.0-SNAPSHOT.jar:?]
at com.companyrtc.sdk.server.serverstart.StartServer.startStandaloneServer(StartServer.java:58) ~[ABC-core-sdk-server-sdk-113.0.0-SNAPSHOT.jar:?]
at com.companymarketdata.companyengine.companyengine.main(companyengine.java:78) ~[main/:?]
Caused by: java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory
at jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[?:?]
at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:525) ~[?:?]
at javax.xml.bind.ServiceLoaderUtil.nullSafeLoadClass(ServiceLoaderUtil.java:122) ~[jaxb-api-2.3.1.jar:2.3.0]
at javax.xml.bind.ServiceLoaderUtil.safeLoadClass(ServiceLoaderUtil.java:155) ~[jaxb-api-2.3.1.jar:2.3.0]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:276) ~[jaxb-api-2.3.1.jar:2.3.0]
... 19 more
我添加的依赖项-
jaxbApi = [group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1']
jaxbImpl236 = [group: 'com.sun.xml.bind', name: 'jaxb-impl', version: '2.3.6']
我搜索了所有现有的答案并尝试实施它们,但这没有帮助。我还为 JAXB 尝试了不同变体的罐子,但到目前为止没有运气。
答: 暂无答案
评论