Uploaded image for project: 'TomEE'
  1. TomEE
  2. TOMEE-2884

Upgrade packaged JAXB-Ri to its latest version (2.3.1)

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 7.0.7, 7.0.8
    • Fix Version/s: None
    • Component/s: TomEE Core Server
    • Labels:
      None

      Description

      It would be nice if latest JAXB-Ri is included in TomEE so that we don't have to apply a workaround for the below issue:

      Issue: Processing multiline text (\n or carriage return) using the JAXB APIs in TomEE fails with the exception "Marshalling Error: Entity References are not allowed in SOAP documents". 

      Please refer to the attachment for full exception stack trace: Log.txt

      This issue is reproducible with JDK (11 or later) versions which do not include JAXB.
      The following JDK bugs are relatable to this issue:
      https://bugs.openjdk.java.net/browse/JDK-8196491
      https://bugs.java.com/view_bug.do?bug_id=8196491
      TomEE bundles JAXB-Ri 2.3.0 (jaxb-api-2.3.0.jar, jaxb-core-2.3.0.jar, and jaxb-impl-2.3.0.jar) which apparently is also affected by the aforementioned bugs.

      Our Product uses this bundled version of JAXB at runtime to process user data.
      To overcome this issue, we tried to override these jars with those from 2.3.1 distribution by including then in our webapp classpath. However it didnt work, and generated the following exception:

      Caused by: javax.xml.bind.JAXBException: ClassCastException: attempting to cast jar:file:<Custom-Application-Path>/WEB-INF/lib/jaxb-api.jar!/javax/xml/bind/JAXBContext.class to jar:file:<TomEE-Installation-Path>/lib/jaxb-api-2.3.0.jar!/javax/xml/bind/JAXBContext.class.  Please make sure that you are specifying the proper ClassLoader.    
      	at javax.xml.bind.ContextFinder.handleClassCastException(ContextFinder.java:157)
      	at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:300)
      	at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:286)
      	at javax.xml.bind.ContextFinder.find(ContextFinder.java:409)
      	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:721)
      	at org.apache.cxf.common.jaxb.JAXBContextCache$2.run(JAXBContextCache.java:347)
      	at org.apache.cxf.common.jaxb.JAXBContextCache$2.run(JAXBContextCache.java:345)
      	at java.base/java.security.AccessController.doPrivileged(Native Method)
      	at org.apache.cxf.common.jaxb.JAXBContextCache.createContext(JAXBContextCache.java:345)
      	at org.apache.cxf.common.jaxb.JAXBContextCache.getCachedContextAndSchemas(JAXBContextCache.java:246)
      	at org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContextAndSchemas(JAXBDataBinding.java:475)
      	at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:330)
      	... 73 more
      

      Finally, we tried the below workaround as suggested here.

      Workaround:
      When we replaced 2.3.0 jars with latest 2.3.1 jars, the issue was no longer observed.

        Attachments

        1. Log.txt
          7 kB
          Pavana Sai Mahathi Vavilala

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Mahathi Vavilala Pavana Sai Mahathi Vavilala
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: