deployment - Wildfly : ClassNotFoundException: org.apache.xerces.parsers.SAXParser 部署时
问题描述
部署包含 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",
"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" => "java.xml",
"export-filter" => "Reject",
"import-filter" => "multi-path filter {exclude children of \"META-INF/\", exclude equals \"
META-INF\", default accept}",
"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, Inc., 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。问题不再出现。
推荐阅读
- angular - 外部拦截器库/模块中的角度路由器
- android - Subcomponent.Builder -> 使用seedInstance绑定实例数据时的工厂
- regex - 仅在 sed 中用双引号之间的下划线替换逗号
- splunk - 水槽下沉到 Splunk?
- angular - Clarity Spinner Button 是否有防止从成功状态转换回默认状态的解决方法?
- c - Qt 静态库子模块构建
- php - 如何验证文件数组?
- excel - 将工作簿中的值写入 Sharepoint 上存储的值
- python-3.x - 根据图中数据框中的另一列为节点着色
- python - 如何过滤 Pandas 数据框以显示顶级类别的行?