我遇到了常见错误,但无法弄清楚如何对其进行排序。我得到了以下异常,并且我已正确导入ojdbc14.jar文件。它也是在tomcat lib目录下但是应用程序找不到驱动程序。
例外:
INFO: Illegal access: this web application instance has been stopped already. Could not load oracle.jdbc.OracleDriver. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1612)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:278)
at java.sql.DriverManager.isDriverAllowed(DriverManager.java:463)
at java.sql.DriverManager.getConnection(DriverManager.java:215)
at gsmprepaid.DbCon.getMyIvrDataSource(DbCon.java:362)
at com.realsoftinc.dtl.services.DTLDatabaseManagerNoSession.getMyIvrDataSource(DTLDatabaseManagerNoSession.java:142)
at com.realsoftinc.dtl.services.DTLDatabaseManagerNoSession.getCMSMyIvrConnection(DTLDatabaseManagerNoSession.java:166)
at com.realsoftinc.dtl.services.MyIvr1DBThread.run(MyIvr1DBThread.java:138)
Unable to make connection with DB
java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@//ivr-scan.dc.dialog.lk:1521/ivrdb
源代码:
Connection Con = null;
String url = "jdbc:oracle:thin:@//ivr-scan.dc.dialog.lk:1521/ivrdb";
String dbUName = "IVRDTL";
String dbPswd = "ivrdtl";
String Driver = "oracle.jdbc.driver.OracleDriver";
public DbCon() throws InstantiationException, IllegalAccessException,
ClassNotFoundException, SQLException {
Class.forName(this.Driver).newInstance();
}
public Connection getMyIvrDataSource() throws IOException {
try {
System.out.println("Trying to connect");
this.Con = DriverManager.getConnection(this.url, this.dbUName,
this.dbPswd);
System.out
.println("Connection Established Successfull and the DATABASE NAME IS:"
+ Con.getMetaData().getDatabaseProductName());
} catch (Exception e) {
System.out.println("Unable to make connection with DB");
e.printStackTrace();
}
return Con;
}