java: ClassNotFoundException for com.isomorphic.servlet.DataSourceLoader entry in web.xml
I have specified in web.xml Servlet mapping a开发者_如何学编程s below
<web-app>
<!-- Servlets -->
<servlet>
<servlet-name>DataSourceLoader</servlet-name>
<servlet-class>com.isomorphic.servlet.DataSourceLoader</servlet-class>
</servlet>
</web-app>
In classpath, reference to corresponding jar file is present, also class is shown in referenced libraries listing in package explorer. But still when i run this web application, its give exception of class not found.
Am i missing entry in some file?
Web application is smartGWT based.
OK. So, I will just write it down.
Problem
The problem was, your app server was not able to find the Jar that has this class named com.isomorphic.servlet.DataSourceLoader
Hint
ClassNotFound ensures that the class is not in classpath. Or in other way, the Jar or the class file is somewhere the app-server does not look for.
Solution
App server looks, at least, in WEB-INF/lib and WEB-INF/classes for the Classes or the Jars that might have classes that are being imported somewhere. Now, the Jars in WEB-INF/libs are also available to the code written inside SRC directory (which finally gets compiles and the .class files are copied to WEB-INF/classes directory.
The solution was putting the Jar in WEB-INF/lib directory.
精彩评论