问题
I got a Struts 2 , Java 8 web application running on Wildfly 10 and wanted to integrate Javamelody but i am unable to access the monitoring page no matter my configuration in the web.xml and struts.xml
I use the following maven dependency
<dependency>
<groupId>net.bull.javamelody</groupId>
<artifactId>javamelody-core</artifactId>
<version>1.77.0</version>
</dependency>
In my web.xml (web-app version="3.0" ) i have the following configuration:
<filter>
<filter-name>monitoring</filter-name>
<filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
<async-supported>true</async-supported>
</filter>
<filter-mapping>
<filter-name>monitoring</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>ASYNC</dispatcher>
</filter-mapping>
<listener>
<listener-class>net.bull.javamelody.SessionListener</listener-class>
</listener>
In my struts configuration following
<interceptor-stack name="myStack">
<interceptor-ref name="monitoring"/>
<interceptor-ref name="defaultStack"/>
</interceptor-stack>
and set myStack as default
<default-interceptor-ref name="myStack" />
When i try to access http://localhost:8080/myapp/monitoring i get following error: [org.apache.struts2.dispatcher.Dispatcher] (default task-3) Could not find action or result: There is no Action mapped for namespace / and action name monitoring. - [unknown location]
I cannot find many resources on the web concerning this issue or configuration with Struts . Any ideas ?
Note: I am one step closer, but i don't get why this is happening. I had to remove all filter that had a url-pattern /* for this to work. Is there a workaround on this? Of course with this configuration i cannot access any of my pages anymore.
回答1:
The javamelody user's guide says to write the javamelody MonitoringFilter in WEB-INF/web.xml before your servlet. But in the case of Struts 2, there is no more servlet and Struts 2 is controlled by a filter.
So you have to write the javamelody MonitoringFilter in WEB-INF/web.xml before your Struts 2 filter.
来源:https://stackoverflow.com/questions/56391102/javamelody-with-struts-2-no-action-mapped-for-monitoring