When I use the follow code in eclipse Dynamic Web Project
inside servlet
, like this :
@WebServlet(\"/CreateCustomerServlet\")
publ
Just now I troubleshoot this issue.
properties
of your project. Deployment Assembly
-> add
-> Java Build Path Entries
.And you are done !
Compile time & runtime are two different things. What ever you added right now is just for compile time & build purpose only. Runtime server tries to load the class. Add same jar to project lib folder also (Which will be packaged with WAR and available for the server at runtime).
As your screenshot shows, the mysql jar doesn't appear under the Web App Libraries node. Paste the jar in WebContent/WEB-INF/lib
, and it will be automatically added to the build path and
to the runtime classpath of the webapp (and it will appear under Web App Libraries).
Try doing this:
Make a directory named lib in the root directory of the proyect and put the .jar in it.
In the WEB-INF directory, make a link to lib.
Now, the jar would appear under WebbApp Libraries.
The solution is quite straightforward:
1. Right click on the your web project and choose PROPERTIES
2. Choose the J2EE Module Dependencies
3. Click on the Add External JARs… and then point on your library file (ZIP or JAR)
4. Click on Apply then OK.
5. Restart your Apache Tomcat
The added library should be seen under: ProjectName > Java Resources: src > Libraries > WebApp Libraries.