[ 
https://issues.apache.org/jira/browse/CXF-7905?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Thorsten Hersam updated CXF-7905:
---------------------------------
    Description: 
I am having the following issue with a SOAP request of my software deployed in 
Wildfly 13.0.0.Final. Wildfly makes use of CXF core in version 
3.2.4-jbossorg-1. Of this version I was unable to find sources but my issue 
persists with any or the 3.2 versions of CXF.

The same software was previously deployed without any issues on Wildfly 
10.0.1.Final which uses CXF 3.1.6.

Upon authentification at a SOAP web service I now receive the following 
exception:

 
{code:java}
12:26:29,314 WARNING [org.apache.cxf.phase.PhaseInterceptorChain] (default 
task-1) Interceptor for 
{http://endpoint.soap.webservice.logicaldoc.com/}SoapAuthServiceService#{http://ws.logicaldoc.com}login
 has thrown exception, unwinding now: java.lang.NullPointerException
        at 
com.sun.xml.bind.v2.runtime.MarshallerImpl.setProperty(MarshallerImpl.java:518)
        at 
org.apache.cxf.common.jaxb.JAXBUtils.setEscapeHandler(JAXBUtils.java:1567)
        at 
org.apache.cxf.jaxb.io.DataWriterImpl.lambda$createMarshaller$0(DataWriterImpl.java:138)
        at 
org.apache.cxf.jaxb.JAXBDataBinding.applyEscapeHandler(JAXBDataBinding.java:271)
        at 
org.apache.cxf.jaxb.io.DataWriterImpl.createMarshaller(DataWriterImpl.java:138)
        at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:239)
        at 
{code}
jaxb MarschallerImpl fails when org.apache.cxf.common.jaxb.JAXBUtils tries to 
set an EscapeHandler of null.

 

+Possible Solution+

Adding a null check at org.apache.cxf.common.jaxb.JAXBUtils.setEscapeHandler as 
indicated below. Solves the issue.
{code:java}
public static void setEscapeHandler(Marshaller marshaller, Object 
escapeHandler) { 
     try { 
          String postFix = getPostfix(marshaller.getClass()); 
          if (postFix != null && escapeHandler != null) { 
             marshaller.setProperty("com.sun.xml" + postFix + 
".bind.characterEscapeHandler", escapeHandler); 
          } 
     } catch (PropertyException e) { 
          LOG.log(Level.INFO, "Failed to set MinumEscapeHandler to jaxb 
marshaller", e); 
     } 
}
{code}
 

While a PropertyException seems to be okay for CXF a null escapeHandler Object 
leads to escapeHandler.getClass().getName() called by jaxb MarshallerImpl just 
as it was trying to throw a PropertyException.

 

+Why is the EscapeHandler null+

A null EscapeHandler can occur when 
org.apache.cxf.common.jaxb.createEscapeHandler() actual return delegate 
ProxyHelper.getProxy() throws an Exception.

In my case a the following Exception is thrown:
{code:java}
Caused by: java.lang.IllegalArgumentException: interface 
org.apache.cxf.endpoint.Client is not visible from class loader at 
java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:581) at 
java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:557) at 
java.lang.reflect.WeakCache$Factory.get(WeakCache.java:230) at 
java.lang.reflect.WeakCache.get(WeakCache.java:127) at 
java.lang.reflect.Proxy.getProxyClass0(Proxy.java:419) at 
java.lang.reflect.Proxy.newProxyInstance(Proxy.java:719) at 
org.apache.cxf.common.util.ProxyHelper.getProxyInternal(ProxyHelper.java:49) at 
org.apache.cxf.common.util.ProxyHelper.getProxy(ProxyHelper.java:126) at 
org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:176)
 at 
org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142)
 at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:493) at 
org.jboss.wsf.stack.cxf.client.ProviderImpl$JBossWSServiceImpl.createPort(ProviderImpl.java:580)
 at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:359) at 
org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:350) at 
javax.xml.ws.Service.getPort(Service.java:99) at 
com.logicaldoc.webservice.soap.endpoint.SoapAuthServiceService.getSoapAuthServicePort(SoapAuthServiceService.java:68)
{code}
 

org.apache.cxf.endpoint.Client does not seem to be visible of the combined 
classloader constructed in ProxyHelper.getProxyInternal().

I am not utterly familiar with ClassLoaders but I find it strange that 
org.apache.cxf classes - which are calling a ProxyHelper which constructs a 
ClassLoader for "com.sun.xml.bind.marshaller.CharacterEscapeHandler" - fail 
because another org.apache.cxf interface is not visible.

 

 

  was:
I am having the following issue with a SOAP request of my software deployed in 
Wildfly 13.0.0.Final. Wildfly makes use of CXF core in version 
3.2.4-jbossorg-1. Of this version I was unable to find sources but my issue 
persists with any or the 3.2 versions of CXF.

The same software was previously deployed without any issues on Wildfly 
10.0.1.Final which uses CXF 3.1.6.

Upon authentification at a SOAP web service I now receive the following 
exception:

 
{code:java}
12:26:29,314 WARNING [org.apache.cxf.phase.PhaseInterceptorChain] (default 
task-1) Interceptor for 
{http://endpoint.soap.webservice.logicaldoc.com/}SoapAuthServiceService#{http://ws.logicaldoc.com}login
 has thrown exception, unwinding now: java.lang.NullPointerException
        at 
com.sun.xml.bind.v2.runtime.MarshallerImpl.setProperty(MarshallerImpl.java:518)
        at 
org.apache.cxf.common.jaxb.JAXBUtils.setEscapeHandler(JAXBUtils.java:1567)
        at 
org.apache.cxf.jaxb.io.DataWriterImpl.lambda$createMarshaller$0(DataWriterImpl.java:138)
        at 
org.apache.cxf.jaxb.JAXBDataBinding.applyEscapeHandler(JAXBDataBinding.java:271)
        at 
org.apache.cxf.jaxb.io.DataWriterImpl.createMarshaller(DataWriterImpl.java:138)
        at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:239)
        at 
{code}
jaxb MarschallerImpl fails when org.apache.cxf.common.jaxb.JAXBUtils tries to 
set an EscapeHandler of null.

 

+Possible Solution+

Adding a null check at org.apache.cxf.common.jaxb.JAXBUtils.setEscapeHandler as 
indicated below. Solves the issue.
{code:java}
public static void setEscapeHandler(Marshaller marshaller, Object 
escapeHandler) { 
     try { 
          String postFix = getPostfix(marshaller.getClass()); 
          if (postFix != null && escapeHandler != null) { 
             marshaller.setProperty("com.sun.xml" + postFix + 
".bind.characterEscapeHandler", escapeHandler); 
          } 
     } catch (PropertyException e) { 
          LOG.log(Level.INFO, "Failed to set MinumEscapeHandler to jaxb 
marshaller", e); 
     } 
}
{code}
 

While a PropertyException seems to be okay for CXF a null escapeHandler Object 
leads to escapeHandler.getClass().getName() called by jaxb MarshallerImpl just 
as it was trying to throw a PropertyException.

 

+Why is the EscapeHandler null+

A null EscapeHandler can occur when 
org.apache.cxf.common.jaxb.createEscapeHandler() actual return delegate 
ProxyHelper.getProxy() throws an Exception.

In my case a the following Exception is thrown:
{code:java}
Caused by: java.lang.IllegalArgumentException: interface 
org.apache.cxf.endpoint.Client is not visible from class loader at 
java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:581) at 
java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:557) at 
java.lang.reflect.WeakCache$Factory.get(WeakCache.java:230) at 
java.lang.reflect.WeakCache.get(WeakCache.java:127) at 
java.lang.reflect.Proxy.getProxyClass0(Proxy.java:419) at 
java.lang.reflect.Proxy.newProxyInstance(Proxy.java:719) at 
org.apache.cxf.common.util.ProxyHelper.getProxyInternal(ProxyHelper.java:49) at 
org.apache.cxf.common.util.ProxyHelper.getProxy(ProxyHelper.java:126) at 
org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:176)
 at 
org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142)
 at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:493) at 
org.jboss.wsf.stack.cxf.client.ProviderImpl$JBossWSServiceImpl.createPort(ProviderImpl.java:580)
 at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:359) at 
org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:350) at 
javax.xml.ws.Service.getPort(Service.java:99) at 
com.logicaldoc.webservice.soap.endpoint.SoapAuthServiceService.getSoapAuthServicePort(SoapAuthServiceService.java:68)
{code}
 

org.apache.cxf.endpoint.Client does not seem to be visible of the combined 
classloader constructed in ProxyHelper.getProxyInternal().

I am not utterly familiar with ClassLoaders but I find it strange that 
org.apache.cxf classes are calling a ProxyHelper which constructs a ClassLoader 
for "com.sun.xml.bind.marshaller.CharacterEscapeHandler" fail because another 
org.apache.cxf interface is not visible.

 

 


> JAXBUtils fails to setEscapeHandler due to null escapeHandler
> -------------------------------------------------------------
>
>                 Key: CXF-7905
>                 URL: https://issues.apache.org/jira/browse/CXF-7905
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 3.2
>            Reporter: Thorsten Hersam
>            Assignee: Freeman Fang
>            Priority: Major
>
> I am having the following issue with a SOAP request of my software deployed 
> in Wildfly 13.0.0.Final. Wildfly makes use of CXF core in version 
> 3.2.4-jbossorg-1. Of this version I was unable to find sources but my issue 
> persists with any or the 3.2 versions of CXF.
> The same software was previously deployed without any issues on Wildfly 
> 10.0.1.Final which uses CXF 3.1.6.
> Upon authentification at a SOAP web service I now receive the following 
> exception:
>  
> {code:java}
> 12:26:29,314 WARNING [org.apache.cxf.phase.PhaseInterceptorChain] (default 
> task-1) Interceptor for 
> {http://endpoint.soap.webservice.logicaldoc.com/}SoapAuthServiceService#{http://ws.logicaldoc.com}login
>  has thrown exception, unwinding now: java.lang.NullPointerException
>       at 
> com.sun.xml.bind.v2.runtime.MarshallerImpl.setProperty(MarshallerImpl.java:518)
>       at 
> org.apache.cxf.common.jaxb.JAXBUtils.setEscapeHandler(JAXBUtils.java:1567)
>       at 
> org.apache.cxf.jaxb.io.DataWriterImpl.lambda$createMarshaller$0(DataWriterImpl.java:138)
>       at 
> org.apache.cxf.jaxb.JAXBDataBinding.applyEscapeHandler(JAXBDataBinding.java:271)
>       at 
> org.apache.cxf.jaxb.io.DataWriterImpl.createMarshaller(DataWriterImpl.java:138)
>       at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:239)
>       at 
> {code}
> jaxb MarschallerImpl fails when org.apache.cxf.common.jaxb.JAXBUtils tries to 
> set an EscapeHandler of null.
>  
> +Possible Solution+
> Adding a null check at org.apache.cxf.common.jaxb.JAXBUtils.setEscapeHandler 
> as indicated below. Solves the issue.
> {code:java}
> public static void setEscapeHandler(Marshaller marshaller, Object 
> escapeHandler) { 
>      try { 
>           String postFix = getPostfix(marshaller.getClass()); 
>           if (postFix != null && escapeHandler != null) { 
>              marshaller.setProperty("com.sun.xml" + postFix + 
> ".bind.characterEscapeHandler", escapeHandler); 
>           } 
>      } catch (PropertyException e) { 
>           LOG.log(Level.INFO, "Failed to set MinumEscapeHandler to jaxb 
> marshaller", e); 
>      } 
> }
> {code}
>  
> While a PropertyException seems to be okay for CXF a null escapeHandler 
> Object leads to escapeHandler.getClass().getName() called by jaxb 
> MarshallerImpl just as it was trying to throw a PropertyException.
>  
> +Why is the EscapeHandler null+
> A null EscapeHandler can occur when 
> org.apache.cxf.common.jaxb.createEscapeHandler() actual return delegate 
> ProxyHelper.getProxy() throws an Exception.
> In my case a the following Exception is thrown:
> {code:java}
> Caused by: java.lang.IllegalArgumentException: interface 
> org.apache.cxf.endpoint.Client is not visible from class loader at 
> java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:581) at 
> java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:557) at 
> java.lang.reflect.WeakCache$Factory.get(WeakCache.java:230) at 
> java.lang.reflect.WeakCache.get(WeakCache.java:127) at 
> java.lang.reflect.Proxy.getProxyClass0(Proxy.java:419) at 
> java.lang.reflect.Proxy.newProxyInstance(Proxy.java:719) at 
> org.apache.cxf.common.util.ProxyHelper.getProxyInternal(ProxyHelper.java:49) 
> at org.apache.cxf.common.util.ProxyHelper.getProxy(ProxyHelper.java:126) at 
> org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:176)
>  at 
> org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142)
>  at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:493) at 
> org.jboss.wsf.stack.cxf.client.ProviderImpl$JBossWSServiceImpl.createPort(ProviderImpl.java:580)
>  at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:359) at 
> org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:350) at 
> javax.xml.ws.Service.getPort(Service.java:99) at 
> com.logicaldoc.webservice.soap.endpoint.SoapAuthServiceService.getSoapAuthServicePort(SoapAuthServiceService.java:68)
> {code}
>  
> org.apache.cxf.endpoint.Client does not seem to be visible of the combined 
> classloader constructed in ProxyHelper.getProxyInternal().
> I am not utterly familiar with ClassLoaders but I find it strange that 
> org.apache.cxf classes - which are calling a ProxyHelper which constructs a 
> ClassLoader for "com.sun.xml.bind.marshaller.CharacterEscapeHandler" - fail 
> because another org.apache.cxf interface is not visible.
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to