User169
User169

Reputation: 81

eClipse: java.lang.ClassNotFoundException: org.apache.commons.dbutils.DbUtils

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.sstatic.net/aaarw.png

Upvotes: 0

Views: 667

Answers (2)

Piotr P. Karwasz
Piotr P. Karwasz

Reputation: 16055

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.

Upvotes: 0

AminM
AminM

Reputation: 856

Your JARs should be in WEB-INF/lib so that Tomcat loads them automatically.

See

What's the correct procedure to add JARs into WEB-INF/lib directory in IntelliJ

For related info

Upvotes: 1

Related Questions