为了账号安全,请及时绑定邮箱和手机立即绑定

Hibernate 运行报错,空指针异常

Hibernate 运行报错,空指针异常

Lee1227 2018-09-15 11:58:29
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 configureINFO: 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的字符集安装不好然后导致这部分取不到值? 如果这样的话,要怎么处理呢.
查看完整描述

4 回答

?
car

TA贡献184条经验 获得超33个赞

jar包引入正确了么

查看完整回答
反对 回复 2018-10-15
?
car

TA贡献184条经验 获得超33个赞

jar包引入正确了么

查看完整回答
反对 回复 2018-10-15
  • 4 回答
  • 0 关注
  • 1435 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信