问答详情
源自:1-11 通过Hibernate API编写访问数据库的代码

测试异常 org.hibernate.annotations.common.Version <clinit>,求指教

七月 15, 2016 4:40:59 下午 org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.2.Final}
七月 15, 2016 4:40:59 下午 org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.2.4.Final}
七月 15, 2016 4:40:59 下午 org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
七月 15, 2016 4:40:59 下午 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
七月 15, 2016 4:40:59 下午 org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
七月 15, 2016 4:40:59 下午 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
七月 15, 2016 4:40:59 下午 org.hibernate.internal.util.xml.DTDEntityResolver resolveEntity
WARN: HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
七月 15, 2016 4:40:59 下午 org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: students.hbm.xml
七月 15, 2016 4:40:59 下午 org.hibernate.internal.util.xml.DTDEntityResolver resolveEntity
WARN: HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
七月 15, 2016 4:40:59 下午 org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: null
七月 15, 2016 4:40:59 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
七月 15, 2016 4:40:59 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000115: Hibernate connection pool size: 20
七月 15, 2016 4:40:59 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000006: Autocommit mode: false
七月 15, 2016 4:40:59 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql:///students?useUnicode=true&characterEncoding=UTF-8]
七月 15, 2016 4:40:59 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000046: Connection properties: {user=root, password=****}
七月 15, 2016 4:40:59 下午 org.hibernate.engine.jdbc.internal.JdbcServicesImpl configure
WARN: HHH000342: Could not obtain connection to query metadata : Access denied for user 'root'@'localhost' (using password: NO)
七月 15, 2016 4:40:59 下午 org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
七月 15, 2016 4:40:59 下午 org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation
INFO: HHH000422: Disabling contextual LOB creation as connection was null
七月 15, 2016 4:40:59 下午 org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000399: Using default transaction strategy (direct JDBC transactions)
七月 15, 2016 4:40:59 下午 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory
七月 15, 2016 4:41:00 下午 org.hibernate.tool.hbm2ddl.SchemaExport execute
INFO: HHH000227: Running hbm2ddl schema export
七月 15, 2016 4:41:00 下午 org.hibernate.tool.hbm2ddl.SchemaExport execute
ERROR: HHH000231: Schema export unsuccessful
java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:885)
    at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3421)
    at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1247)
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2775)
    at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
    at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.getConnection(DriverManagerConnectionProviderImpl.java:204)
    at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51)
    at org.hibernate.tool.hbm2ddl.DatabaseExporter.<init>(DatabaseExporter.java:52)
    at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:367)
    at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:304)
    at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:293)
    at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:500)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1790)
    at StudentsTest.init(StudentsTest.java:27)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

七月 15, 2016 4:41:00 下午 org.hibernate.tool.hbm2ddl.SchemaExport execute
INFO: HHH000230: Schema export complete
七月 15, 2016 4:41:00 下午 org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
WARN: SQL Error: 1045, SQLState: 28000
七月 15, 2016 4:41:00 下午 org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
ERROR: Access denied for user 'root'@'localhost' (using password: NO)

提问者:略坑 2016-07-15 16:45

个回答

  • 我是叶霖
    2019-06-22 14:12:13

    六月 22, 2019 2:05:36 下午 org.hibernate.annotations.common.Version <clinit>

    INFO: HCANN000001: Hibernate Commons Annotations {4.0.2.Final}

    六月 22, 2019 2:05:36 下午 org.hibernate.Version logVersion

    INFO: HHH000412: Hibernate Core {4.2.4.Final}

    六月 22, 2019 2:05:36 下午 org.hibernate.cfg.Environment <clinit>

    INFO: HHH000206: hibernate.properties not found

    六月 22, 2019 2:05:36 下午 org.hibernate.cfg.Environment buildBytecodeProvider

    INFO: HHH000021: Bytecode provider name : javassist

    六月 22, 2019 2:05:36 下午 org.hibernate.cfg.Configuration configure

    INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml

    六月 22, 2019 2:05:36 下午 org.hibernate.cfg.Configuration getConfigurationInputStream

    INFO: HHH000040: Configuration resource: /hibernate.cfg.xml

    六月 22, 2019 2:05:36 下午 org.hibernate.cfg.Configuration addResource

    INFO: HHH000221: Reading mappings from resource: Students.hbm.xml


  • qq_梦想天开_0
    2017-07-01 15:35:02

    七月 01, 2017 3:41:03 下午 org.hibernate.annotations.common.Version <clinit>

    INFO: HCANN000001: Hibernate Commons Annotations {4.0.0.Final}

    七月 01, 2017 3:41:03 下午 org.hibernate.Version logVersion

    INFO: HHH000412: Hibernate Core {4.0.0.CR6}

    七月 01, 2017 3:41:03 下午 org.hibernate.cfg.Environment <clinit>

    INFO: HHH000206: hibernate.properties not found

    七月 01, 2017 3:41:03 下午 org.hibernate.cfg.Environment buildBytecodeProvider

    INFO: HHH000021: Bytecode provider name : javassist

    七月 01, 2017 3:41:04 下午 org.hibernate.cfg.Configuration configure

    INFO: HHH000043: Configuring from resource: /Hibernate.cfg.xml

    七月 01, 2017 3:41:04 下午 org.hibernate.cfg.Configuration getConfigurationInputStream

    INFO: HHH000040: Configuration resource: /Hibernate.cfg.xml


  • 小小俏皮
    2017-04-12 20:10:29

    四月 12, 2017 8:07:40 下午 org.hibernate.annotations.common.Version <clinit>

    INFO: HCANN000001: Hibernate Commons Annotations {4.0.2.Final}

    四月 12, 2017 8:07:40 下午 org.hibernate.Version logVersion

    INFO: HHH000412: Hibernate Core {4.2.4.Final}

    我的是这样报错  怎么办啊 

  • 慕设计0211321
    2016-07-19 18:18:26

    同出现错误求解

  • 略坑
    2016-07-15 17:00:26

    已经解决了,一个是xml文件的位置不对,一个数据库的名称没有正确