wildfly 未从 web.xml 加载 class
wildfly not loading class from web.xml
无法 运行 war,因为我在 wildfly 中配置了所有模块,
并且这个 war 在 jboss 6 中 运行 具有相同的 web.xml 配置,并且当我在所有迁移设置之后部署在 wildfly 中时,我得到了 classNotFound 异常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
您的 class com.Test.us.web.MessageFilter
似乎对 class 加载程序不可见。有 2 个选项,您可以在其中放置 class:
直接在WAR部署
- 在
WEB-INF/lib/some.jar
- 或者扩展成
WEB-INF/classes
在自定义 WildFly 模块中。在这种情况下,您必须将模块依赖项添加到部署中。可以在以下文件中定义模块依赖项:
- 或者
META-INF/MANIFEST.MF
- 或
META-INF/jboss-deployment-structure.xml
jboss-deployment-structure.xml
文件的示例内容是:
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="your.custom.module"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
无法 运行 war,因为我在 wildfly 中配置了所有模块, 并且这个 war 在 jboss 6 中 运行 具有相同的 web.xml 配置,并且当我在所有迁移设置之后部署在 wildfly 中时,我得到了 classNotFound 异常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
您的 class com.Test.us.web.MessageFilter
似乎对 class 加载程序不可见。有 2 个选项,您可以在其中放置 class:
直接在WAR部署
- 在
WEB-INF/lib/some.jar
- 或者扩展成
WEB-INF/classes
- 在
在自定义 WildFly 模块中。在这种情况下,您必须将模块依赖项添加到部署中。可以在以下文件中定义模块依赖项:
- 或者
META-INF/MANIFEST.MF
- 或
META-INF/jboss-deployment-structure.xml
- 或者
jboss-deployment-structure.xml
文件的示例内容是:
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="your.custom.module"/>
</dependencies>
</deployment>
</jboss-deployment-structure>