I'm now trying to fix this for three days without success. I was working on a JSF Project for a few weeks and had non problems and without knowingly changing anything a few days ago my tomcat did not start anymore. So I tried fixing it and even reinstalled tomcat, eclipse and set up the project again with little success. Now tomcat starts again but it shows me this:
Error message in browser It says:
"HTTP Status 404 – not found
Type: Status Report
Message: The requested resource [/Immobiliendatenbank/mainBoard.xhtml] is not available
Description: The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. Apache Tomcat/10.0.13"
I don't know why and tried so many suggestions from stack overflow and other sites which got posted to people with similar problems but nothing works.
Here are more details of the project that I think might give a clue:
Console Log:
Critical error during deployment:
java.lang.NoClassDefFoundError: jakarta/faces/context/FacesContextFactory
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1012)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:524)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:427)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:421)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:420)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:467)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1428)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1252)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:467)
at jakarta.faces.FactoryFinderInstance.getImplGivenPreviousImpl(FactoryFinderInstance.java:410)
at jakarta.faces.FactoryFinderInstance.getImplementationInstance(FactoryFinderInstance.java:338)
at jakarta.faces.FactoryFinderInstance.getFactory(FactoryFinderInstance.java:183)
at jakarta.faces.FactoryFinder.getFactory(FactoryFinder.java:264)
at com.sun.faces.config.processor.FactoryConfigProcessor.lambda$verifyFactoriesExist$0(FactoryConfigProcessor.java:289)
at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:283)
at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:198)
at com.sun.faces.config.ConfigManager.lambda$initialize$0(ConfigManager.java:263)
at java.base/java.util.AbstractList$RandomAccessSpliterator.forEachRemaining(AbstractList.java:720)
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:261)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:206)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4715)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5179)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
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:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:886)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
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:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:263)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:432)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:927)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:795)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:345)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:476)
Caused by: java.lang.ClassNotFoundException: jakarta.faces.context.FacesContextFactory
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 60 more
My web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!-- ===========================================================================
web.xml - Last update ==> <display-name>
Verzeichnis: {Projekt}/WebContent/WEB-INF/
Version für TomEE 9
============================================================================ -->
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" id="WebApp_ID" version="4.0">
<display-name>Immobiliendatenbak</display-name>
<description>web xml fuer die Immobiliendatenbank
</description>
<welcome-file-list>
<welcome-file>mainBoard.xhtml</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
<url-pattern>*.xhtml</url-pattern>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>35</session-timeout>
</session-config>
<mime-mapping>
<extension>html</extension>
<mime-type>text/html;charset=UTF-8</mime-type>
</mime-mapping>
<mime-mapping>
<extension>txt</extension>
<mime-type>text/plain;charset=UTF-8</mime-type>
</mime-mapping>
<mime-mapping>
<extension>png</extension>
<mime-type>image/png</mime-type>
</mime-mapping>
<mime-mapping>
<extension>svg</extension>
<mime-type>image/svg+xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>ttf</extension>
<mime-type>application/font-sfnt</mime-type>
</mime-mapping>
<mime-mapping>
<extension>jpg</extension>
<mime-type>image/jpeg</mime-type>
</mime-mapping>
<mime-mapping>
<extension>gif</extension>
<mime-type>image/gif</mime-type>
</mime-mapping>
<context-param>
<param-name>jakarta.faces.ENABLE_CDI_RESOLVER_CHAIN</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>jakarta.faces.validator.ENABLE_VALIDATE_WHOLE_BEAN</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>jakarta.faces.FACELETS_REFRESH_PERIOD</param-name>
<param-value>0</param-value>
</context-param>
<context-param>
<description>true: Kommentare entfernen. (Ist eine Alternative zu ui:remove)
</description>
<param-name>jakarta.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>jakarta.faces.FACELETS_VIEW_MAPPINGS</param-name>
<param-value>*.jsf;*.xhtml</param-value>
</context-param>
<context-param>
<description>Valid values: Development, Production, SystemTest and
UnitTest
</description>
<param-name>jakarta.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<description>If true, rendered HTML code will be formatted, so that it is
'human-readable' i.e. additional line separators and whitespace will be
written, that do not influence the HTML code. Default is 'true'
</description>
<param-name>org.apache.myfaces.PRETTY_HTML</param-name>
<param-value>true</param-value>
</context-param>
</web-app>
My faces-config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config>
<!-- ===========================================================================
faces-config.xml - JSF 3.0 Konfigurationsdatei
Verzeichnis: {Projekt}/WebContent/WEB-INF/
Version: 2021-12-04
============================================================================ -->
<faces-config version="2.3" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_3.xsd">
<application>
<locale-config>
<default-locale>de</default-locale>
<supported-locale>en</supported-locale>
</locale-config>
</application>
<navigation-rule>
<from-view-id>/insertBoard.xhtml</from-view-id>
<navigation-case>
<from-outcome>user</from-outcome>
<to-view-id>/user.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>admin</from-outcome>
<to-view-id>/admin.xhtml</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>
<managed-bean>
<managed-bean-name>mb_db</managed-bean-name>
<managed-bean-class>net.lehre_online.bw.DatabaseConection</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
<managed-property>
<description>true: Connections werden über einen Connection pool
verwaltet
</description>
<property-name>use_pool</property-name>
<value>false</value>
</managed-property>
<managed-property>
<property-name>user</property-name>
<value>user</value>
</managed-property>
<managed-property>
<property-name>pw</property-name>
<value>password</value><!-- FAlls PAsswort bei der MySql Datenbank -->
</managed-property>
<managed-property>
<property-name>constr</property-name>
<value>jdbc:mysql://localhost:3306/db</value>
</managed-property>
<managed-property>
<property-name>logfile</property-name>
<value>browse.log</value>
</managed-property>
</managed-bean>
</faces-config>
And one of the xhtml sites which I right click on in Eclipse (Run As --> Run on Server):
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html>
<!-- ===========================================================================
login.xhtml - Startseite für Navigationsbeispiel
============================================================================ -->
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<ui:composition template="/masterLayout.xhtml">
<ui:define name="title">Immobiliensuche</ui:define>
<ui:define name="content">
<h:form>
<h4>Bitte geben Sie alle benötiigten Daten ein die uns helfen
könnten Ihre Traumimobilie zu finden.</h4>
<div class="container overflow-hidden">
<div class="row gy-9">
<!-- Dropdown auswhl möglichkeiten -->
<div class="input-group flex-nowrap">
<span class="input-group-text col-4" id="Immo-wrapping">Immobilienart:</span>
<p:selectOneMenu class="coll-5" id="auswahlImmobilienart"
value="#{MbSuchmaske.immobilienart}">
<f:selectItem itemLabel="Klicken zum auswählen!" itemValue="" />
<f:selectItem itemLabel="Eigentumswohnung"
itemValue="Eigentumswohnung" />
<f:selectItem itemLabel="Einfamilienhaus"
itemValue="Einfamilienhaus" />
<f:selectItem itemLabel="Mehrfamilienhaus"
itemValue="Mehrfamilienhaus" />
<f:selectItem itemLabel="Reihenhaus" itemValue="Reihenhaus" />
<f:selectItem itemLabel="Grundstück" itemValue="Grundstück" />
</p:selectOneMenu>
</div>
<div class="input-group flex-nowrap">
<span class="input-group-text col-4" id="Immo-wrapping">Stadt:</span>
<p:selectOneMenu id="stadtAuswahl" value="#{MbSuchmaske.stadt}">
<f:selectItem itemLabel="Klicken zum auswählen!" itemValue="" />
<f:selectItem itemLabel="Berlin" itemValue="Berlin" />
<f:selectItem itemLabel="Hamburg" itemValue="Hamburg" />
<f:selectItem itemLabel="München" itemValue="München" />
<f:selectItem itemLabel="Köln" itemValue="Köln" />
</p:selectOneMenu>
</div>
<h3>Zum verfeinern der Suche:</h3>
<H5></H5>
<h4>Die Grundfläche:</h4>
<div class="input-group flex-nowrap">
<span class="input-group-text col-4" id="addon-wrapping">
Minimale Grundfläche</span> <label for="customRange2"
class="form-label"></label>
<h:inputHidden id="minGrundflaeche_id" min="0" max="10000"
value="#{MbSuchmaske.minGrundflaeche}" />
<p:slider for="minGrundflaeche_id"
display="output_minGrundflaeche" minValue="0" maxValue="10000"
class="form-range" displayTemplate="{value} m²" />
<h:outputText id="output_minGrundflaeche"
value="#{MbSuchmaske.minGrundflaeche}" />
</div>
<div class="input-group flex-nowrap">
<span class="input-group-text col-4" id="addon-wrapping">
Maximale Grundfläche</span> <label for="customRange2"
class="form-label"></label>
<h:inputHidden id="maxGrundflaeche_id" min="0" max="10000"
value="#{MbSuchmaske.maxGrundflaeche}" />
<p:slider for="maxGrundflaeche_id"
display="output_maxGrundflaeche" minValue="0" maxValue="10000"
class="form-range" displayTemplate="{value} m²" />
<h:outputText id="output_maxGrundflaeche"
value="#{MbSuchmaske.maxGrundflaeche}" />
</div>
<h4>Die Wohnfläche:</h4>
<div class="input-group flex-nowrap">
<span class="input-group-text col-4" id="addon-wrapping">
Minimale Wohnfläche</span> <label for="customRange2" class="form-label"></label>
<h:inputHidden id="minWohnflaeche_id" min="0" max="1000"
value="#{MbSuchmaske.minWohnflaeche}" />
<p:slider for="minWohnflaeche_id" display="output_minWohnflaeche"
minValue="0" maxValue="1000" class="form-range"
displayTemplate="{value} m²" />
<h:outputText id="output_minWohnflaeche"
value="#{MbSuchmaske.minWohnflaeche}" />
</div>
<div class="input-group flex-nowrap">
<span class="input-group-text col-4" id="addon-wrapping">
Maximale Wohnfläche</span> <label for="customRange2" class="form-label"></label>
<h:inputHidden id="maxWohnflaeche_id" min="0" max="1000"
value="#{MbSuchmaske.maxWohnflaeche}" />
<p:slider for="maxWohnflaeche_id" display="output_maxWohnflaeche"
minValue="0" maxValue="1000" class="form-range"
displayTemplate="{value} m²" />
<h:outputText id="output_maxWohnflaeche"
value="#{MbSuchmaske.maxWohnflaeche}" />
</div>
<h4>Preis</h4>
<div class="input-group flex-nowrap">
<span class="input-group-text col-4" id="addon-wrapping">
Maximaler Immobilienpreis</span> <label for="customRange2"
class="form-label"></label>
<h:inputHidden id="preis_id" min="0" max="1000000"
value="#{MbSuchmaske.preis}" />
<p:slider for="preis_id" display="output_preis" minValue="0"
maxValue="1000000" class="form-range"
displayTemplate="{value} €" />
<h:outputText id="output_preis" value="#{MbSuchmaske.preis}" />
</div>
</div>
</div>
<div class="container overflow-hidden">
<div class="row gy-9">
<h:commandButton value="Suchen!"
actionListener="#{MbSuchmaske.suchErgebnis}"
action="resultBoard.xhtml" />
</div>
</div>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
I use Eclipse IDE for Enterprise Java and Web Developers with Version: 2022-03 (4.23.0)
Apache Tomcat 10.0.13
I hope anyone can help me with this.