Pavana Sai Mahathi Vavilala created TOMEE-2884:
--------------------------------------------------

             Summary: Upgrade JAXB-Ri to latest version (2.3.1)
                 Key: TOMEE-2884
                 URL: https://issues.apache.org/jira/browse/TOMEE-2884
             Project: TomEE
          Issue Type: Improvement
          Components: TomEE Core Server
    Affects Versions: 7.0.8, 7.0.7
            Reporter: Pavana Sai Mahathi Vavilala
         Attachments: Log.txt

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:
{code:java}
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
{code}
Finally, we tried the below workaround as suggested 
[here|http://mail-archives.apache.org/mod_mbox/tomcat-users/201807.mbox/%3cb1ca948e-f8d3-5c5e-9aaf-0c8c6c9f8...@christopherschultz.net%3e].

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

*It would be nice if latest JAXB-Ri is included in TomEE so that we don't have 
to apply the above workaround.*



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to