How to get method signature in Spring exception handler? - spring

I have a global exception handler configured in my environment where i get only the exception stack trace. But now I need to get method signature and an arguments passed to that method where exception has occurred.
Any help is appreciated.

Related

Custom Exception handling in spring boot

I have 2 filters running ,Not using controller Advice for exception handling
Catching exceptions in Filter but when I throw customized exception for ex ,UserNotAllowedException ,Filter catches NestedServletException ,Let me know If anybody has any idea on why is it happening.

Groovy: When I debuging object is not null

I have some problem with groovy. Sometimes when script is executed then exception NullPointerException is thrown but allways when I debugging the script the exception is no occurred. It looks like that my object sometimes is not created in time and Groovy try execute method on it. Someone have idea what could be the reason of problem:
Below is mentioned exception:
Caused by: java.lang.NullPointerException: Cannot invoke method getService() on null object.

OSGi DS: Why are exceptions thrown by binding methods only logged?

Why is it spec to only log an exception thrown from a binding method?
I would expect that the component would not activate in this case.
How should exceptions thrown from binding methods be handled to ensure the component is set up correctly?
Just because the binding of a service reference throws an exception does not necessarily mean the component cannot be activated. Since the component is aware of the exception (after all, it's the binding method that threw it), it can be implemented in such a way that it can still be activated, e.g. by falling back on a default value or by providing limited services.
Binding methods should not throw any exception anyway, unlike activation methods that can make the activation fail.
Reference:
OSGi 112.5.7: "If a bind method throws an exception, SCR must log an error message containing the exception with the Log Service, if present, but the activation of the component configuration does not fail."

flex blazeds spring exception translator

I am using spring exception translator to wrap java exception into flex exception.
public void testException()throws Exception{
throw new Exception("my exception");
}
But for some reason, I am getting IllegalAccessError. The code sections are entering the testException and the Translator class.
Question:
Why it trying to get log target level? Can someone help me resolve this please.
Below is the lines from the log:
MyExceptionTranslatorImpl.translate()
class java.lang.IllegalAccessError
MyExceptionTranslatorImpl.translate()
java.lang.IllegalAccessError: tried to access method **flex.messaging.log.Log.getTargetLevel()S** from class flex.messaging.MessageException
MyExceptionTranslatorImpl.translate()
tried to access method
flex.messaging.log.Log.getTargetLevel()S from class flex.messaging.MessageException
[BlazeDS] tried to access method flex.messaging.log.Log.getTargetLevel()S from class flex.messaging.MessageException
[BlazeDS] Serializing AMF/HTTP response
This turned out to be mismatch in jars. Thank you Cornel Creanga for the initial response.
I also verified that throwing an java.lang.exception was enough to catch the error on the client side.

UndeclaredThrowableException due to SQLException in Spring + iBatis?

I am getting the following exception when I typo the SQL driver name or the database server is offline, basically any SQLException.
I can't determine where the UndeclaredThrowableException is coming from. Line 194 in SqlMapClientTemplate is this:
logger.debug("Obtained JDBC Connection [" + springCon + "] for iBATIS operation");
Here is the trace:
java.lang.reflect.UndeclaredThrowableException
$Proxy59.toString(Unknown Source)
java.lang.String.valueOf(Unknown Source)
java.lang.StringBuffer.append(Unknown Source)
org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:194)
org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult(SqlMapClientTemplate.java:249)
org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:296)
org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:290)
some of my reading points to some type of class loading problem? I can't figure out where the $Proxy is getting introduced?
The $Proxy59 class must be the type of the springCon variable. It is a JDK proxy type, probably introduced by the Spring framework, as a wrapper for the real connection. I know of a pooled connection provider that returns connections which suppress the close() method via a proxy (because the connection is pooled, calling close is not the client's task).
Maybe the proxy's handler for the toString() method throws a checked exception, which is possible with the proxy mechanics, but not allowed.
The Java Documentation says:
"If a checked exception is thrown by invoke that is not assignable to any of the exception types declared in the throws clause of the interface method, then an UndeclaredThrowableException will be thrown by the method invocation on the proxy instance. The UndeclaredThrowableException will be constructed with the exception that was thrown by the invoke method."
Do you get any other exception logged, maybe directly before that, or mentioned as the exception cause?

Resources