vendredi 2 janvier 2015

java.lang.ClassNotFoundException in Dynamic Web app JSP

I am trying retrieve data from SQLLite DB in a Java Class. This is the part of the web app that uses the Beans and Form processing" as per the tutorial here: http://ift.tt/1Br7dKs


I am getting a persistent error of java.lang.ClassNotFoundException: org.sqlite.JDBC


I have added sqlite-jdbc-3.8.7.jar to the java classpath


This is my code:



public int startConnection() {
Connection c = null;
try {
Class.forName("org.sqlite.JDBC");
c = DriverManager.getConnection("jdbc:sqlite:test.db");
} catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() );
System.exit(0);
return CONNECTION_FAILURE;
}
System.out.println("Opened database successfully");
return CONNECTION_SUCCESSFUL;
}


This is the console output:



Jan 03, 2015 2:42:15 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:webapp01' did not find a matching property.
Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/7.0.57
Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Nov 3 2014 08:39:16 UTC
Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 7.0.57.0
Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Mac OS X
Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 10.10
Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: x86_64
Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JAVA_HOME: /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre
Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_25-b17
Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: /Users/hadi/Documents/workspace/.metadata/.plugins/http://ift.tt/1BglHyI
Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: /Users/hadi/Documents/apache-tomcat-7.0.57
Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=/Users/hadi/Documents/workspace/.metadata/.plugins/http://ift.tt/1BglHyI
Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=/Users/hadi/Documents/apache-tomcat-7.0.57
Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=/Users/hadi/Documents/workspace/.metadata/.plugins/http://ift.tt/1pvLkUI
Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=/Users/hadi/Documents/apache-tomcat-7.0.57/endorsed
Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=UTF-8
Jan 03, 2015 2:42:15 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /Users/hadi/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
Jan 03, 2015 2:42:15 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jan 03, 2015 2:42:15 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jan 03, 2015 2:42:15 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1296 ms
Jan 03, 2015 2:42:15 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jan 03, 2015 2:42:15 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.57
Jan 03, 2015 2:42:16 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jan 03, 2015 2:42:16 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jan 03, 2015 2:42:16 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 913 ms
java.lang.ClassNotFoundException: org.sqlite.JDBC
Jan 03, 2015 2:42:32 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-8080"]


Please anyone solve this problem......Thanks....


Aucun commentaire:

Enregistrer un commentaire