0

I have WebService. I have written my own exception resolver, by extending SoapFaultMappingExceptionResolver.

Whenever I'm trying to throw exceptions, I'm getting NPE:

 java.lang.NullPointerException
   at    org.springframework.ws.server.endpoint.AbstractEndpointExceptionResolver.resolveException(AbstractEndpointExceptionResolver.java:104)

And this happens on line:

if (logger.isDebugEnabled()) {
            logger.debug("Resolving exception from endpoint [" + endpoint + "]: " + ex);
        }

Because logger is null. As I understood during debugging, this happens because mine extended ExceptionResolver is being proxied by CGLIB. CGLIB proxy has inside it copy of my resolver, but with all null fields, however, it also contains references to my actual (initialized) resolver, which looks like:

CGLIB$CALLBACK_0 = {org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor@19853} 
CGLIB$CALLBACK_1 = {org.springframework.aop.framework.CglibAopProxy$StaticUnadvisedInterceptor@19854} 

If i go inside those callback, targetSource-target, i can see my resolver with initialized properties.

So how can I fix this ?

Aleksei
  • 11
  • 2

1 Answers1

0

Well, I have found small workaround for that. I didn't want to disable proxying at all, because i need it in some cases. So, basically, you can have in your config:

<aop:aspectj-autoproxy proxy-target-class="true" />

To enable global proxying. And to fix my exception resolver, i have added it to exception list like this:

<aop:aspectj-autoproxy proxy-target-class="false">
    <aop:include name="myExceptionResolver" />
</aop:aspectj-autoproxy>
Aleksei
  • 11
  • 2
  • Actually, that didn't help me :( I thought rule will be applied only for one bean I've specified, when in reality, all proxies over project were disabled. Still looking for solution. – Aleksei Jun 10 '16 at 08:41