0

Here is the error:

SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[...]
...
Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletRequestListener
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1449)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1257)
    ... 42 more

I have seen many other stack overflow posts with this similar error message also dealing with Tomcat, but my situation is a little bit different in that it occurred as I switched from Tomcat 9 to Tomcat 10.

I know that the migration from Tomcat 9 to Tomcat 10 requires the switch from the javax packaging to the jakarta packaging. I have tried to make that change everywhere that I know of these old references existing (which is really just in the pom.xml files of my project). So far, I have changed the javax.servlet-api to the jakarta.servlet-api, jaxb-api (was from javax) to jakarta.xml.bind-api, javax.activation-api to jakarta.activation-api, cdi-api (from javax) to jakarta.enterprise.cdi-api, and javax.annotation-api to jakarta.annotation-api.

I have read that jsf is also relavant here so here is what is in my pom for jsf:

<dependency>
  <groupId>com.sun.faces</groupId>
  <artifactId>jsf-api</artifactId>
  <version>2.2.20</version>
</dependency>

<dependency>
  <groupId>com.sun.faces</groupId>
  <artifactId>jsf-impl</artifactId>
  <version>2.2.20</version>
</dependency>

I have also done a project wide search and replace, changing javax to jakarta in each place (and added to the pom.xml files when necessary).

I know that there is probably some sort of configuration that I will need to share in order for the issue to be discovered, but I have no idea where that might be. If there is, something like this that I have missed, please let me know so that I can share.

I do not believe that this is a duplicate of this post or this post (although they are similar issues) as I have already done the search and replace and the error is still present. I have no instances of the word "javax" in my entire project workspace.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
ConfusedUbuntist
  • 135
  • 1
  • 10
  • Does this answer your question? [Tomcat 10.x throws java.lang.NoClassDefFoundError on javax.servlet.\*](https://stackoverflow.com/questions/66711660/tomcat-10-x-throws-java-lang-noclassdeffounderror-on-javax-servlet) – Eskandar Abedini Jun 17 '22 at 17:20
  • That is the first of the links that I have at the bottom. The problem appears to be very similar, but I have made the changes in the answers on the post, and I still have the error. – ConfusedUbuntist Jun 17 '22 at 18:21
  • For anyone else who had a similar issue to me, the answer on the duplicate helped me. – ConfusedUbuntist Jun 27 '22 at 15:16

0 Answers0