WebSphere 5.1中找不到文件

时间:2013-12-09 14:44:17

标签: websphere

我的Web.xml ...

<servlet>
    <servlet-name>MaintenanceModeServlet</servlet-name>
    <servlet-class>com.jc.servlet.MaintenanceModeServlet</servlet-class>

</servlet>

<servlet-mapping>
    <servlet-name>MaintenanceModeServlet</servlet-name>
    <url-pattern>/MaintenanceModeServlet</url-pattern>
</servlet-mapping>

...

这是Servlet的片段,它调用我的MaintenanceModeServlet ...。

public void doPost(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException {

        MaintenanceMode m = new MaintenanceMode();
        if (m.isDowntimeFlag()) {
            System.out.println("Calling MaintenanceModeServlet....");
            MVCUtility.forwardRequest("/MaintenanceModeServlet", req, resp);
            return;     
        }

... ..

...栈跟踪 PrintStackTrace:com.ibm.ws.webcontainer.webapp.WebAppErrorReport:找不到文件:位于com.ibm.ws.webcontainer的com.ibm.ws.webcontainer.srt.SRTServletResponseContext.sendError(SRTServletResponseContext.java:174)中的/ MaintenanceModeServlet。 srt.SRTServletResponse.sendError(SRTServletResponse.java:686)位于javax.servlet.http.HttpServlet.service(HttpServlet.java:740)的com.ibm.ws.webcontainer.servlet.SimpleFileServlet.doGet(SimpleFileServlet.java:409)在com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet的com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)的javax.servlet.http.HttpServlet.service(HttpServlet.java:853) ._service(StrictLifecycleServlet.java:174)位于com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)的com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116) )com.ibm上的com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)位于com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher的com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)中的.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42) .handleWebAppDispatch(WebAppRequestDispatcher.java:1018)位于com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:529)的com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:208) )com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:134)位于com.ibm.ws的com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:321)。 webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)位于com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher的com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:246)。 com.ibm.ws.webc上的service(OSEListener.java:334) ontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:652)at com.ibm.ws.http.HttpConnection.run(HttpConnection.java: 448)在com.ibm.ws.util.ThreadPool $ Worker.run(ThreadPool.java:937)

只有当它从WebSphere App Server运行时才会发生错误,在localhost上没有问题。知道为什么它找不到MaintenanceModeServlet实际上它在那里? 谢谢,

1 个答案:

答案 0 :(得分:0)

您还必须考虑应用程序上下文路径。如果您不想依赖于上下文路径,可以更改代码以在前向中包含上下文路径:

MVCUtility.forwardRequest(req.getContextPath() + "/MaintenanceModeServlet", req, resp);