2015-05-14 62 views
1

無法運行戰爭,因爲我配置了wildfly中的所有模塊, ,並且這場戰爭在jboss 6中運行良好,具有相同的web.xml配置,並且當我在野蠻所有設置遷移,然後我得到ClassNotFound的異常,因爲我有更多的信息在web.xmlwildfly不從web.xml加載類

幾個servlet映射後,請看下面

在Wildfly

我得到以下異常:

這裏的web.xml

http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd」 版本= 「2.5」>

<display-name>Test </display-name> 
    <context-param> 
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name> 
    <param-value>messages</param-value> 
    </context-param> 
    <filter> 
    <filter-name>exportFilter</filter-name> 
    <filter-class>org.displaytag.filter.ResponseOverrideFilter</filter-class> 
    </filter> 
    <filter> 
    <filter-name>encodingFilter</filter-name> 
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> 
    <init-param> 
     <param-name>encoding</param-name> 
     <param-value>UTF-8</param-value> 
    </init-param> 
    <init-param> 
     <param-name>forceEncoding</param-name> 
     <param-value>true</param-value> 
    </init-param> 
    </filter> 
    <filter> 
    <filter-name>messageFilter</filter-name> 
    <filter-class>com.Test.us.web.MessageFilter</filter-class> 
    </filter> 
    <filter> 
</web-app> 

這裏是我的日誌:

17:16:04,774 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC0000 
01: Failed to start service jboss.undertow.deployment.default-server.default-hos 
t./.UndertowDeploymentInfoService: org.jboss.msc.service.StartException in servi 
ce jboss.undertow.deployment.default-server.default-host./.UndertowDeploymentInf 
oService: java.lang.ClassNotFoundException: com.Test.us.web.MessageFilter fr 
om [Module "deployment.TestRWD_JB60_Testing.war:main" from Service Module Lo 
ader] 
     at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoServi 
ce.createServletConfig(UndertowDeploymentInfoService.java:933) 
     at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoServi 
ce.start(UndertowDeploymentInfoService.java:256) 
     at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(Se 
rviceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final] 
     at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceCont 
rollerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final] 
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor. 
java:1142) [rt.jar:1.8.0_40] 
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor 
.java:617) [rt.jar:1.8.0_40] 
     at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_40] 
Caused by: java.lang.ClassNotFoundException: com.Test.us.web.MessageFilter f 
rom [Module "deployment.TestRWD_JB60_Testing.war:main" from Service Module L 
oader] 
     at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java: 
213) [jboss-modules.jar:1.3.3.Final] 
     at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(Con 
currentClassLoader.java:459) [jboss-modules.jar:1.3.3.Final] 
     at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(Concu 
rrentClassLoader.java:408) [jboss-modules.jar:1.3.3.Final] 
     at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentCl 
assLoader.java:389) [jboss-modules.jar:1.3.3.Final] 
     at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoad 
er.java:134) [jboss-modules.jar:1.3.3.Final] 
     at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoServi 
ce.createServletConfig(UndertowDeploymentInfoService.java:724) 
     ... 6 more 


17:16:04,861 ERROR [org.jboss.as.controller.management-operation] (DeploymentSca 
nner-threads - 2) JBAS014613: Operation ("deploy") failed - address: ([("deploym 
ent" => "TestRWD_JB60_Testing.war")]) - failure description: {"JBAS014671: F 
ailed services" => {"jboss.undertow.deployment.default-server.default-host./.Und 
ertowDeploymentInfoService" => "org.jboss.msc.service.StartException in service 
jboss.undertow.deployment.default-server.default-host./.UndertowDeploymentInfoSe 
rvice: java.lang.ClassNotFoundException: com.Test.us.web.MessageFilter from 
[Module \"deployment.TestRWD_JB60_Testing.war:main\" from Service Module Loa 
der] 
    Caused by: java.lang.ClassNotFoundException: com.Test.us.web.MessageFilt 
er from [Module \"deployment.TestRWD_JB60_Testing.war:main\" from Service Mo 
dule Loader]"}} 
17:16:05,048 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018 
559: Deployed "TestRWD_JB60_Testing.war" (runtime-name : "TestRWD_JB60_T 
esting.war") 
17:16:05,052 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBA 
S014774: Service status report 
JBAS014777: Services which failed to start:  service jboss.undertow.deploy 
ment.default-server.default-host./.UndertowDeploymentInfoService: org.jboss.msc. 
service.StartException in service jboss.undertow.deployment.default-server.defau 
lt-host./.UndertowDeploymentInfoService: java.lang.ClassNotFoundException: com.Test.us.web.MessageFilter from [Module "deployment.TestRWD_JB60_Testing.w 
ar:main" from Service Module Loader] 
- See more at: https://developer.jboss.org/message/929842#929842 
+0

你設置他們作爲模塊或放在你的WAR/lib目錄? –

+0

我在war中設置了com.Test.us.web.MessageFilter WEB-INF/classes –

回答

2

看來你的類com.Test.us.web.MessageFilter對於類加載器是不可見的。有2個選項,你可以把這個類:

  1. 直接在WAR 部署

    • 無論是在WEB-INF/lib/some.jar
    • 或擴展到WEB-INF/classes
  2. 在自定義WildFly 模塊中。在這種情況下,您必須將模塊依賴項添加到部署中。該模塊依賴關係可以用下列文件中定義:

    • 要麼META-INF/MANIFEST.MF
    • jboss-deployment-structure.xml文件META-INF/jboss-deployment-structure.xml

樣品內容是:

<jboss-deployment-structure> 
    <deployment> 
     <dependencies> 
      <module name="your.custom.module"/> 
     </dependencies> 
    </deployment> 
</jboss-deployment-structure> 
+0

感謝這個問題通過在lib文件夾中添加jar來解決,感謝您的幫助。 –

相關問題