我有一個使用struts2版本2.3.1.2的項目動態Web。 我想將此項目部署到WebSphere。但我得到的麻煩是:在WebSphere上使用Struts2部署動態Web JSP
[ERROR ] SRVE0293E: [Servlet Error]-[null]: com.ibm.ws.webcontainer.webapp.WebAppErrorReport:
這是我的文件web.xml
。
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:javaee="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" id="WebApp_9"
version="2.4">
<display-name>Struts2 Application</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>Login.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>LoginAction</servlet-name>
<servlet-class>net.viralpatel.struts2.action.LaunchServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
</web-app>
這是類LaunchServlet
public class LaunchServlet extends HttpServlet implements Servlet {
public LaunchServlet() {
super();
}
public void init(ServletConfig arg0) throws ServletException {
// this works around a bug in the websphere classloader.
super.init(arg0);
Dispatcher d = new Dispatcher(getServletContext(), new HashMap<String,
String>());
}
}
這是文件的struts.xml
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.enable.DynamicMethodInvocation"
value="false" />
<constant name="struts.devMode" value="false" />
<constant name="struts.custom.i18n.resources"
value="ApplicationResources" />
<package name="default" extends="struts-default" namespace="/">
<action name="login"
class="net.viralpatel.struts2.action.LoginAction">
<result name="success">Welcome.jsp</result>
<result name="error">Login.jsp</result>
</action>
</package>
</struts>
我不知道如何解決它。
不要遵循一些過時的網站。看看官方文檔。 –