首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >野蝇:部署时的ClassNotFoundException: org.apache.xerces.parsers.SAXParser

野蝇:部署时的ClassNotFoundException: org.apache.xerces.parsers.SAXParser
EN

Stack Overflow用户
提问于 2020-08-22 09:36:55
回答 1查看 1.3K关注 0票数 0

在部署包含spring的war时,我面临这个错误:

代码语言:javascript
复制
{"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]"}}}}

因此,我查看了模块是否已加载(他正在加载):

代码语言:javascript
复制
  /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
            }
        ]
    }
}

我有另一台服务器,在那里部署这个war不会导致错误。

我可以比较它们,但我看不出有什么不同。(特别是standalone.xml )。

jar和main/module.xml在两个服务器上是相同的。acl是等价物。

代码语言:javascript
复制
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>
代码语言:javascript
复制
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
...

我不能编辑部署war的代码,我不是开发人员,但我可以去编译它。我注意到关于org.apache.xerces的唯一参考是:

代码语言:javascript
复制
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."};

有人能帮忙吗?我该去哪儿找呢?

EN

回答 1

Stack Overflow用户

发布于 2020-08-25 14:11:51

我重新安装了完全的野蝇。这个问题再也不会发生了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63534706

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档