0

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]
Community
  • 1
  • 1
lab bhattacharjee
  • 1,617
  • 2
  • 17
  • 33
  • 1
    Well that looks like you're missing a jar file... – Jon Skeet Apr 12 '17 at 13:06
  • @JonSkeet, CharacterEscapeHandler is part of rt.jar. This approach worked nicely in a standalone application. In the standalone application, I observed that CharacterEscapeHandler (though part of rt.jar) has been loaded by the Application ClassLoader. So, I afraid this problem in JBoss Wildfly is due to classloaders responsible for loading (1) classes in my deployed ear and (2) CharacterEscapeHandler class – lab bhattacharjee Apr 12 '17 at 18:21

0 Answers0