I am running a web application from NetBeans 13 (also recently upgraded).
I just upgraded to Tomcat 10 and therefore changed all import statements in the application from javax.servlet
to jakarta.servlet
.
When I run the application, I still get an exception:
java.lang.ClassNotFoundException: javax.servlet.jsp.tagext.TagLibraryValidator
I have checked to ensure that I don't include any Tomcat APIs in my WEB-INF/lib
, and I don't.
Also, if I include
<Loader jakartaConverter="TOMCAT" />
in my META-INF/context.xml
, my application runs correctly.
Therefore, I think that there is still a reference to javax.servlet
somewhere in my code or in my NetBeans config but I'm not sure what else I can update. Is there something I need to update in the JSP's themselves?
I updated the web-app element in my WEB-INF/web.xml file from
<web-app version="3.1" 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-app_3_1.xsd">
to:
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee
https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd"
version="5.0">
This did not fix the issue.
Also, I noticed that in the project.properties
file, there is a property called j2ee.platform
which is set to 1.7-web
. Can it be that this references the old javax libraries and needs to be changed? How can I change this and to what should it be changed if so? Is there something via the NetBeans console that allows me to change this?