Saturday, 21 November 2009

Using javamelody in your application

I have discovered today the project javamelody which collects some imformations at the jvm level and at the os level.
Installing it in your webapp is very easy.
In your pom add a dependency :

<dependency>
<groupId>net.bull.javamelody</groupId>
<artifactId>javamelody-core</artifactId>
<version>1.16.0</version>
</dependency>

This dependency is not in central repo so you have to add two repository in youe favorite repository manager.
* http://maven.glassfish.org/content/groups/public/
* http://repo.opennms.org/maven2

In your webapp add the following entries

<listener>
<listener-class>net.bull.javamelody.SessionListener</listener-class>
</listener>

<filter>
<filter-name>monitoring</filter-name>
<filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>monitoring</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

Hit your browser at http://ip:port/context/monitoring

The display is similar to the tool called orca but on real time.