1

I am trying to add JavaMelody monitoring to a Rails 4.0 app which we deploy to Tomcat running on Windows 2008 R2, with the help of JRuby and Warbler. As described in the JavaMelody user guide, I have added both javamelody.jar and jrobin-1.5.9.jar to WEB-INF/lib/ and extended our web.xml too look essentially like this:

<!DOCTYPE web-app PUBLIC
  "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
  "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>

<!-- JavaMelody -->

<filter>
  <filter-name>monitoring</filter-name>
  <filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
  <init-param>
    <param-name>log</param-name>
    <param-value>true</param-value>
   </init-param>
</filter>

<filter-mapping>
  <filter-name>monitoring</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>

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

<!-- JRuby-Rack-->

<filter>
  <filter-name>RackFilter</filter-name>
  <filter-class>org.jruby.rack.RackFilter</filter-class>
</filter>

<filter-mapping>
  <filter-name>RackFilter</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>

<listener>
  <listener-class>org.jruby.rack.rails.RailsServletContextListener</listener-class>
</listener>

</web-app>

This seems to work to some extend - there seems to be monitoring information recorded, as I can see that a folder <TOMCAT_HOME>\temp\javamelody is created, and the files therein seem to be updated which each request I make to the app.

But unfortunately, what doesn't work is actually opening the monitoring report. When I go to http://localhost:8080/ourapp/monitoring, I don't get a report page as described in the user guide, but the 404 page of our Rails app instead. The Tomcat logs confirm that both the JavaMelody monitoring filter and SessionListener have been loaded and don't seem to reveal any errors. What have I missed?

Denis Washington
  • 5,164
  • 1
  • 18
  • 21

1 Answers1

0

since you mapped JRuby-Rack to handle everything (/*) you either need to re-arrange the mapping to make sure the specific path(s) take precedence in being handled by the other filter e.g.

<filter-mapping>
  <filter-name>monitoring</filter-name>
  <url-pattern>/monitoring</url-pattern>
</filter-mapping>

or alternatively not route everything to JRuby-Rack if the paths it needs to handle can be mapped (you might need to change the monitoring filter paths as well or try using the RackServlet instead if you do not mind "replacing" the container default servel)

kares
  • 7,076
  • 1
  • 28
  • 38