Reputation:
I am calling a java class from a JSP file. The java class uses the Apache POI to read an excel file and return some results back to the jsp file. I have added the Maven dependency for Apache POI 3.9. The project compiles without any problem. But when i run the project, it is throwing the following runtime exception. I understand that it is not able to find the jar related to the apache POI, but i have the jar in my Maven repository. Some insights here would be helpful.
javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Cell
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.index_jsp._jspService(index_jsp.java:124)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
Upvotes: 1
Views: 2972
Reputation: 308908
Tomcat will not find the class if the POI JAR isn't in the WEB-INF/lib of your deployment.
Check your WAR or exploded deployment to see if it's there. If not, figure out how to put it there.
Maven is doing you no good that I can see. Learn how to do it properly without Maven first.
Upvotes: 5