I am using wildfly-8.2.1.Final (which supplies \wildfly-8.2.1.Final\modules\system\layers\base\com\sun\xml\bind\main\jaxb-impl-2.2.5.jboss-2.jar which contains MarshallerImpl which indirectly implements javax.xml.bind.Marshaller).
On decompilation, I found that all the implementations of com.sun.xml.bind.marshaller.CharacterEscapeHandler does the following:
Input: <![CDATA[012abcdef]]>;**
Output: <![CDATA[012<cr>abc</cr>def]]>
So, to avoid conversion, I tried to use the following
I added following to org.springframework.oxm.jaxb.Jaxb2Marshaller
properties.put(CharacterEscapeHandler.class.getName(),
new CharacterEscapeHandler() {
public void escape(char[] ac, int i, int j, boolean flag,
Writer writer) throws IOException {
writer.write(ac, i, j);
}
});
When I deploy the code & the start the Wildfly Server, I get the following error:
Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageReceiver' defined in class path resource [spring/SpringWs-servlet.xml]: Cannot resolve reference to bean 'exceptionResolver' while setting bean property 'endpointExceptionResolvers' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'exceptionResolver' defined in class path resource [spring/SpringWs-servlet.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested
PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'marshaller' threw exception; nested exception is java.lang.NoClassDefFoundError: com/sun/xml/internal/bind/marshaller/CharacterEscapeHandler
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) [spring-beans-4.0.1.RELEASE.jar:4.0.1.RELEASE]