Hibernate 运行报错,空指针异常

INFO: HHH000401: using driver [oracle.jdbc.driver.OracleDriver] at URL [jdbc:oracle:thin:@localhost:1521:orcl]

九月 15, 2018 11:39:14 上午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

INFO: HHH000046: Connection properties: {user=scott, password=****}

Exception in thread "main" java.lang.NullPointerException

at java.lang.String.<init>(String.java:166)

at oracle.sql.CharacterSet.AL32UTF8ToString(CharacterSet.java:1628)

at oracle.jdbc.driver.DBConversion.CharBytesToString(DBConversion.java:834)

at oracle.jdbc.driver.DBConversion.CharBytesToString(DBConversion.java:773)

at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOauth(T4CTTIoauthenticate.java:816)

at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:376)

at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:441)

at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)

at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)

at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:839)

at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.getConnection(DriverManagerConnectionProviderImpl.java:204)

at org.hibernate.engine.jdbc.internal.JdbcServicesImpl$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcServicesImpl.java:242)

at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:117)

at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:85)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:184)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:156)

at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1827)

at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1785)

at com.util.HibernateUtil.getSessionFactory(HibernateUtil.java:18)

at com.test.Test1.get(Test1.java:61)

at com.test.Test1.main(Test1.java:30)

hibernate.cfg.xml是这样配置的.

<?xml version='1.0' encoding='utf-8'?>

<!DOCTYPE hibernate-configuration PUBLIC

"-//Hibernate/Hibernate Configuration DTD 3.0//EN"

"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">


<hibernate-configuration>

    <session-factory>

         <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>

          <property name="connection.url">jdbc:oracle:thin:@localhost:1521:orcl</property>

         <property name="connection.username">scott</property>

         <property name="connection.password">tiger</property>

          <property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>

         <property name="show_sql">true</property>

  <mapping resource="com/bean/User.hbm.xml"/>

    </session-factory>

</hibernate-configuration>

我看其他同学正确的代码,我出的问题是在方言那里就执行不下去了. 哪位大侠可以帮我看一下是什么问题吗

是oracle的字符集安装不好然后导致这部分取不到值? 如果这样的话,要怎么处理呢.

Lee1227
浏览 1436回答 4
4回答

car

jar包引入正确了么

car

jar包引入正确了么
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java
Oracle