关于javamelody配置后,工程出错问题

来源:互联网 发布:ubuntu vmware 编辑:程序博客网 时间:2024/05/29 16:53

javamelody 的功能大家应该都知道,不知道的去google,在这不在多讲

配置也很简单

复制文件javamelody.jarjrobin-x.jar位于所提供的lib,下载javamelody.zip文件就包含这个包,放入web应用的的WEB-INF/lib目录中。


在项目的web.xml文件下添加

<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>
本人运行后monitoring 运行正常,但工程运行错误,
百度很久也没有相关问题,都是如何配置,
后仔细查看官方文档
文档如下:

Deployment on Tomcat without modification of monitored webapps (beta)

If there is one or several webapp(s) to monitor which are deployed on Tomcat 6, it is possible to monitor this or these webapp(s) without modification of this or these webapp(s), (except that it may not work well from javamelody v1.32 up to v1.35). That is to say without modification of the war file or of the directory of these webapps.

For this, copy the files javamelody.jar and jrobin-x.jar and optionally itext-x.jar in the lib directory of Tomcat 6 (and not in the WEB-INF/lib directories of the webapps).
Then add the following lines in the web.xml file of the conf directory of Tomcat (and not in the WEB-INF/web.xml files of the webapps).

        <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>
In this conf/web.xml file of tomcat, some parameters can be added as written in the user guide.

So and without modification of the webapps, all webapps deployed in this Tomcat instance are monitored (and it is then not possible to choose which, otherwise than with the url-exclude-pattern parameter described in the user guide). This technique is specific to Tomcat 6 and does not apply to other JavaEE implementations.

The ClassLoader in application servers is a complex subject. In consequence :

  • This feature is considered as beta for now
  • It works only in Tomcat 6 or 7 (Tomcat 5.5 is not supported)
  • Hot reployment is not supported when using this technique
  • It does not seem advisable to use the monitoring by Spring AOP in this case

注意红色的地方
本人用的就是tomcat 5.5 ,他的高版本是不支持tomcat 5.5的,后换成tomcat 6 工程和monitoring都运行正常

0 0
原创粉丝点击