2016-04-06 20 views
2

こんにちは、私はStrutsの新機能で、strutsでhello worldにしようとしていますが、エラーが発生しました。私はそれを修正しようとしているが、できない。エラーメッセージが私のstruts.xmlファイルが例外の開始フィルターstruts2構成をロードできません。 - bean

<!DOCTYPE struts PUBLIC 
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" 
"http://struts.apache.org/dtds/struts-2.0.dtd"> 
<struts> 

    <package name="default" extends="struts-default"> 

     <action name="getTutorial" class="com.sudarshan.action.TutorialAction"> 

      <result name="success">success.jsp</result> 
      <result name="failure">error.jsp</result> 
     </action> 


    </package> 
</struts> 

ある

EVERE: Exception starting filter struts2 
Unable to load configuration. - bean - jar:file:/home/sudarshan/Desktop/RestFullTuts/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/struts2starter/WEB-INF/lib/struts2-portlet-plugin-2.3.28.jar!/struts-plugin.xml:31:133 
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:496) 
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74) 
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57) 
    at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279) 
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260) 
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105) 
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4574) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5193) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
    at java.lang.Thread.run(Thread.java:745) 
Caused by: Unable to load configuration. - bean - jar:file:/home/sudarshan/Desktop/RestFullTuts/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/struts2starter/WEB-INF/lib/struts2-portlet-plugin-2.3.28.jar!/struts-plugin.xml:31:133 
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70) 
    at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:970) 
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:438) 
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:482) 
    ... 14 more 

あるweb.xmlがので、このコードのための解決策は何ですか

<?xml version="1.0" encoding="UTF-8"?> 
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://xmlns.jcp.org/xml/ns/javaee" 
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" 
    id="WebApp_ID" version="3.1"> 
    <display-name>struts2starter</display-name> 
    <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> 
    <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> 
</web-app> 

です。

答えて

1

クラスパスからstruts2-portlet-plugin-2.3.28.jarを削除します。しかし、ライブラリを管理するソリューションでは、Mavenを使用することができます。

Mavenで構築されたチュートリアル:Create Struts 2 Web Application Using Maven To Manage Artifacts and To Build The Applicationを参照してください。

<dependency> 
    <groupId>org.apache.struts</groupId> 
    <artifactId>struts2-core</artifactId> 
    <version>2.3.28</version> 
</dependency> 
でダウンロードした最小限の依存関係
関連する問題