Issue
I made a folder in my eClipse root as jars
and in sub folders of jars
I placed the relevant jars.
I also added the classpath in Java Build Path
by Add External Jars
[![enter image description here][1]][1]
commons-dbutils-1.7.jar
is the jar that displaying
java.lang.ClassNotFoundException: org.apache.commons.dbutils.DbUtils
eClipse is not displaying any code error but eClipse Tomcat-9
on runtime displaying this and code is not running by showing the following:
HTTP Status 500 ? Internal Server Error
Type Exception Report
Message Servlet execution threw an exception
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
javax.servlet.ServletException: Servlet execution threw an exception
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
Root Cause
java.lang.NoClassDefFoundError: org/apache/commons/dbutils/DbUtils
user.taxonomy.categories.DAO.selectAll(DAO.java:107)
user.taxonomy.categories.view.HTML.selectAll(HTML.java:29)
user.taxonomy.categories.SelectAll.doGet(SelectAll.java:64)
javax.servlet.http.HttpServlet.service(HttpServlet.java:626)
javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
Note The full stack trace of the root cause is available in the server logs.
Please let me know where I am making mistake?
Best Regards [1]: https://i.stack.imgur.com/aaarw.png
Solution
When deploying a project to a Tomcat server, the "Build path" of the project is irrelevant. What counts is the "Deployment assembly" of the project.
Check if all relevant libraries (especially commons-dbutils*.jar
) are listed there.
Answered By - Piotr P. Karwasz