Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JAMON Spring unable to monitor exceptions  RSS feed

 
gagan patil
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
I am currently working on integrating JAMON version 2.76 in our existing application

following are details of environment
JDK 1.5
Server weblogic 9.2
OS windows
Spring version 2.5


first we have added following entry for jamon monitor




then added this interceptor as preinterceptor in existing



currently we can able to monitor all calls given to this class but whenever any exception thrown in this class hierarchy we are not able to track it on exceptions.jsp of JAMON

 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unfortunately Springs JamonPerformanceMonitorInterceptor does not track exceptions. JamonAspect which is part of the jamon jar does though. Here is more information about it: http://jamonapi.sourceforge.net/spring_aop_monitoring.html

Here is a sample spring xml that uses JamonAspect: http://sourceforge.net/p/jamonapi/jamonapi/ci/master/tree/jamon/src/test/resources/minimalApplicationContext.xml

If that doesn't work for you it would be easy copy the JamonPerformanceMonitorInterceptor code and have it track exceptions. I have been meaning to do that anyway.

I notice you have older versions of much of your software stack (jdk, spring). I haven't tested jamon with these versions of software.

 
steve souza
Ranch Hand
Posts: 862
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alternatively, you can inherit from JamonPerformanceMonitorInterceptor and add the simple code that it would take to track exceptions. The following untested code does that.

It will count overall exceptions 'com.jamonapi.Exceptions' (general), and specific exceptions (FileNotFoundException, IllegalArgumentException etc). In addition you can look at the stacktraces in the jamon web app if you enable the FIFOBuffer. The stack trace can be displayed under the spring method name, and the general and specific exceptions.


http://grepcode.com/file/repo1.maven.org/maven2/org.springframework/spring-web/1.2.4/org/springframework/aop/interceptor/JamonPerformanceMonitorInterceptor.java



Change to.
 
gagan patil
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi Steve,
Thanks for update from your end.

i followed second approach i.e. extending JamonPerformanceMonitorInterceptor in my code

following is impl of it



my xml bean defination is same as that of JamonPerformanceMonitorInterceptor bean only change i made is changing class name but still it is not reflecting in jamon web application

 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will have to give me more information. Is it being called at all? Or is JamonPerformanceMonitorInterceptor still being called. You could write the class name out to see which is called. Are you seeing the timing stats and not the exception information or are you not seeing either? Maybe make the jamon label (name variable) slightly different (i.e. nam+="TESTING") to make sure your class is being called. Make sure the methods you are calling are throwing exceptions!! You could even explicitly throw one in the try block just to see what happens. Also, post your spring xml file.

Try all that and give me some more information.
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, unless you think you will use this, I would just get rid of it...

logger.trace("JAMon performance statistics for method [" + name + "]:\n" + monitor);
 
gagan patil
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Steve,
Following are updates from my end

Is it being called at all? Or is JamonPerformanceMonitorInterceptor still being called
i am explicitly throwing exception one of monitored class method and can see our extended class also got called
in following stack trace content with Italian font is from catch block of RLOSJamonPerformanceMonitorInterceptor




in rlos monitor [Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7[Ljava.lang.StackTraceElement;@1ba4cd7
ERROR [[ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)'] (ApplicationSearchController.java:357) - Error in getting list of applications for application enquiry
java.lang.RuntimeException: testing exception
at com.los.uwr.dao.impl.ApplicationUtilDAO.getQueryForPagination(ApplicationUtilDAO.java:38)
at com.los.uwr.dao.impl.ApplicationUtilDAO.searchApplicationViewList(ApplicationUtilDAO.java:474)
at com.los.uwr.bo.ApplicationBO.newQuerySearch(ApplicationBO.java:140)
at com.los.uwr.bo.ApplicationBO$$FastClassByCGLIB$$abd6965.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:696)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.los.monitoring.intercept.RLOSJamonPerformanceMonitorInterceptor.invokeUnderTrace(RLOSJamonPerformanceMonitorInterceptor.java:35)
at org.springframework.aop.interceptor.AbstractTraceInterceptor.invoke(AbstractTraceInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)


Are you seeing the timing stats and not the exception information or are you not seeing either?
i can see timing stats in jamon web application on admin page
but when i am clicking on exception details page i am unable to see exception details
one more observation i can see on admin page is that i can see one label with entry com.jamonapi.Exceptions, Exception
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, there is some miscommunications. You are looking in the wrong place. The place where you are looking for exceptions is a deprecated way to see them. Click on the com.jamonapi.Exceptions you mention (The blue square under the Monitor column in jamonadmin.jsp). Here you can add a jamonlistener FIFOBuffer. Probably good to watch one of these videos to see how that is done....

http://youtu.be/3gllOGRGKdE

Some overlap, but here is another one...
http://www.youtube.com/watch?v=BfIuoy8mP5c


 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should also see a jamon label with the specific exception too: java.lang.RuntimeException
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will also have to enable the buffer listener for any place you would like to see the exceptions. This is from my code, so something like this should work if you call it from your constructor. This is the equiavlent of what the video shows you how to do in the gui, bu because you don't want to do this via the gui each time you start the server this is a better choice.

 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another thing I should mention. Just yesterday I released jamon 2.78 which allows you to view any of your monitored jvms with the jamon war. These jvms could be part of a distributed application or part separate java apps within your organization. Check it out! You can download directly or via maven.
 
gagan patil
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Steve,
Following are update from my end
1]i have added following code in my class's constructor which is extending spring's jamon interceptor

MonKey key = new MonKeyImp(MonitorFactory.EXCEPTIONS_LABEL, EXCEPTION);
MonitorFactory.getMonitor(key).addListener("value", JAMonListenerFactory.get("FIFOBuffer"));

but it unable to work
2] also i can able to see com.jamonapi.Exceptions but it is empty link
3]i can not see java.lang.RuntimeException in jamon admin page





 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note Spring 4.1 now has exception tracking added to JamonPerformanceMonitorInterceptor
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!