JavaMelody 1.52.0 with Tomcat 8.0.5 - Monitoring Not Found

671 views
Skip to first unread message

mst...@gmail.com

unread,
Aug 29, 2014, 1:06:21 PM8/29/14
to javam...@googlegroups.com
This is my setup:

Apache Tomcat: 8.0.5

JavaMelody: 1.52.0 - added via Maven dependency

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

web.xml

    <?xml version="1.0" encoding="UTF-8"?>
     <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"

    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>

    <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>
    <listener>
        <listener-class>net.bull.javamelody.SessionListener</listener-class>
    </listener>

    <listener>
        <listener-class>com.something.utils.WebAppInitializer</listener-class>
    </listener>

    <servlet>
        <servlet-name>jersey-services</servlet-name>
        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
        <init-param>
            <param-name>com.sun.jersey.config.property.packages</param-name>
            <param-value>com.brightertext.server.services</param-value>
        </init-param>
        <init-param>
            <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
            <param-value>true</param-value>
        </init-param>
    </servlet>

    <servlet-mapping>
        <servlet-name>jersey-services</servlet-name>
        <url-pattern>/services/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>default</servlet-name>
        <url-pattern>/static/*</url-pattern>
    </servlet-mapping>
    </web-app>

The app is deployed via tomcat-maven-plugin:

    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>tomcat-maven-plugin</artifactId>
        <configuration>
           <url>http://domain.com:8080/manager/text</url>
           <server>tomcat</server>
           <path>/something</path>
        </configuration>
    </plugin>

According to catalina.out, JavaMelody init seems to be ok:

    2014-08-29 14:33:28,675 [localhost-startStop-1] DEBUG net.bull.javamelody - JavaMelody filter init started
    2014-08-29 14:33:28,677 [localhost-startStop-1] DEBUG net.bull.javamelody - OS: Mac OS X unknown, x86_64/64
    2014-08-29 14:33:28,677 [localhost-startStop-1] DEBUG net.bull.javamelody - Java: Java(TM) SE Runtime Environment, 1.8.0_05-b13
    2014-08-29 14:33:28,677 [localhost-startStop-1] DEBUG net.bull.javamelody - Server: Apache Tomcat/8.0.5
    2014-08-29 14:33:28,677 [localhost-startStop-1] DEBUG net.bull.javamelody - Webapp context: /something
    2014-08-29 14:33:28,678 [localhost-startStop-1] DEBUG net.bull.javamelody - JavaMelody version: 1.52.0
    2014-08-29 14:33:28,678 [localhost-startStop-1] DEBUG net.bull.javamelody - JavaMelody classes loaded from: jar:file:/usr/share/apache-tomcat-8.0.5/webapps/something/WEB-INF/lib/javamelody-core-1.52.0.jar!/net/bull/javamelody/
    2014-08-29 14:33:28,679 [localhost-startStop-1] DEBUG net.bull.javamelody - Host: Matthiass-M...@192.168.178.22
    2014-08-29 14:33:28,680 [localhost-startStop-1] DEBUG net.bull.javamelody - log listeners initialized
    2014-08-29 14:33:28,681 [localhost-startStop-1] DEBUG net.bull.javamelody - datasources found in JNDI: []
    2014-08-29 14:33:28,683 [localhost-startStop-1] DEBUG net.bull.javamelody - counters initialized
    2014-08-29 14:33:28,703 [localhost-startStop-1] DEBUG net.bull.javamelody - counters data read from files in /usr/share/apache-tomcat-8.0.5/temp/javamelody/something_Matthiass-MBP.fritz.box
    2014-08-29 14:33:29,233 [localhost-startStop-1] DEBUG net.bull.javamelody - collect task scheduled every 60s
    2014-08-29 14:33:29,276 [localhost-startStop-1] DEBUG net.bull.javamelody - first collect of data done
    2014-08-29 14:33:29,277 [localhost-startStop-1] DEBUG net.bull.javamelody - JavaMelody filter init done in 602 ms

How to access monitoring page?
Neither:
nor:
is working.

Vernat Emeric

unread,
Aug 30, 2014, 9:29:29 AM8/30/14
to javam...@googlegroups.com
Hi,

Configuration seems ok.

Are you sure that you used
"http://domain.com:8080/something/monitoring"
and not
"http://domain.com:8080/something/monitoring/" ?

If yes, can you send a zip file with the sources of a simple project to reproduce the issue?

Emeric
--

---
You received this message because you are subscribed to the Google Groups "javamelody" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javamelody+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matthias Stumpp

unread,
Aug 30, 2014, 4:07:00 PM8/30/14
to javam...@googlegroups.com
Hi,

yes, path I am usig is correct.

But I got it working by removing the following configuration from web.xml:

<servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>/static/*</url-pattern>
</servlet-mapping>

Is this a known miss configuration? If not, do you still need a sample project or is this info sufficient?

Thanks,
Matthias

Vernat Emeric

unread,
Aug 30, 2014, 6:36:21 PM8/30/14
to javam...@googlegroups.com
Hi,

It was not a known issue, but it's interesting, thanks.
I have reproduced it, so no need of a sample project. And yes, there is a 404 not found on the /monitoring url and also on every file url in the webapp, which is not a servlet or a jsp, in this case.

The default servlet is defined by JavaEE. And in fact, there is already a servlet mapping for the Tomcat's "default" servlet, in conf/web.xml of Tomcat.
So, I think that it is not needed to (and you should probably not) add a servlet mapping on the "default" servlet in the WEB-INF/web.xml of the webapp.

So the issue is only a misleading error message from Tomcat.
And you are right, the solution is:
- you should not write a servlet mapping for the "default" servlet in WEB-INF/web.xml
- after removing that servlet mapping, check that your static resources still work in your browser

bye,
Emeric
Reply all
Reply to author
Forward
0 new messages