but jamon.jar should not include in appliction's WEB-INF/lib in application
server, so I have to avoid it
<dependency><groupId>com.jamonapi</groupId><artifactId>jamon</artifactId><version>2.81</version><!--avoid it! not included in deployment lib folder--><scope>provided</scope></dependency>
However, jamon-2.81.pom requires other parent dependencies, including
log4j, aspectj-xxx
which are also dependencies in the Spring application, so I have to copy
those dependencies from maven repository to Catalina_home/lib, then I get
this error
log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
log4j:ERROR [WebappClassLoader
context: /OptiVLM-CarrierWeb
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@4f8235ed
] whereas object of type
log4j:ERROR "com.jamonapi.log4j.JAMonAppender" was loaded by [org.apache.catalina.loader.StandardClassLoader@4f8235ed].
log4j:ERROR Could not instantiate appender named "jamonAppender".
If I only leave jamon-2.81.jar in the CATALINA_HOME/lib
java.lang.NoClassDefFoundError: org/apache/log4j/AppenderSkeleton
and
java.lang.ClassNotFoundException: org.aspectj.lang.ProceedingJoinPoint
so it looks like both log4j and aspectj dependencies are not found(they
definitely exist in WEB-INF/lib, but jamon-2.81.jar from CATALINA_HOME/lib
cannot find them.
If I remove the <scope>provided</scope> tag, of course there will be not
error but also there won't be any message show up on jamon console(because
there are different jamon.jar works for spring application and jamon.war
respectively)
This made me wondering may be JAMon is not sutable for this kind of
situation? is there anyway we can fix it, so both Spring and Jamon.war can
running on same jamon.jar?
Thanks a lot in advance
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This should work. Jamon should have no other dependencies required. i.e. you don't need to install aspectj, log4j etc unless some other library uses them.
For example it shouldn't need log4j unless you specifically use the jamon log4j appender.
"java.lang.NoClassDefFoundError: org/apache/log4j/AppenderSkeleton
and
java.lang.ClassNotFoundException: org.aspectj.lang.ProceedingJoinPoint "
What caused this?
"If I remove the <scope>provided</scope> tag, of course there will be not
error but also there won't be any message show up on jamon console(because
there are different jamon.jar works for spring application and jamon.war
respectively)"
The spring application and jamon.war need to share the same jamon-2.81.jar file which should be put at the server level (tomcat /lib directory).
Jamon jar has no further dependencies. The other dependencies are used to compile jamon, but aren't needed at runtime unless you use these capabilities which Spring does not.
Maybe I could improve this intent with the pom.xml file. Ideas?
Last edit: Steve Souza 2015-04-16
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Maybe I could improve this intent with the pom.xml file. Ideas?
I can imagine different users of JAMon may running different version of Spring and AOP. One way to make those version configurable is take the value from external properties:
so you can leave default value for those <xxx-version> tags in a properties file and change them by need. But I don't think this can be helpful for a dependency from maven repository(should be plug n play?), well maven has limitations.
But JAMon is the best ! :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"really??????
so jamon log4j appender is not required?"
Correct. The log4j appender counts method calls to INFO, WARN, DEBUG, ERROR, FATAL. If you don't need this capability then you don't need to install log4j.
This capability has nothing to do with spring. Here is more info on it. Jamon support was built into spring and so spring calls jamon natively. No other libraries are required.
"if jamon log4j appender, how jamon can persist the performance information.."
Data is in memory. The jamon persister can save the data to disk on a timer though. I think that is done by default.
"and how jamon.war detect the update?"
Like any other shared libary. Both spring and jamon war have access to it because it is in the server's /lib directory. Spring writes to it and jamon.war reads from it. Note you can also view the data in jmx.
Last edit: Steve Souza 2015-04-16
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
one more question: I go over threads in the forum and it looks JAMon is capable of persist the log into db as well --- but it will have impact on performance by itself I think? Then I assume the best way to persist the log information is through Jamon war to export from UI?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"one more question: I go over threads in the forum and it looks JAMon is capable of persist the log into db as well --- but it will have impact on performance by itself I think? "
The whole jamon structure is serializable so I suppose that could be serialized into a database.
i.e MonitorComposite serializeMe = MonitorFactory. getRootMonitor();
You could provide an implementation of this to save data to a database.
Here is a paragraph from the link: Saving of JAMon data is done with a "JamonDataPersister. Developers can provide their own implementations too. JAMon implements this capability with a new interface (JamonDataPersister) which is called from the timer. A JamonDataPersister implementation enables a developer to do anything they want with the serializable JAMon data (MonitorComposite). JamonDataPersister has three primary methods: put, get, remove. They are used to save, retrieve, and delete JAMon data associated with a specific server."
"Then I assume the best way to persist the log information is through Jamon war to export from UI?"
This could be done too. You should be able to use the rest api to grab the data in xml, or csv. I would probably implement it by providing an implementation of JamonDataPersister.
Last edit: Steve Souza 2015-04-16
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the information, so with above description, is jamon.war required if just use org.springframework.aop.interceptor.JamonPerformanceMonitorInterceptor? I see the api provided by Spring is very handy, but not sure how to establish the result (on ui or in the log, ui gonna be preferred :) ).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Also I have a new open source project that is complimentary to JAMon called Automon (automon.org). It let's you define in an xml file what parts of your code you want to monitor (much like spring. it should work directly in spring though I haven't tried it). One advantage of automon is that you can swap the jamon implementation for any other monitoring api that you would want to use.
Having said that using Jamon and spring directly is great too. An advantage of automon is that you aren't limited to monitoring only spring beans.
Hi Steve, sorry about the late response. Is the new tool to replace the pointcuts and aspect in JAMon Spring support? Sounds like the new tool can work for POJO projects and Spring appliction :) that's pretty cool.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"Sounds like the new tool can work for POJO projects and Spring appliction :) that's pretty cool."
Correct. And you can use tools like yammer metrics, etsy or anything else you choose.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the information, so with above description, is jamon.war required if just use org.springframework.aop.interceptor.JamonPerformanceMonitorInterceptor? I see the api provided by Spring is very handy, but not sure how to establish the result (on ui or in the log, ui gonna be preferred :) )."
Jamon war is only needed if you want to display the data (in your case spring data) collected in the provided web app. You can also display data with jamon jmx capabilities
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Steve,
I am trying to integrate the jamon api with spring aop method monitoring. However everything is running fine, method is also intercepting and the monitor data is generating successfully(I've seen it in debug log of my application). But the problem is "Jamon admin GUI is not showing the collected data".
The Environment which i have used is as Java 8, tomcat 8 and spring 3.6 with jamon api 2.8.
Attaching my capture of the data has been collected.
Umesh,thanks for getting back to me on this. It helps other users of jamon too.
And for anyone reading this post 99% of the problems reported about jamon are when the developer has 2 copies of the jamon jar in the classpath. The symptom of this is that both your application and jamon war do not not throw jamon class not found exceptions, but there is no data to view.
This happens because your app 'writes' to a version of the jamon classes in one jamon jar, and jamon war 'reads' jamon values from another version of the jar.
Also, next time open a new ticket instead of reusing this old one.
And, finally check out my latest open source offering automon.org that lets you monitor ANY pojo and not just spring classes. In addition you can swap out jamon for any other monitoring api you might want to use.
Cheers,
Steve
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Currently I am trying to integrate the Jamon into one of our products and I get the same exception as the Mike Guo described at the beginning of this thread:
spring AOP declaration added to the web.beans.xml (version 3.0)
<aop:aspectj-autoproxy/>, jamonAspect bean and also <aop:config> with custom pointcuts added to the web.beans.xml
jamon-2.81.jar added to the Tomacat/lib folder
I skipped the Valve change in Tomcat's server.xml
jamon.war added to the Tomcat/webapps
When I start the Tomcat I get the exception as described above. If i remove the scope definition from the pom.xml I don't get any exception but I don't get any results in Jamon-UI neither... Is there any way to deploy the jamon.war to another Tomcat instance?
Thanks and best regards,
erno
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
thanks for the quick response. I get it working now: I had to copy aspectjrt (aspectjrt-1.6.12.jar) to TOMCAT/lib folder and the issue is solved. I also found some article describing that a missing aspectjweaver in TOMCAT/lib could cause the same problem as well - for me it works without it in TOMCAT/lib; it is however, provided in WAR.
Regards,
erno
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The link worked this time, I guess the last time I tried sourceforge was
broken.
I unsubscribed since I haven't used Jamon for some time. Great to see it's
still being used!
-Albert
hi
I am trying to configure JAMon into my Spring application, in order to
monitor requests and transactions.
However now I am still confused about how to deploy jamon.jar to allow both
Spring application and jamon.war use the jamon.jar at same time.
The jamon.jar must somehow expose to Spring application to enable the
configuration in ApplicationContext.xml
com.transoftinc.vlm.carrierweb.controller...(..)) || execution(
com.transoftinc.vlm.carrierweb.service...*(..)) "/>
<aop:aspect id="jamonSpringAspect" ref="jamonAspect">
<aop:around pointcut-ref="jamonMonitoringPointcut" method="monitor"/>
</aop:aspect>
</aop:config>
but jamon.jar should not include in appliction's WEB-INF/lib in application
server, so I have to avoid it
However, jamon-2.81.pom requires other parent dependencies, including
log4j, aspectj-xxx
aspectjrt-1.7.4.jar
aspectjtools-1.7.4.jar
aspectjweaver-1.7.4.jar
jamon-2.81.jar
log4j-1.2.17.jar
which are also dependencies in the Spring application, so I have to copy
those dependencies from maven repository to Catalina_home/lib, then I get
this error
log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
log4j:ERROR [WebappClassLoader
context: /OptiVLM-CarrierWeb
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@4f8235ed
] whereas object of type
log4j:ERROR "com.jamonapi.log4j.JAMonAppender" was loaded by
[org.apache.catalina.loader.StandardClassLoader@4f8235ed].
log4j:ERROR Could not instantiate appender named "jamonAppender".
If I only leave jamon-2.81.jar in the CATALINA_HOME/lib
aspectjrt-1.7.4.jar
aspectjtools-1.7.4.jar
aspectjweaver-1.7.4.jar
jamon-2.81.jar
log4j-1.2.17.jar
I got
java.lang.NoClassDefFoundError: org/apache/log4j/AppenderSkeleton
and
java.lang.ClassNotFoundException: org.aspectj.lang.ProceedingJoinPoint
so it looks like both log4j and aspectj dependencies are not found(they
definitely exist in WEB-INF/lib, but jamon-2.81.jar from CATALINA_HOME/lib
cannot find them.
If I remove the <scope>provided</scope> tag, of course there will be not
error but also there won't be any message show up on jamon console(because
there are different jamon.jar works for spring application and jamon.war
respectively)
This made me wondering may be JAMon is not sutable for this kind of
situation? is there anyway we can fix it, so both Spring and Jamon.war can
running on same jamon.jar?
Thanks a lot in advance
This should work. Jamon should have no other dependencies required. i.e. you don't need to install aspectj, log4j etc unless some other library uses them.
For example it shouldn't need log4j unless you specifically use the jamon log4j appender.
"java.lang.NoClassDefFoundError: org/apache/log4j/AppenderSkeleton
and
java.lang.ClassNotFoundException: org.aspectj.lang.ProceedingJoinPoint "
What caused this?
Follow the directions here for tomcat. You don't have to install the valve if it isn't needed: http://jamonapi.sourceforge.net/http_monitoring.html
Last edit: Steve Souza 2015-04-16
"If I remove the <scope>provided</scope> tag, of course there will be not
error but also there won't be any message show up on jamon console(because
there are different jamon.jar works for spring application and jamon.war
respectively)"
Last edit: Steve Souza 2015-04-16
I can imagine different users of JAMon may running different version of Spring and AOP. One way to make those version configurable is take the value from external properties:
http://mojo.codehaus.org/properties-maven-plugin/
so you can leave default value for those <xxx-version> tags in a properties file and change them by need. But I don't think this can be helpful for a dependency from maven repository(should be plug n play?), well maven has limitations.
But JAMon is the best ! :)
Hi Steve
Thanks for the quick reply! Well first thanks for the awesome tool !!!! :D
I forget to attach the log4j configuration:
log4j.logger.com.jamonapi.log4j=DEBUG, jamonAppender
log4j.appender.jamonAppender=com.jamonapi.log4j.JAMonAppender
log4j.appender.jamonAppender.EnableListeners=DEBUG
this pretty much defines how Log4j associate with JAMon and I think that's how the "class not found exception is thrown"
"For example it shouldn't need log4j unless you specifically use the jamon log4j appender."
really??????
so jamon log4j appender is not required?
then that brings another question:
how jamon.war can feel the update from spring application? is it through hsql and jetty?
if jamon log4j appender, how jamon can persist the performance information and how jamon.war detect the update?
Mike Guo
"really??????
so jamon log4j appender is not required?"
Correct. The log4j appender counts method calls to INFO, WARN, DEBUG, ERROR, FATAL. If you don't need this capability then you don't need to install log4j.
This capability has nothing to do with spring. Here is more info on it. Jamon support was built into spring and so spring calls jamon natively. No other libraries are required.
"if jamon log4j appender, how jamon can persist the performance information.."
Data is in memory. The jamon persister can save the data to disk on a timer though. I think that is done by default.
"and how jamon.war detect the update?"
Like any other shared libary. Both spring and jamon war have access to it because it is in the server's /lib directory. Spring writes to it and jamon.war reads from it. Note you can also view the data in jmx.
Last edit: Steve Souza 2015-04-16
Awesome !
one more question: I go over threads in the forum and it looks JAMon is capable of persist the log into db as well --- but it will have impact on performance by itself I think? Then I assume the best way to persist the log information is through Jamon war to export from UI?
"Well first thanks for the awesome tool !!!! :D"
Thanks, appreciation is always appreciated :)
Last edit: Steve Souza 2015-04-16
"one more question: I go over threads in the forum and it looks JAMon is capable of persist the log into db as well --- but it will have impact on performance by itself I think? "
The whole jamon structure is serializable so I suppose that could be serialized into a database.
i.e MonitorComposite serializeMe = MonitorFactory. getRootMonitor();
Check out this link http://jamonapi.sourceforge.net/distributed_jamon.html. It focuses on 'saving' data with hazelcast, but the principle is pretty generic...Serialize the jamon data anywhere on a timer. In particular you might want to look at the videos on this page as well as look at the JamonDataPersister interface: https://sourceforge.net/p/jamonapi/jamonapi/ci/master/tree/jamon/src/main/java/com/jamonapi/distributed/JamonDataPersister.java
You could provide an implementation of this to save data to a database.
Here is a paragraph from the link: Saving of JAMon data is done with a "JamonDataPersister. Developers can provide their own implementations too. JAMon implements this capability with a new interface (JamonDataPersister) which is called from the timer. A JamonDataPersister implementation enables a developer to do anything they want with the serializable JAMon data (MonitorComposite). JamonDataPersister has three primary methods: put, get, remove. They are used to save, retrieve, and delete JAMon data associated with a specific server."
"Then I assume the best way to persist the log information is through Jamon war to export from UI?"
This could be done too. You should be able to use the rest api to grab the data in xml, or csv. I would probably implement it by providing an implementation of JamonDataPersister.
Last edit: Steve Souza 2015-04-16
Hi Steve
Thanks for the information, so with above description, is jamon.war required if just use org.springframework.aop.interceptor.JamonPerformanceMonitorInterceptor? I see the api provided by Spring is very handy, but not sure how to establish the result (on ui or in the log, ui gonna be preferred :) ).
Also I have a new open source project that is complimentary to JAMon called Automon (automon.org). It let's you define in an xml file what parts of your code you want to monitor (much like spring. it should work directly in spring though I haven't tried it). One advantage of automon is that you can swap the jamon implementation for any other monitoring api that you would want to use.
Having said that using Jamon and spring directly is great too. An advantage of automon is that you aren't limited to monitoring only spring beans.
Here's an article that tells you what it does and how it works: http://jaxenter.com/advanced-java-monitoring-with-automon-116079.html
Hi Steve, sorry about the late response. Is the new tool to replace the pointcuts and aspect in JAMon Spring support? Sounds like the new tool can work for POJO projects and Spring appliction :) that's pretty cool.
"Sounds like the new tool can work for POJO projects and Spring appliction :) that's pretty cool."
Correct. And you can use tools like yammer metrics, etsy or anything else you choose.
"Hi Steve
Thanks for the information, so with above description, is jamon.war required if just use org.springframework.aop.interceptor.JamonPerformanceMonitorInterceptor? I see the api provided by Spring is very handy, but not sure how to establish the result (on ui or in the log, ui gonna be preferred :) )."
Jamon war is only needed if you want to display the data (in your case spring data) collected in the provided web app. You can also display data with jamon jmx capabilities
Hi Steve,
I am trying to integrate the jamon api with spring aop method monitoring. However everything is running fine, method is also intercepting and the monitor data is generating successfully(I've seen it in debug log of my application). But the problem is "Jamon admin GUI is not showing the collected data".
The Environment which i have used is as Java 8, tomcat 8 and spring 3.6 with jamon api 2.8.
Attaching my capture of the data has been collected.
Below is the structure of my spring config file :
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"><context:annotation-config/>
<aop:aspectj-autoproxy/>
<context:component-scan base-package="com.jamonapi">
<context:include-filter type="annotation" expression="org.aspectj.lang.annotation.Aspect"/>
</context:component-scan>
<bean id="monitorMe" class="com.one97.jamonTrial.beans.Record"/>
<bean id="jamonAspect" class="com.jamonapi.aop.spring.JamonAspect">
<property name="exceptionBufferListener" value="true"/>
<property name="useArgsWithExceptionDetails" value="true"/>
<property name="useArgsWithMethodDetails" value="true"/>
</bean>
</beans>
Hi Steve,
I have solved the issue. The issue was happening because of loading of the library jamon-2.81.jar two times in jvm.
I have removed it from my Spring-application. And now it's working like Charm :).
Great Piece of software in a simplest possible way.
Last edit: Umesh Singh 2015-05-01
Umesh,thanks for getting back to me on this. It helps other users of jamon too.
And for anyone reading this post 99% of the problems reported about jamon are when the developer has 2 copies of the jamon jar in the classpath. The symptom of this is that both your application and jamon war do not not throw jamon class not found exceptions, but there is no data to view.
This happens because your app 'writes' to a version of the jamon classes in one jamon jar, and jamon war 'reads' jamon values from another version of the jar.
Also, next time open a new ticket instead of reusing this old one.
And, finally check out my latest open source offering automon.org that lets you monitor ANY pojo and not just spring classes. In addition you can swap out jamon for any other monitoring api you might want to use.
Cheers,
Steve
Hey guys,
first of all: thanks for the great tool.
Currently I am trying to integrate the Jamon into one of our products and I get the same exception as the Mike Guo described at the beginning of this thread:
Here the steps I made to add Jamon to my project:
When I start the Tomcat I get the exception as described above. If i remove the scope definition from the pom.xml I don't get any exception but I don't get any results in Jamon-UI neither... Is there any way to deploy the jamon.war to another Tomcat instance?
Thanks and best regards,
erno
It looks like there is a spring issue happening. Is this link helpful? http://stackoverflow.com/questions/16568665/why-does-spring-throw-an-aspectj-error-if-it-does-not-depend-on-aspectj
Also look at the jamon spring context files to make sure you have everything defined properly. This is a minimal one: https://github.com/stevensouza/jamonapi/blob/master/jamon/src/test/resources/minimalApplicationContext.xml
And here is another example.
https://github.com/stevensouza/jamonapi/blob/master/jamon/src/test/resources/applicationContext.xml
Also look at the jamon spring and aop tests.
https://github.com/stevensouza/jamonapi/tree/master/jamon/src/test/java/com/jamonapi/aop
Hi,
Can someone remove me from this mailing list. I cannot find an unsubscribe
link anywhere.
Tnx,
Albert
2016-04-18 16:25 GMT+02:00 Steve Souza stevesouza@users.sf.net:
Hi Steve,
thanks for the quick response. I get it working now: I had to copy aspectjrt (aspectjrt-1.6.12.jar) to TOMCAT/lib folder and the issue is solved. I also found some article describing that a missing aspectjweaver in TOMCAT/lib could cause the same problem as well - for me it works without it in TOMCAT/lib; it is however, provided in WAR.
Regards,
erno
Thanks for getting back to me. It would be helpful to others if you put the full steps that you had to take in this thread.
There is a link in what you pasted in the forum....
Tnx Steve,
The link worked this time, I guess the last time I tried sourceforge was
broken.
I unsubscribed since I haven't used Jamon for some time. Great to see it's
still being used!
-Albert
2016-04-18 18:03 GMT+02:00 Steve Souza stevesouza@users.sf.net: