2016-01-22 120 views
0

我試着在我的spring應用程序中安裝Javamelody。我在本地主機上配置,並且可以訪問到javamelody與網址:JavaMelody映射URL

http://localhost:9080/myapp/stats 

服務器:WEBSPHERE 7.0和我的web.xml配置是:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> 
<web-app id="myapp"> 
    <display-name>myapp</display-name>  
    <context-param> 
     <param-name>contextConfigLocation</param-name> 
     <param-value> 
      classpath:net/bull/javamelody/monitoring-spring.xml 
      /WEB-INF/applicationContext.xml 
     </param-value> 
    </context-param>   

    <filter> 
     <filter-name>monitoring</filter-name> 
     <filter-class>net.bull.javamelody.MonitoringFilter</filter-class> 
     <init-param> 
      <param-name>monitoring-path</param-name> 
      <param-value>/stats</param-value> 
     </init-param> 
    </filter> 
    <filter-mapping> 
     <filter-name>monitoring</filter-name> 
     <url-pattern>/*</url-pattern> 
    </filter-mapping>  

    <listener> 
     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
    </listener> 

    <listener> 
     <listener-class>myapp.web.AppInit</listener-class> 
    </listener> 

    <listener> 
      <listener-class>net.bull.javamelody.SessionListener</listener-class> 
    </listener> 

    <servlet> 
     <servlet-name>javascript</servlet-name> 
     <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
    </servlet> 
    <servlet> 
     <servlet-name>page</servlet-name> 
     <display-name>page</display-name> 
     <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
    </servlet> 
    <servlet> 
     <servlet-name>unificator</servlet-name> 
     <display-name>unificator</display-name> 
     <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
    </servlet> 
    <servlet> 
     <servlet-name>webservicesoap</servlet-name> 
     <display-name>webservicesoap</display-name> 
     <servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class> 
    </servlet> 
    <servlet> 
     <servlet-name>QuartzInitializer</servlet-name> 
     <servlet-class>org.quartz.ee.servlet.QuartzInitializerServlet</servlet-class> 
     <init-param> 
      <param-name>shutdown-on-unload</param-name> 
      <param-value>true</param-value> 
     </init-param> 
     <init-param> 
      <param-name>start-scheduler-on-load</param-name> 
      <param-value>true</param-value> 
     </init-param> 
     <load-on-startup>1</load-on-startup> 
    </servlet> 

    <servlet-mapping> 
     <servlet-name>javascript</servlet-name> 
     <url-pattern>/validation.js</url-pattern> 
    </servlet-mapping> 
    <servlet-mapping> 
     <servlet-name>page</servlet-name> 
     <url-pattern>/page/*</url-pattern> 
    </servlet-mapping> 
    <servlet-mapping> 
     <servlet-name>unificator</servlet-name> 
     <url-pattern>/home/*</url-pattern> 
    </servlet-mapping> 
    <servlet-mapping> 
     <servlet-name>unificator</servlet-name> 
     <url-pattern>/users/*</url-pattern> 
    </servlet-mapping> 
    <servlet-mapping> 
     <servlet-name>unificator</servlet-name> 
     <url-pattern>/contacts/*</url-pattern> 
    </servlet-mapping> 

    <session-config> 
     <session-timeout>0</session-timeout> 
    </session-config> 

    <welcome-file-list> 
     <welcome-file>index.html</welcome-file> 
     <welcome-file>index.htm</welcome-file> 
     <welcome-file>index.jsp</welcome-file> 
     <welcome-file>default.html</welcome-file> 
     <welcome-file>default.htm</welcome-file> 
     <welcome-file>default.jsp</welcome-file> 
    </welcome-file-list> 
</web-app> 

,但此配置在producction環境不工作。如果我去

http://app.gtrwe.dev.corp/myapp/stats 

我得到404錯誤。此外,我有我的web.xml中的servlets

我正在尋找如何設置它的幫助。

Thx提前。

+0

你能servlet的映射添加到您的文章? – hasnae

+0

@hasnae已添加配置 – Fonexn

回答

0

看來,IBM的WebSphere可能會遇到錯誤404,如果沒有的servlet映射到/ *或/監控,如提及here

+0

謝謝@hasnae,但我無法訪問生產中的服務器...其他解決方案? – Fonexn

+0

您可以使用WebServlet註釋,但它僅適用於servlet 3.0 – hasnae

+0

WebSphere 7.0不支持servlet 3.0。 – Fonexn