la sécurité javamelody 1.58 ne fonctionne pas dans tomcat8


Javamelody est mis à niveau vers 1.58 à partir de 1.42 mais container managed security (web.xml) ne fonctionne pas dans tomcat8 mais dans tomcat9, cela fonctionne bien. Comment résoudre ce problème?

Pris les mesures suivantes pour mettre à niveau javamelody.

Télécharger javamelody.zip Copiez les fichiers javamelody.pot et jrobin-x.jar, situé à la racine du javamelody fourni.fichier zip, dans le répertoire WEB-INF / lib de la guerre de l'application web à surveiller.

Mettez la balise suivante dans web.xml de application.

<filter>
    <filter-name>javamelody</filter-name>
    <filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
    <async-supported>true</async-supported>
    <init-param>
        <param-name>authorized-users</param-name>
        <param-value>user:pwd</param-value>
    </init-param>
</filter>
<filter-mapping>
    <filter-name>javamelody</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>ASYNC</dispatcher>
</filter-mapping>
<listener>
    <listener-class>net.bull.javamelody.SessionListener</listener-class>
</listener>

Créer un fichier nommé surveillance du printemps.xml avec le code ci-dessous dans le chemin WEB-INF/classes/net/bull/javamelody/monitoring-spring.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

    <bean id="monitoringAdvisor" class="net.bull.javamelody.MonitoringSpringAdvisor">
        <property name="pointcut">
            <bean class="net.bull.javamelody.MonitoredWithAnnotationPointcut"/>
        </property>
    </bean>

    <bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"/>

    <bean id="springDataSourceBeanPostProcessor" class="net.bull.javamelody.SpringDataSourceBeanPostProcessor">
        <!--
        <property name="excludedDatasources">
            <set>
                <value>excludedDataSourceName</value>
            </set>
        </property>
        -->
    </bean>

    <!--
    <bean id="wrappedDataSource" class="net.bull.javamelody.SpringDataSourceFactoryBean">
        <property name="targetName" value="targetDataSource" />
    </bean>
    -->
</beans>

Le chemin du fichier est configuré comme context-param dans le web.xml d'application comme ceci:

<context-param>
<param-name>contextConfigLocation</param-name>

<param-value>/WEB-INF/classes/applicationContext/**/*.xml    classpath:net/bull/javamelody/monitoring-spring.xml</param-value>
</context-param> 



And also when open monitoring in tomcat9 the correct and latest version is showing but not in tomcat8 and I am using java 8.
Author: silentBeep, 2016-02-19

1 answers

J'ai eu le même problème (JavaMelody 1.59 et Tomcat 8.0.23). Tous les paramètres init-param dans le web.le filtre xml pour javamelody ne s'applique pas.

J'ai dû ajouter l'attribut version à l'élément web-app dans web.xml de l'application et définissez-le sur 3.1 (version="3.1").

Web.xml:

 <web-app 
       xmlns="http://xmlns.jcp.org/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
       version="3.1"
       metadata-complete="true">
    <filter>
        <filter-name>monitoring</filter-name>
        <filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
        <init-param>
            <param-name>authorized-users</param-name>
            <param-value>user:pwd</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>javamelody</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <listener>
        <listener-class>net.bull.javamelody.SessionListener</listener-class>
    </listener>
    ...
</web-app>
 0
Author: Schelldorfer, 2016-04-14 14:57:26