gpt4 book ai didi

java.lang.AbstractMethodError : org. apache.xerces.jaxp.DocumentBuilderFactoryImpl 不继承抽象 javax.xml.parsers.DocumentBuilderFactory

转载 作者:行者123 更新时间:2023-12-04 13:13:40 29 4
gpt4 key购买 nike

一般:

OmniFaces/Xercex/迁移 JSF-Web-Projekt(Java 和 Tomcat)时的命名冲突

简介
我们在过去几年开始构建和企业 JSF 应用程序(Eclipse、Maven、CDI(Open-Web-Beans)、Omni-Faces、PrimeFaces,...)。
现在我们想从 java 1.8 和 tomcat 7 迁移到更新的版本。

问题
我们尝试在 tomcat 9 和 openjdk 14 上运行我们的应用程序,但没有成功,因此我们尝试将所有依赖项升级到兼容版本。
现在我们被困在启动 tomcat(在 eclipse 2020-03 中),但有以下异常(exception) - 不知道从哪里继续。

添加的文件
我添加了我们的 pom 文件,以及异常之后的依赖项和版本。如果您需要任何其他或更多详细信息,请随时询问。我正在寻找任何可以指出我们使用错误的版本的正确方向的人。

异常(exception):

INFO: OpenSSL successfully initialized [OpenSSL 1.1.1g  21 Apr 2020]
Juni 09, 2020 4:12:29 PM org.apache.coyote.AbstractProtocol init
INFO: Initialisiere ProtocolHandler["http-nio-8080"]
Juni 09, 2020 4:12:30 PM org.apache.catalina.startup.Catalina load
INFO: Server initialization in [1.952] milliseconds
Juni 09, 2020 4:12:30 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Catalina]
Juni 09, 2020 4:12:30 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet engine: [Apache Tomcat/9.0.36]
Juni 09, 2020 4:12:53 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Juni 09, 2020 4:12:53 PM org.omnifaces.ApplicationInitializer logOmniFacesVersion
INFO: Using OmniFaces version 3.6
Juni 09, 2020 4:12:53 PM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/application]]
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:633)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:343)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:474)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/application]]
at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
... 21 more
Caused by: java.lang.IllegalStateException: OmniFaces failed to initialize! Report an issue to OmniFaces.
at org.omnifaces.ApplicationInitializer.onStartup(ApplicationInitializer.java:57)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5128)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
... 27 more
Caused by: java.lang.AbstractMethodError: Receiver class org.apache.xerces.jaxp.DocumentBuilderFactoryImpl does not define or inherit an implementation of the resolved method 'abstract void setFeature(java.lang.String, boolean)' of abstract class javax.xml.parsers.DocumentBuilderFactory.
at org.omnifaces.util.Xml.createDocumentBuilder(Xml.java:88)
at org.omnifaces.util.Xml.createDocument(Xml.java:69)
at org.omnifaces.util.Xml.getNodeTextContents(Xml.java:172)
at org.omnifaces.facesviews.FacesViews.scanAndStoreWelcomeFiles(FacesViews.java:413)
at org.omnifaces.facesviews.FacesViews.registerForwardingFilter(FacesViews.java:266)
at org.omnifaces.ApplicationInitializer.onStartup(ApplicationInitializer.java:54)
... 29 more

异常再重复两次 - 然后继续:

Juni 09, 2020 4:12:53 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-nio-8080"]
Juni 09, 2020 4:12:53 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service [Catalina]
Juni 09, 2020 4:12:53 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-nio-8080"]
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.catalina.loader.WebappClassLoaderBase (file:/N:/Entwicklung_Projekte/Projekt_Framework_41/JSF-Client/Forschung/Tomcat/apache-tomcat-9.0.36/lib/catalina.jar) to field java.io.ObjectStreamClass$Caches.localDescs
WARNING: Please consider reporting this to the maintainers of org.apache.catalina.loader.WebappClassLoaderBase
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

pom 文件:

(仅依赖项)

    <!-- framework.jar -->
<dependency>
<groupId>com.qsc.portalclient.framework</groupId>
<artifactId>framework</artifactId>
<version>0.0.1</version>
</dependency>

<!-- PrimeFaces -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>8.0</version>
</dependency>
<dependency>
<groupId>org.primefaces.extensions</groupId>
<artifactId>primefaces-extensions</artifactId>
<version>8.0.2</version>
</dependency>

<dependency>
<groupId>org.primefaces.extensions</groupId>
<artifactId>resources-ckeditor</artifactId>
<version>8.0.2</version>
<scope>runtime</scope>
</dependency>

<!-- JSF - Mojarra - API & IMPL -->
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<version>2.3.6</version>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<version>2.3.6</version>
</dependency>


<!-- CDI OpenWebBeans -->
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>2.0.SP1</version>
</dependency>
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-impl</artifactId>
<version>2.0.16</version>
</dependency>
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-spi</artifactId>
<version>2.0.16</version>
</dependency>
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-web</artifactId>
<version>2.0.16</version>
</dependency>
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-jsf</artifactId>
<version>2.0.16</version>
</dependency>
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-el22</artifactId>
<version>2.0.16</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.10</version>
</dependency>

<!-- JSP Library -->
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.3</version>
</dependency>
<!-- JSTL Library -->
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
<version>1.2</version>
</dependency>

<!-- OmniFaces -->
<dependency>
<groupId>org.omnifaces</groupId>
<artifactId>omnifaces</artifactId>
<version>3.6</version>
</dependency>

最佳答案

我终于找到了答案。

我发现了以下问题,该问题已得到解答: java.lang.AbstractMethodError: org.apache.xerces.dom.ElementImpl.getTextContent()Ljava/lang/String

解决方案是升级 Xercex 或将其从\lib 中完全删除。

我们使用的是内部 Jar 文件,它本身包含 xercex 的旧版本 2.4.0。这导致了问题。

在内部 jar-dependency 为我修复后包括以下版本的 xerxes:

<!-- https://mvnrepository.com/artifact/xerces/xercesImpl -->
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.12.0</version>
</dependency>

关于java.lang.AbstractMethodError : org. apache.xerces.jaxp.DocumentBuilderFactoryImpl 不继承抽象 javax.xml.parsers.DocumentBuilderFactory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62285448/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com