猿问

junit测试通过,但没有向数据库中添加表啊,也没有插入sql语句?本人小白一个,求高手指点。

四月 11, 2016 4:31:06 下午 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!

四月 11, 2016 4:31:06 下午 org.hibernate.cfg.Configuration addResource

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

四月 11, 2016 4:31:06 下午 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!

四月 11, 2016 4:31:06 下午 org.hibernate.cfg.Configuration addResource

INFO: HHH000221: Reading mappings from resource: entity/Users.hbm.xml

四月 11, 2016 4:31:06 下午 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!

四月 11, 2016 4:31:06 下午 org.hibernate.cfg.Configuration doConfigure

INFO: HHH000041: Configured SessionFactory: null

四月 11, 2016 4:31:07 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

WARN: HHH000402: Using Hibernate built-in connection pool (not for production use!)

四月 11, 2016 4:31:07 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

INFO: HHH000115: Hibernate connection pool size: 20

四月 11, 2016 4:31:07 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

INFO: HHH000006: Autocommit mode: false

四月 11, 2016 4:31:07 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

INFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://test?useUnicode=true&characterEncoding=UTF-8]

四月 11, 2016 4:31:07 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

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

四月 11, 2016 4:31:19 下午 org.hibernate.engine.jdbc.internal.JdbcServicesImpl configure

WARN: HHH000342: Could not obtain connection to query metadata : Communications link failure

四月 11, 2016 4:31:21 下午 org.hibernate.tool.hbm2ddl.SchemaUpdate execute

ERROR: HHH000319: Could not get database metadata

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

Last packet sent to the server was 0 ms ago.

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:526)

at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)

at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)

at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:335)

at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2043)

... 39 more

Caused by: java.net.UnknownHostException: test

at java.net.InetAddress.getAllByName0(InetAddress.java:1250)

at java.net.InetAddress.getAllByName(InetAddress.java:1162)

at java.net.InetAddress.getAllByName(InetAddress.java:1098)

at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:243)

at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:284)

... 40 more


四月 11, 2016 4:31:21 下午 org.hibernate.tool.hbm2ddl.SchemaUpdate execute

ERROR: HHH000299: Could not complete schema update

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

Last packet sent to the server was 0 ms ago.

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:526)

at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)

at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)

at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:335)

at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2043)

... 39 more

Caused by: java.net.UnknownHostException: test

at java.net.InetAddress.getAllByName0(InetAddress.java:1250)

at java.net.InetAddress.getAllByName(InetAddress.java:1162)

at java.net.InetAddress.getAllByName(InetAddress.java:1098)

at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:243)

at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:284)

... 40 more


四月 11, 2016 4:31:21 下午 org.hibernate.dialect.Dialect <init>

INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect

四月 11, 2016 4:31:21 下午 org.hibernate.tool.hbm2ddl.SchemaExport execute

INFO: HHH000227: Running hbm2ddl schema export

四月 11, 2016 4:31:21 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

WARN: HHH000402: Using Hibernate built-in connection pool (not for production use!)

四月 11, 2016 4:31:21 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

INFO: HHH000115: Hibernate connection pool size: 20

四月 11, 2016 4:31:21 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

INFO: HHH000006: Autocommit mode: false

四月 11, 2016 4:31:21 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

INFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://test?useUnicode=true&characterEncoding=UTF-8]

四月 11, 2016 4:31:21 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

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

四月 11, 2016 4:31:21 下午 org.hibernate.tool.hbm2ddl.SchemaExport execute

ERROR: HHH000231: Schema export unsuccessful

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure


Last packet sent to the server was 0 ms ago.

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:526)

at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)

at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)

at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2120)

at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:723)

at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:526)

at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)

at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:302)

at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282)

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

at org.hibernate.tool.hbm2ddl.ManagedProviderConnectionHelper.prepare(ManagedProviderConnectionHelper.java:55)

at org.hibernate.tool.hbm2ddl.DatabaseExporter.<init>(DatabaseExporter.java:52)

at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:368)

at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:305)

at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:294)

at entity.TestStudents.testSchemaExport(TestStudents.java:20)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

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.InvokeMethod.evaluate(InvokeMethod.java:20)

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:50)

at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure


Last packet sent to the server was 0 ms ago.

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:526)

at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)

at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)

at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:335)

at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2043)

... 39 more

Caused by: java.net.UnknownHostException: test

at java.net.InetAddress.getAllByName0(InetAddress.java:1250)

at java.net.InetAddress.getAllByName(InetAddress.java:1162)

at java.net.InetAddress.getAllByName(InetAddress.java:1098)

at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:243)

at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:284)

... 40 more


四月 11, 2016 4:31:21 下午 org.hibernate.tool.hbm2ddl.SchemaExport execute

INFO: HHH000230: Schema export complete


慕勒8499060
浏览 4479回答 1
1回答

Its_forever

Error信息没有看到? ERROR: HHH000319: Could not get database metadata ERROR: HHH000299: Could not complete schema update
随时随地看视频慕课网APP

相关分类

Java
我要回答