2 u013213140 u013213140 于 2018.02.01 14:12 提问

spring boot 单元测试出错

2018-02-01 14:08:03.005 WARN 34600 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 1406, SQLState: 22001
2018-02-01 14:08:03.005 ERROR 34600 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : Data truncation: Data too long for column 'name' at row 1
2018-02-01 14:08:03.007 WARN 34600 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Warning Code: 1406, SQLState: HY000
2018-02-01 14:08:03.008 WARN 34600 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : Data too long for column 'name' at row 1
2018-02-01 14:08:03.019 INFO 34600 --- [ main] o.s.t.c.transaction.TransactionContext : Rolled back transaction for test context [DefaultTestContext@5a8e6209 testClass = ApplicationTests, testInstance = com.didispace.ApplicationTests@4f970963, testMethod = test@ApplicationTests, testException = org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement, mergedContextConfiguration = [MergedContextConfiguration@4b4523f8 testClass = ApplicationTests, locations = '{}', classes = '{class com.didispace.Application}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextLoader = 'org.springframework.boot.test.SpringApplicationContextLoader', parent = [null]]].
2018-02-01 14:08:03.029 INFO 34600 --- [ Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@20d28811: startup date [Thu Feb 01 14:07:59 GMT+08:00 2018]; root of context hierarchy
2018-02-01 14:08:03.035 INFO 34600 --- [ Thread-2] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'

5个回答

xcg132566
xcg132566   2018.02.02 09:24
已采纳

插入字段name过长,超过数据库表结构字段长度

shizhiyuan_2011
shizhiyuan_2011   2018.02.01 15:40

检查一下你的数据表吧,某个字段类型不符的问题

u014794644
u014794644   2018.02.01 18:19

2018-02-01 14:08:03.005 ERROR 34600 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : Data truncation: Data too long for column 'name' at row 1

u013213140
u013213140   2018.02.01 14:16

spring boot 操作mongodb出错:2018-02-01 14:13:21.542 INFO 37436 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@4b5a5ed1: startup date [Thu Feb 01 14:13:21 GMT+08:00 2018]; root of context hierarchy
2018-02-01 14:13:23.308 INFO 37436 --- [ main] com.didispace.ApplicationTests : Started ApplicationTests in 2.102 seconds (JVM running for 2.695)
2018-02-01 14:13:23.526 INFO 37436 --- [ Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@4b5a5ed1: startup date [Thu Feb 01 14:13:21 GMT+08:00 2018]; root of context hierarchy

u010496857
u010496857   2018.02.01 14:43

spring boot 操作mongodb出错:2018-02-01 14:13:21.542 INFO 37436 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@4b5a5ed1: startup date [Thu Feb 01 14:13:21 GMT+08:00 2018]; root of context hierarchy
2018-02-01 14:13:23.308 INFO 37436 --- [ main] com.didispace.ApplicationTests : Started ApplicationTests in 2.102 seconds (JVM running for 2.695)
2018-02-01 14:13:23.526 INFO 37436 --- [ Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@4b5a5ed1: startup date [Thu Feb 01 14:13:21 GMT+08:00 2018]; root of context hierarchy

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!