2013-10-07 54 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会解决许多关于罐子丢失,冲突等问题。