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

Gaurav

While using JAXB in JBoss, I am getting below exception while executing the code:

  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?

Gaurav

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.

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

and by importing org.eclipse.persistence.jaxb.JAXBContextFactory class.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

JDK 1.8 JAXB: Provider com.sun.xml.bind.v2.ContextFactory not found

From Dev

JDK 1.8 JAXB: Provider com.sun.xml.bind.v2.ContextFactory not found

From Dev

ClassCastException: Cannot be cast to com.sun.xml.internal.bind.v2.runtime.reflect.Accessor

From Dev

NoClassDefFoundError: Could not initialize class com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl

From Dev

JAXB umarshalling NumberFormatException Not a number: 2.444 at com.sun.xml.bind.DatatypeConverterImpl._parseInt(DatatypeConverterImpl.java:132)

From Dev

Caused by: java.lang.ClassNotFoundException: com.sun.xml.bind.v2.model.annotation.AnnotationReader

From Dev

Exception by com.sun.istack.SAXException2 AND javax.xml.bind.JAXBException

From Dev

JBOSS AS 7 Database internal

From Dev

javax.xml.bind.JAXBException: property "com.sun.xml.bind.defaultNamespaceRemap" is not supported

From Dev

JBoss EAP 6.4/7 - Spring Boot Application's internal log4j2.xml configuration not printing on console

From Dev

error: cannot access ListViewCompat class file for android.support.v7.internal.widget.ListViewCompat not found

From Dev

Where do I get the source code for com.sun.xml.internal package?

From Dev

package com.sun.xml.internal.messaging.saaj.soap.dynamic does not exist

From Dev

How to solve com.sun.org.apache.xml.internal.security package does not exist in netbean javafx application

From Dev

java.lang.NoSuchMethodError: com.sun.xml.internal.ws.api.message.Message.getHeaders

From Dev

com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Error during saving a multipart message

From Dev

Wsimport on OSX -> NoClassDefFoundError: com/sun/xml/internal/ws/util/localization/LocalizableMessageFactory

From Java

javax.xml.bind.JAXBException Implementation of JAXB-API has not been found on module path or classpath

From Dev

NoClassDefFoundError: Unable to load class groovy.xml.jaxb.JaxbGroovyMethods due to missing dependency javax/xml/bind/Unmarshaller

From Dev

JAXB class not found with ForkJoinPool Java

From Dev

JAXB class not found with ForkJoinPool Java

From Dev

GoogleMap V2 error android.view.InflateException: Binary XML file line #7: Error inflating class fragment

From Dev

JAX-RPC com.sun.xml.rpc.client.BasicService Not Found

From Dev

Compiler Error : com.sun.tools.javac.code.Symbol$CompletionFailure: class file for rx.Observable not found

From Dev

HIPI compile fail: class file for com.sun.image.codec.jpeg.JPEGDecodeParam not found

From Dev

No message body writer has been found for response class ArrayList [jboss 7]

From Dev

JBoss EAP 7 => ClassCastException: org.apache.jcp.xml.dsig.internal.dom.DOMReference cannot be cast to org.jcp.xml.dsig.internal.dom.DOMReference

From Dev

MOXy JAXB javax.xml.bind.PropertyException

From Dev

Connecting to webservice results in com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 200: OK

Related Related

  1. 1

    JDK 1.8 JAXB: Provider com.sun.xml.bind.v2.ContextFactory not found

  2. 2

    JDK 1.8 JAXB: Provider com.sun.xml.bind.v2.ContextFactory not found

  3. 3

    ClassCastException: Cannot be cast to com.sun.xml.internal.bind.v2.runtime.reflect.Accessor

  4. 4

    NoClassDefFoundError: Could not initialize class com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl

  5. 5

    JAXB umarshalling NumberFormatException Not a number: 2.444 at com.sun.xml.bind.DatatypeConverterImpl._parseInt(DatatypeConverterImpl.java:132)

  6. 6

    Caused by: java.lang.ClassNotFoundException: com.sun.xml.bind.v2.model.annotation.AnnotationReader

  7. 7

    Exception by com.sun.istack.SAXException2 AND javax.xml.bind.JAXBException

  8. 8

    JBOSS AS 7 Database internal

  9. 9

    javax.xml.bind.JAXBException: property "com.sun.xml.bind.defaultNamespaceRemap" is not supported

  10. 10

    JBoss EAP 6.4/7 - Spring Boot Application's internal log4j2.xml configuration not printing on console

  11. 11

    error: cannot access ListViewCompat class file for android.support.v7.internal.widget.ListViewCompat not found

  12. 12

    Where do I get the source code for com.sun.xml.internal package?

  13. 13

    package com.sun.xml.internal.messaging.saaj.soap.dynamic does not exist

  14. 14

    How to solve com.sun.org.apache.xml.internal.security package does not exist in netbean javafx application

  15. 15

    java.lang.NoSuchMethodError: com.sun.xml.internal.ws.api.message.Message.getHeaders

  16. 16

    com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Error during saving a multipart message

  17. 17

    Wsimport on OSX -> NoClassDefFoundError: com/sun/xml/internal/ws/util/localization/LocalizableMessageFactory

  18. 18

    javax.xml.bind.JAXBException Implementation of JAXB-API has not been found on module path or classpath

  19. 19

    NoClassDefFoundError: Unable to load class groovy.xml.jaxb.JaxbGroovyMethods due to missing dependency javax/xml/bind/Unmarshaller

  20. 20

    JAXB class not found with ForkJoinPool Java

  21. 21

    JAXB class not found with ForkJoinPool Java

  22. 22

    GoogleMap V2 error android.view.InflateException: Binary XML file line #7: Error inflating class fragment

  23. 23

    JAX-RPC com.sun.xml.rpc.client.BasicService Not Found

  24. 24

    Compiler Error : com.sun.tools.javac.code.Symbol$CompletionFailure: class file for rx.Observable not found

  25. 25

    HIPI compile fail: class file for com.sun.image.codec.jpeg.JPEGDecodeParam not found

  26. 26

    No message body writer has been found for response class ArrayList [jboss 7]

  27. 27

    JBoss EAP 7 => ClassCastException: org.apache.jcp.xml.dsig.internal.dom.DOMReference cannot be cast to org.jcp.xml.dsig.internal.dom.DOMReference

  28. 28

    MOXy JAXB javax.xml.bind.PropertyException

  29. 29

    Connecting to webservice results in com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 200: OK

HotTag

Archive