Why getting NoClassDefFound for class that is in jar in lib folder?

Viewed 48

Using Tomcat7, I load a Jasper class via urlClassLoader and when I call the constructor, I get a throwable NoClassDefFoundError complaining that it can't find an apache/poi class that it should have been able to find in the project WEB-INF/lib, since the poi jar is in that folder.

Why isn't it automatically searching and loading the class from the tomcat lib folder?

Class<?> JRXlsExporter = urlClassLoader.loadClass("net.sf.jasperreports.engine.export.JRXlsExporter");
Constructor constructor = JRXlsExporter.getConstructor();        // throws  java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Sheet
0 Answers
Related