miaoyf / javamelody

Automatically exported from code.google.com/p/javamelody
0 stars 0 forks source link

Centralized server and custom css #414

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. I was not able by following the user guides to customized my css on 
centralized server
1. My web.xml looks like this 
<?xml version="1.0" encoding="UTF-8" ?>
<!-- cette webapp avec cette servlet est utilisée dans un serveur de collecte 
séparé de l'application monitorée -->
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
        <display-name>monitoring</display-name>
        <distributable />

        <servlet>
                <servlet-name>monitoringServer</servlet-name>
                <servlet-class>net.bull.javamelody.CollectorServlet</servlet-class>
                <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
                <servlet-name>monitoringServer</servlet-name>
                <url-pattern>/*</url-pattern>
        </servlet-mapping>
        <filter>
                <filter-name>customResourceFilter</filter-name>
                <filter-class>net.bull.javamelody.CustomResourceFilter</filter-class>
                <init-param>
                        <param-name>customizableMonitoring.css</param-name>
                        <param-value>/customMonitoring.css</param-value>
                </init-param>
         </filter>
         <filter-mapping>
                <filter-name>customResourceFilter</filter-name>
                <url-pattern>/*</url-pattern>
         </filter-mapping>

</web-app>

What is the expected output? What do you see instead?
my css is not used

What version of the product are you using? On what application server, JDK,
operating system?
1.51 on tomcat 7, jre-7, linux debian7

Please provide any additional information below.
To make it work I do
ln -s customMonitoring.css 
WEB-INF/classes/net/bull/javamelody/resource/customizableMonitoring.css

Original issue reported on code.google.com by mdelo...@tennaxia.com on 13 Jun 2014 at 7:45

GoogleCodeExporter commented 8 years ago
This chapter in the user guide was written mainly for a monitored webapp, not 
for the optional collector server. The problem in your case is that the 
"/customMonitoring.css" resource path is stolen by the CollectorServlet, before 
that the servlet container gets the file.

To fix this issue, I suggest to use the following configuration in 
WEB-INF/web.xml of the collector server:
<?xml version="1.0" encoding="UTF-8" ?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
        <display-name>monitoring</display-name>
        <distributable />

        <servlet>
                <servlet-name>monitoringServer</servlet-name>
                <servlet-class>net.bull.javamelody.CollectorServlet</servlet-class>
                <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
                <servlet-name>monitoringServer</servlet-name>
                <url-pattern>/monitoring</url-pattern>
        </servlet-mapping>
        <filter>
                <filter-name>customResourceFilter</filter-name>
                <filter-class>net.bull.javamelody.CustomResourceFilter</filter-class>
                <init-param>
                        <param-name>customizableMonitoring.css</param-name>
                        <param-value>/customMonitoring.css</param-value>
                </init-param>
         </filter>
         <filter-mapping>
                <filter-name>customResourceFilter</filter-name>
                <url-pattern>/monitoring</url-pattern>
         </filter-mapping>
</web-app>

Then, you will need to use the path http://localhost:8080/monitoring in your 
browser to display reports, instead of http://localhost:8080

I have updated 
https://code.google.com/p/javamelody/wiki/UserGuideAdvanced#Customizing_styles,_
icons_and_other_resources_in_the_html_report to redirect here. Thanks.

Original comment by evernat@free.fr on 14 Jun 2014 at 11:38

GoogleCodeExporter commented 8 years ago
Doesn't work for me
the WebApps doesn't start

Original comment by mdelo...@tennaxia.com on 16 Jun 2014 at 8:46

GoogleCodeExporter commented 8 years ago
Strange.
First, why do you say "the webappS" with a "S"? Is there one or several webapps?
And more important, why it doesn't start?

Original comment by evernat@free.fr on 16 Jun 2014 at 9:23

GoogleCodeExporter commented 8 years ago
if I go to :lynx localhost:8080/monitoring
Then I get a  HTTP Status 404 - /monitoring
Then in the Tomcat log : nothing special
in the tomcat manager for webapp I see that javamelody is running

Original comment by mdelo...@tennaxia.com on 20 Jun 2014 at 7:40

GoogleCodeExporter commented 8 years ago
if I change back to 
 <servlet-mapping>
         <servlet-name>monitoringServer</servlet-name>
         <url-pattern>/*</url-pattern>
</servlet-mapping>
I can access javamelody with url localhost:8080/javamelody        

Original comment by mdelo...@tennaxia.com on 20 Jun 2014 at 7:44