简体   繁体   English

在 JBoss AS 7 中找不到 JAXB com.sun.xml.internal.bind.v2.ContextFactory 类

[英]JAXB com.sun.xml.internal.bind.v2.ContextFactory Class Not Found in JBoss AS 7

While using JAXB in JBoss, I am getting below exception while executing the code:在 JBoss 中使用 JAXB 时,我在执行代码时遇到以下异常:

  JAXBContext   jaxbContext   = JAXBContext.newInstance( jaxbElement.getClass().getPackage().getName() );

Exception which i am getting is:我得到的例外是:

[java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory from [Module "deployment.project.ear.subproject-jboss.jar:main" from Service Module Loader]]
    at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:156) [jboss-jaxb-api_2.2_spec-1.0.4.Final-redhat-3.jar:1.0.4.Final-redhat-3]
    at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:108) [jboss-jaxb-api_2.2_spec-1.0.4.Final-redhat-3.jar:1.0.4.Final-redhat-3]
    at javax.xml.bind.ContextFinder.find(ContextFinder.java:258) [jboss-jaxb-api_2.2_spec-1.0.4.Final-redhat-3.jar:1.0.4.Final-redhat-3]
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:412) [jboss-jaxb-api_2.2_spec-1.0.4.Final-redhat-3.jar:1.0.4.Final-redhat-3]
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:375) [jboss-jaxb-api_2.2_spec-1.0.4.Final-redhat-3.jar:1.0.4.Final-redhat-3]
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:279) [jboss-jaxb-api_2.2_spec-1.0.4.Final-redhat-3.jar:1.0.4.Final-redhat-3]

It looks like JBoss JAXB module is loading instead of JDK and this is the reason of exception, however I am not sure how to solve this error?看起来 JBoss JAXB 模块正在加载而不是 JDK,这是异常的原因,但是我不知道如何解决这个错误?

Finally i solved it by changing default context factory to eclipse link context factory, but not sure why it does not worked with default one.最后,我通过将默认上下文工厂更改为 eclipse 链接上下文工厂来解决它,但不确定为什么它不适用于默认上下文工厂。

  JAXBContext jaxbContext = JAXBContextFactory.createContext(  clss.getPackage().getName() , clss.getClass().getClassLoader());

and by importing org.eclipse.persistence.jaxb.JAXBContextFactory class.并通过导入org.eclipse.persistence.jaxb.JAXBContextFactory类。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 警告:未找到提供程序 com.sun.xml.internal.bind.v2.ContextFactory - WARNING: Provider com.sun.xml.internal.bind.v2.ContextFactory not found java.lang.ClassNotFoundException:com.sun.xml.internal.bind.v2.ContextFactory - java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory 在jira中使用jaxb api失败的java类:提供者com.sun.xml.bind.v2.ContextFactory未找到 - java class using jaxb api failing in jira with : Provider com.sun.xml.bind.v2.ContextFactory not found JDK 1.8 JAXB:未找到提供程序com.sun.xml.bind.v2.ContextFactory - JDK 1.8 JAXB: Provider com.sun.xml.bind.v2.ContextFactory not found CQ5.6.1中的JAXB-找不到com.sun.xml.bind.ContextFactory_1_0_1 - JAXB in CQ5.6.1 - com.sun.xml.bind.ContextFactory_1_0_1 not found ClassNotFoundException com.sun.xml.bind.ContextFactory Jaxb-Impl - ClassNotFoundException com.sun.xml.bind.ContextFactory Jaxb-Impl 具有JDK7问题的JAXB-com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException:1个IllegalAnnotationExceptions计数 - JAXB with JDK7 Issue - com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions Intershop studio 4.20.0 - compileJava - ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory - Intershop studio 4.20.0 - compileJava - ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory java.lang.ClassNotFoundException:com.sun.xml.bind.v2.ContextFactory - java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory javax.xml.bind.JAXBException [java.lang.ClassNotFoundException: com.sun.xmldk.bind.52Factory] - javax.xml.bind.JAXBException [java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory] in jdk1.5
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM