Wildfly: исключение ClassNotFoundException: org.apache.xerces.parsers.SAXParser при развертывании

#deployment #module #wildfly #spring-ws

#развертывание #модуль #wildfly #spring-ws

Вопрос:

Я сталкиваюсь с этой ошибкой при развертывании war, содержащего 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
...

  

Я не могу редактировать код развертывания war, я не разработчик, но я могу откомпилировать его.
Я заметил, что единственная ссылка на 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."};

  

Кто-нибудь может помочь?
На что мне следует обратить внимание?

Ответ №1:

Я должен полностью переустановить wildfly. Проблема больше не возникает.