ffang commented on issue #365: [CXF-7520]:Ensure CXF can build with JDK9 
GA(build 9+181)
URL: https://github.com/apache/cxf/pull/365#issuecomment-357141231
 
 
   Hi @jimma 
   
   As Dan pointed out, the big issue is that your code impose compulsory 
restrictions that the CXF runtime must have jaxb-impl jar dependency. Otherwise 
 you run into ClassNotFoundException, as the class name is 
com.sun.xml.internal.bind.marshaller.CharacterEscapeHandler in JDK version but 
not com.sun.xml.bind.marshaller.CharacterEscapeHandler, the package name is 
different. In this case the DataWriter can't be created at all. I don't think 
we should introduce this compulsory dependency.
   
   So I suggest you have some static code to detect it first, something like
   
   ` static {
                      
               try {
                  DataWriterImpl.class.getClassLoader().
                       
loadClass("com.sun.xml.bind.marshaller.CharacterEscapeHandler");
                       //if no CNFE means we have saaj-impl dependeceny so in 
this case 
                      //register the customized handler
               } catch (ClassNotFoundException cnfe) {
                   LOG.debug("can't load class 
com.sun.xml.bind.marshaller.CharacterEscapeHandler", cnfe);
               }
           }
       }
    `

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to