2017-10-10 5 views
0

私は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> 

これはこれは、ファイル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> 

あるクラス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>());   
} 
} 

である私はそれを修正する方法がわかりません。

+0

古くなったサイトをフォローしないでください。公式の文書を見てください。 –

答えて

0

その後、Strutsの実行からサーブレットマッピングのURLを除外するためにstruts.xmlexcludePattern定数を追加

<servlet-mapping> 
    <servlet-name>LoginAction</servlet-name> 
    <url-pattern>/LoginAction</url-pattern> 
</servlet-mapping> 
<filter> 
    <filter-name>struts2</filter-name> 
    <filter-class> 
     org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter 
    </filter-class> 
</filter> 
<filter-mapping> 
    <filter-name>struts2</filter-name> 
    <url-pattern>/*</url-pattern> 
</filter-mapping> 

をフィルタリングするサーブレットマッピングと新しい支柱を使用する必要があります。

<constant name="struts.action.excludePattern" value="/LoginAction/?.*"/> 
+0

あなたの答えをありがとう。私は試していますが、他のエラーが発生します: エラー404:コンテキストパス[/ Struts2_Hello_World]に関連付けられている名前空間[/]とアクション名[]に対応するアクションがありません。 私はtomcat 7を試しています。動作しています。しかしwebsphereそれは働いていない! – Sang9xpro

+0

別のエラーが別の質問に掲載されるはずです。しかしあなたのエラーはよく知られており、あなたの問題を解決する答えがあります。https://stackoverflow.com/a/40658006/573032 –

関連する問題