Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging issue in Spring proxy

Tags:

java

spring

So, I'm trying to fix a bug on a fairly complex Spring based webapp. The bug is a NullPointer Exception, but, rather unhelpfully, it's not returning a stacktrace or anything similarly helpful to let me know exactly where it is occurring.

Stepping through the execution of the programme with IntelliJ shows that the exception is occurring in a Spring Proxy object: $Proxy338 , but doesn't show the proxy code.

I'm sorry for being so vague: The error reporting on this bug is pretty unhelpful. Any suggestions for how I should proceed from here would be welcome: should I be looking for AOP/transaction code which is producing the failing proxy? Is there more information I could gather with IntelliJ which would let me pinpoint exactly what is going on?

like image 305
RoryB Avatar asked Oct 28 '25 10:10

RoryB


1 Answers

You could also try retrieving the proxied object to see where exactly the NullPointerExeption is thrown.

To get the proxied object:

((Advised)yourProxy).getTargetSource().getTarget();
like image 57
kyiu Avatar answered Oct 30 '25 00:10

kyiu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!