问题描述
在部署包含spring-ws的战争时,我遇到此错误:
{"WFLYCTL0062: Composite operation Failed and was rolled back. Steps that Failed:" => {"Operatio
n step-2" => {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"FLUX-WSApp.war\".undertow-deploym
ent" => "org.springframework.beans.factory.BeanCreationException: Error creating bean
...
Caused by: org.xml.sax.SAXException: SAX2 driver class org.apache.xerces.parsers.SAXParser not found
java.lang.classNotFoundException: org.apache.xerces.parsers.SAXParser from [Module \"deployment.FLUX-WSApp.
war\" from Service Module Loader]
Caused by: java.lang.classNotFoundException: org.apache.xerces.parsers.SAXParser from [Module \"deploym
ent.FLUX-WSApp.war\" from Service Module Loader]"}}}}
所以我查看了模块是否已加载(他是):
/core-service=module-loading:module-info(name=org.apache.xerces)
{
"outcome" => "success","result" => {
"name" => "org.apache.xerces","main-class" => undefined,"fallback-loader" => undefined,"dependencies" => [
{
"dependency-name" => "ModuleDependency","module-name" => "java.base","export-filter" => "Reject","import-filter" => "multi-path filter {exclude children of \"meta-inf/\",exclude equals \"
meta-inf\",default accept}","optional" => false
},{
"dependency-name" => "ModuleDependency","module-name" => "jdk.xml.dom","module-name" => "java.xml","optional" => false
}
],"local-loader-class" => undefined,"resource-loaders" => [
{
"type" => "org.jboss.modules.JarFileResourceLoader","paths" => [
"","org/w3c/dom/html","org/w3c","org/apache/xerces/xni/parser","org/apache/xerces/xpointer","meta-inf/maven/xerces/xercesImpl","org/apache/xerces/impl/xpath/regex","org/apache/html","org/apache/xerces/impl/dv","org/apache/html/dom","org/apache/wml","org/w3c/dom","org/apache/xerces/parsers","org/apache/xerces/dom/events","org/apache/xerces/xs/datatypes","org/apache/xerces/impl/dv/dtd","org/apache/xerces/xni/grammars","org/apache/xerces/impl/dv/util","org/apache/xerces/dom","meta-inf/maven/xerces","org/apache/xerces/impl/io","org/apache/xerces/dom3/as","org/apache/xerces/dom3","meta-inf","org/apache/xerces/impl/xs/traversers","meta-inf/maven","org/apache/xerces/xni","org/apache/xerces/impl","org/apache/xerces/impl/xs/util","meta-inf/services","org/apache/xerces/xs","org/apache/xerces/xinclude","org/apache/xerces/impl/dv/xs","org/apache/xerces/jaxp/validation","org/apache","org/apache/xerces/impl/validation","org/apache/xml","org/apache/xerces/util","org/apache/xerces/stax/events","org/apache/xerces/impl/xs/identity","org/apache/xerces/impl/dtd","org/apache/wml/dom","org","org/apache/xerces/jaxp","org/apache/xerces/impl/xs/models","org/apache/xml/serialize","org/apache/xerces/impl/xpath","org/apache/xerces/impl/msg","org/apache/xerces/jaxp/datatype","org/apache/xerces","org/apache/xerces/impl/dtd/models","org/apache/xerces/impl/xs","org/apache/xerces/impl/xs/opti","org/apache/xerces/stax"
]
},{
"type" => "org.jboss.modules.NativeLibraryResourceLoader","paths" => undefined
}
]
}
}
我可以比较它们,但是看不到任何区别。(特别是在standalone.xml中)。
jar和main / module.xml在两个服务器上相同。 ACL完全相同。
cat ~/modules/system/layers/base/org/apache/xerces/main/module.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ JBoss,Home of Professional Open Source.
~ copyright 2011,Red Hat,Inc.,and individual contributors
~ as indicated by the @author tags. See the copyright.txt file in the
~ distribution for a full listing of individual contributors.
~
~ This is free software; you can redistribute it and/or modify it
~ under the terms of the GNU Lesser General Public License as
~ published by the Free Software Foundation; either version 2.1 of
~ the License,or (at your option) any later version.
~
~ This software is distributed in the hope that it will be useful,~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or fitness FOR A PARTIculaR PURPOSE. See the GNU
~ Lesser General Public License for more details.
~
~ You should have received a copy of the GNU Lesser General Public
~ License along with this software; if not,write to the Free
~ Software Foundation,51 Franklin St,Fifth Floor,Boston,MA
~ 02110-1301 USA,or see the FSF site: http://www.fsf.org.
-->
<module name="org.apache.xerces" xmlns="urn:jboss:module:1.8">
<resources>
<resource-root path="xercesImpl-2.12.0.SP02.jar"/>
</resources>
<dependencies>
<module name="jdk.xml.dom"/>
<module name="java.xml"/>
</dependencies>
</module>
ll ./modules/system/layers/base/org/apache/xerces/main/
total 1800
-rw-r--r-- 1 wildfly-flux wildfly-flux 1366 Jul 3 11:33 module.xml
-rw-r--r-- 1 wildfly-flux wildfly-flux 1835126 Jul 3 11:33 xercesImpl-2.12.0.SP02.jar
jar -tvf ./modules/system/layers/base/org/apache/xerces/main/xercesImpl-2.12.0.SP02.jar |grep SAX
...
2177 Fri Aug 24 11:10:24 CEST 2018 org/apache/xerces/parsers/SAXParser.class
...
9918 Fri Aug 24 11:10:26 CEST 2018 org/apache/xerces/jaxp/SAXParserImpl.class
...
我不能编辑部署战争的代码,我不是开发人员,但可以反编译它。 我注意到有关org.apache.xerces的唯一参考是:
package org.springframework.instrument.classloading;
...
/**
* ClassLoader decorator that shadows an enclosing ClassLoader,* applying registered transformers to all affected classes.
...
public class ShadowingClassLoader extends DecoratingClassLoader {
/** Packages that are excluded by default */
public static final String[] DEFAULT_EXCLUDED_PACKAGES =
new String[] {"java.","javax.","sun.","oracle.","com.sun.","com.ibm.","COM.ibm.","org.w3c.","org.xml.","org.dom4j.","org.eclipse","org.aspectj.","net.sf.cglib","org.springframework.cglib","org.apache.xerces.","org.apache.commons.logging."};
有人可以帮忙吗? 我应该去哪里找?
解决方法
我已经完全重新安装了wildfly。该问题不再发生。