OmniFaces / Xercex / Naming-Conflict while Migration of JSF-Web-Projekt (Java and Tomcat)
Introduction
We started building and enterprise JSF-Application (Eclipse, Maven, CDI (Open-Web-Beans), Omni-Faces, PrimeFaces, ...) in the last years.
And now we would like to migrate from java 1.8 and tomcat 7 to newer versions.
Problem
We tried running our application on tomcat 9 and openjdk 14, with no success, so we tried to upgrade all our dependencies to compatible versions.
Now we are stuck on starting tomcat (in eclipse 2020-03) with the following exception - without any idea where to continue.
Added Files
I added our pom-file, with our dependencies and versions after the exception. If you need anything else or more details feel free to ask.
I'm looking for anyone who could point me into the right direction of which version of what we are using wrong.
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
exception is repeated two more times - then resumed with:
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
(only dependencies)
<!-- 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>
I was finally able to find an answer.
I found the following Question, which was already answered: java.lang.AbstractMethodError: org.apache.xerces.dom.ElementImpl.getTextContent()Ljava/lang/String
In there the Solution is either to upgrade Xercex or to entirely remove it from \lib.
We were using and internal Jar-File which itself included the old version 2.4.0 of xercex. This was causing the Problems.
Including the following version of xerxes after an internal jar-depency did the fix for me:
<!-- https://mvnrepository.com/artifact/xerces/xercesImpl -->
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.12.0</version>
</dependency>