Exception in thread "main" org.hibernate.service.classloading.spi.ClassLoadingException: Specified JDBC Driver oralce.jdbc.driver.OracleDriver could not be loaded
at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure (DriverManagerConnectionProviderImpl.java: 111)
at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService (StandardServiceRegistryImpl.java: 76)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService (AbstractServiceRegistryImpl.java: 160)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService (AbstractServiceRegistryImpl.java: 132)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess (JdbcServicesImpl.java: 223)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure (JdbcServicesImpl.java: 89)
at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService (StandardServiceRegistryImpl.java: 76)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService (AbstractServiceRegistryImpl.java: 160)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService (AbstractServiceRegistryImpl.java: 132)
at org.hibernate.cfg.Configuration.buildTypeRegistrations (Configuration.java: 1822)
at org.hibernate.cfg.Configuration.buildSessionFactory (Configuration.java: 1780)
at TeacherTest.main (TeacherTest.java: 23)
Caused by: org.hibernate.service.classloading.spi.ClassLoadingException: Unable to load class [oralce.jdbc.driver.OracleDriver]
at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName (ClassLoaderServiceImpl.java: 152)
at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure (DriverManagerConnectionProviderImpl.java: 106)
... 11 more
Caused by: java.lang.ClassNotFoundException: Could not load requested class: oralce.jdbc.driver.OracleDriver
at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl $ AggregatedClassLoader.findClass (ClassLoaderServiceImpl.java: 319)
at java.lang.ClassLoader.loadClass (ClassLoader.java: 425)
at java.lang.ClassLoader.loadClass (ClassLoader.java: 358)
at java.lang.Class.forName0 (Native Method)
at java.lang.Class.forName (Class.java: 270)
at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName (ClassLoaderServiceImpl.java: 149)
... 12 more
------ Solution ---------------------------- ----------------
built data sources, configure hibernate configuration file when directly elected configured data source on the line.
------ Solution ---------------------------------------- ----
suggest you write a JDBC test the following classes in the project there , see if you can connect successfully.
online there are many such examples , what is the code I've used before , you may need to do some modification to use .
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class cn1 {
public static void main(String[] args) {
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
//The drive is specific for Oracle
Class.forName("oracle.jdbc.driver.OracleDriver");
} catch (java.lang.ClassNotFoundException e) {
System.err.println("mydb(): " + e.getMessage());
}
try {
conn = DriverManager.getConnection(
"jdbc:oracle:thin:@usplgmdb003.iweb.gm.com:1521:gwh21", "gmu", "dragon");
} catch (SQLException ex) {
System.err.println("conn:" + ex.getMessage());
}
if (conn != null)
System.out.println("connection successful");
else
System.out.println("connection failure");
try {
stmt = conn.createStatement();
} catch (SQLException ex) {
System.err.println("createStatement();" + ex.getMessage());
}
try {
rs = stmt.executeQuery("select count(*) from COLLEGE");
} catch (SQLException ex) {
System.err.println("stmt.excuteQuery();" + ex.getMessage());
}
try {
while (rs.next()) {
System.out.println("Row number: " + rs.getInt(1));
}
} catch (SQLException ex) {
System.err.println("A ERROR is failure" + ex.getMessage());
}
}
public static void printClassName(Object obj) {
System.out.println("The class of " + obj + " is "
+ obj.getClass().getName());
}
}
------ For reference only ----------------------------------- ----
hibernate.cfg.xml as follows :
"- / / Hibernate / Hibernate Configuration DTD 3.0 / / EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<-! Database connection settings ->
<-! JDBC connection pool (use the built-in) ->
<-!
<-! SQL dialect ->
<-! Enable Hibernate's automatic session context management ->
<-! Disable the second-level cache ->
<-! Echo all executed SQL to stdout ->
<-! Drop and re-create the database schema on startup ->
<-!
------ For reference only --------------------------- ------------
tone for a day, the great God who seek help , scholarship hibernate, many do not know, brother Xianxie
------ For reference only ---------------------------------------
this project is as follows:
------ For reference only ----- ----------------------------------
Caused by: java.lang.ClassNotFoundException: ; Could not load requested class: oralce.jdbc.driver.OracleDriver
connect to the database jar package into it?
------ For reference only -------------------------------------- -
sorry , the landlord is already imported , but the program can not find the newspaper !
------ For reference only -------------------------------------- -
landlord can build a data source in eclipse , hibernate configuration file after it is generated . Directly with the data source has been built .
------ For reference only ---------------------------------- -----
myeclipse I just opened again , a bomb suddenly pop out . Follows
this project is not a myeclipse hibernate project. assuming hibernate 3 capability
------ For reference only ------ ---------------------------------
beginner , do not quite understand what to build a data source refers to ?
------ For reference only -------------------------------------- -
beginner , do not quite understand what to build a data source refers to ?
------ For reference only ----- ----------------------------------
I remember the first time will be able to write directly to hibernate when running , but this time a variety of problems.
My system is 64-bit win7 Ultimate installed , JDK is 1.7.0_45, myeclipse10 was cracked version . hibernate is 4.2.7
these things affect you ?
------ For reference only -------------------------------------- -
link JDBC can be successful , but fails to connect with hibernate on
------ For reference only --------------------- ------------------
I have solved this problem , specific solutions means forget, anyway, is the East West changed changed , the memory is changed after completing have changed back in
But now actually be able to succeed.
Thank you great God
没有评论:
发表评论