Problem description
Baidu’s many solutions are hard to make, too desperate. (fall)
You must find out the error information and your own use scenario to search, so as to find the correct solution
For example, I use Maven to create a normal Java Web project. Manually added webapp items.
As shown in the error message, it is really the problem that the package javax. Servlet does not exist. But all my bags came in, and there was no error, as shown in the figure below
Then I played with Maven’s clean and compile and idea’s cache clearing, which were useless. Of course, it’s not what other blogs say about setting environment variables and manually copying the package to Tomcat.
solve
The problem is indeed the lack of servlet package, but it is not in the compiled file. The following figure shows the directory structure that should be generated normally
If the idea is the publishing method of the set Project Name: War expanded
, the war package will be generated in the target folder
If there is no javax.servlet in the Lib directory of the war package, check it as follows:
1、< packaging> war
2. Manually added webapp projects have such problems
Summary: pay attention to whether there are missing packages in the compiled file. The problem must be found with the use scenario.
Similar Posts:
- import javax.servlet.http.HttpSession;
- [Solved] pom.xml File Error: web.xml is missing and
is set to true - [Solved] IDEA: JSP Could Not Use session Build-in Object
- [Eclipse]–Error:The superclass “javax.servlet.http.HttpServlet” was not found on the J…
- Tomcat Startup Error: Server Tomcat v8.5 Server at localhost failed to start.
- Tomcat10 Error: java.lang.NoClassDefFoundError: javax/servlet/ServletContextListener
- HTTP Status 500 – Unable to compile class for JSP settlement program
- [Solved] org.apache.jasper.JasperException: java.lang.IllegalStateException: No output folder
- The following table: unable to import javax. Servlet. HttpServletRequest
- The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path