Tomcat servlet problem - class not found

I am trying to learn how to design a servlet to run under the Apache Tomcat server in Windows XP. I am using Tomcat 6.0 with Java SDK 1.6.0_17. My webapp is a simple Hello, world type that I create using the latest version of the Eclipse IDE. I can run all the examples in a Tomcat installation, but when I export my application from Eclipse to the Tomcat webapps folder and try to access it from my browser, I get errors indicating that the class javax.servlet.http.Servletcan't. I was looking for the SDK tree and could not find anything with javaxin the name, so I guess it doesn't exist.

I googled around, but found nothing with this exact, same problem. Any suggestions that I can try?

0
source share
2 answers

the servlet class in servlet.jar, which is part of Java EE (part of the "Enterprise" Java), not a regular JDK distribution. This is usually in the Tomcat path, so once you get your application deployed to Tomcat, there is little problem finding it.

Usually the problem with this bank is that it is usually not in the path of the Eclipse class, so you get compilation problems.

If it is really missing at Tomcat runtime, try searching for it in the project library dependencies (I can never figure out where Eclipse hides this content) and copy it to the "common / lib" subdirectory of your Tomcat installation.

+4
source

servlet-api.jar Tomcat, .. Tomcat/lib.

, , , . , Tomcat ( Tomcat/lib) Eclipse , , JDK/lib. . , . / . .

webapps Eclipse, Eclipse Java EE Tomcat Eclipse Servers Dynamic Web Project, Tomcat .

Eclipse Tomcat ( JSF, ).

: , javax.servlet.http.Servlet . javax.servlet.Servlet, javax.servlet.http.HttpServlet. , , , , .

+2

Source: https://habr.com/ru/post/1730687/


All Articles