2013-10-07 81 views
0

我想用struts2 + jboss 4.2.1來配置一個項目。我做了很多測試和試驗,我已經閱讀了很多東西,但是我不能讓它工作。錯誤的Struts 2 struts-default.xml

我想創建一個簡單的頁面索引。我嘗試過更改各種庫來設置Jboss中的類路徑庫,但沒有任何內容。總是相同的錯誤:

SEVERE: Dispatcher initialization failed 
Unable to load configuration. - Bean - jar: 

WebContent/WEB-INF/lib/struts2-core-2.1.8.1.jar!/Struts-default.xml: 85:158 
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration 

使用庫

common-lang3.jar 
commons-beanutils-1.7.0.jar 
commons-chain-1.2.jar 
commons-fileupload-1.2.1.jar 
commons-io-1.3.2.jar 
commons-logging-1.1.1.jar 
commons-validator.jar 
freemarker-2.3.19.jar 
javassist.jar 
ognl-2.6.11.jar 
servlet-api-6.0.29.jar 
struts2-core-2.1.8.1.jar 
xwork-2.1.3.jar 
xwork-core-2.2.1.jar 

在我添加的標籤與struts2的 我試過完全相同的項目與Tomcat的配置web.xml文件,沒有問題的作品。 我也試圖把項目中的lib放在jboss中,但沒有任何改變!

<?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/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> 
    <display-name>ViaProva</display-name> 


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

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

至於struts.xml這是配置。這一切似乎罐子我也改了好幾次在網提出的非常線性的版本,但它是不夠的

<?xml version="1.0" encoding="UTF-8" ?> 
<!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.devMode" value="true" /> 

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

     <action name="addCustomerAction" 
      class="it.niuma.via.action.CustomerAction" method="addCustomer" > 
      <result name="success">pages/customer.jsp</result> 
     </action> 

     <action name="listCustomerAction" 
      class="it.niuma.via.action.CustomerAction" method="listCustomer" > 
      <result name="success">pages/customer.jsp</result> 
     </action> 

    </package> 

</struts> 

有誰知道給我一些建議嗎?

+1

爲什麼你的圖書館版本不同?確保struts2 jars應該具有相同的版本 –

+0

使用Maven來管理項目中的依賴關係,而不是手動執行。 –

+0

也包含整個堆棧跟蹤。 –

回答

0

通常,此錯誤消息指的是struts jar之間的衝突。

我會建議你使用Maven,而不是手動下載jar。 Maven會解決許多關於罐子丟失,衝突等問題。