You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dick Hildreth <di...@gmail.com> on 2021/10/05 03:08:31 UTC

The import javax.servlet cannot be resolved

Tomcat 9.0.53
Windows Server 2019 Standard version 1809
OpenJDK  jdk-11.0.8.10-hotspot

I have a JSP/JavaBean webapp.  I deployed all of the class files into the
webapp's classes subdirectory (no WAR file) and the external JAR files are
in the webapp's lib directory.  Of course, the JSPs are in the
webapp's context root.

I try running the webapp from localhost:8080/[appname]/LoginPage.jsp and I
get the subject error with the stacktrace pointing at my JavaBean line:

import javax.servlet.http.HttpServletRequest

I've tried copying *servlet-api.jar* from the tomcat lib directory into my
webapp\lib directory and I've tried putting *javaee-api-8.0.jar* into my
webapp\lib directory and neither helped.

Any insights would be appreciated.

Dick

Re: The import javax.servlet cannot be resolved

Posted by Mark Thomas <ma...@apache.org>.
On 05/10/2021 04:08, Dick Hildreth wrote:
> Tomcat 9.0.53
> Windows Server 2019 Standard version 1809
> OpenJDK  jdk-11.0.8.10-hotspot
> 
> I have a JSP/JavaBean webapp.  I deployed all of the class files into the
> webapp's classes subdirectory (no WAR file) and the external JAR files are
> in the webapp's lib directory.  Of course, the JSPs are in the
> webapp's context root.
> 
> I try running the webapp from localhost:8080/[appname]/LoginPage.jsp and I
> get the subject error with the stacktrace pointing at my JavaBean line:
> 
> import javax.servlet.http.HttpServletRequest
> 
> I've tried copying *servlet-api.jar* from the tomcat lib directory into my
> webapp\lib directory

Never do that.

> and I've tried putting *javaee-api-8.0.jar* into my
> webapp\lib directory and neither helped.

Nor that.

Create the simplest possible web application that re-creates this issue 
(single JSP and single bean). If creating that doesn't help you figure 
out what is wrong, put the source somewhere where we can access it (e.g. 
Github) and we can take a look.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org