还是没搞出来,麻烦老师了。

来源:4-5 店铺注册之Service层的实现

慕丝1454223

2018-05-12

五月 12, 2018 1:21:54 上午 org.springframework.test.context.support.DefaultTestContextBootstrapper getDefaultTestExecutionListenerClassNames

信息: Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]

五月 12, 2018 1:21:54 上午 org.springframework.test.context.support.DefaultTestContextBootstrapper getTestExecutionListeners

信息: Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@6be46e8f, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@3567135c, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@327471b5, org.springframework.test.context.support.DirtiesContextTestExecutionListener@4157f54e, org.springframework.test.context.transaction.TransactionalTestExecutionListener@90f6bfd, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@47f6473]

五月 12, 2018 1:21:54 上午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions

信息: Loading XML bean definitions from class path resource [spring/spring-dao.xml]

五月 12, 2018 1:21:54 上午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions

信息: Loading XML bean definitions from class path resource [spring/spring-service.xml]

五月 12, 2018 1:21:54 上午 org.springframework.context.support.GenericApplicationContext prepareRefresh

信息: Refreshing org.springframework.context.support.GenericApplicationContext@68be2bc2: startup date [Sat May 12 01:21:54 CST 2018]; root of context hierarchy

五月 12, 2018 1:21:55 上午 com.mchange.v2.log.MLog <clinit>

信息: MLog clients using java 1.4+ standard logging.

五月 12, 2018 1:21:55 上午 com.mchange.v2.c3p0.C3P0Registry banner

信息: Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]

五月 12, 2018 1:21:55 上午 com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager

信息: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 2, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 10000, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1hge1389vm9bug3mufere|72d1ad2e, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1hge1389vm9bug3mufere|72d1ad2e, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql://localhost:3306/o2o?useUnicode=true&characterEncoding=utf8, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 30, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 10, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]

五月 12, 2018 1:21:56 上午 org.springframework.test.context.transaction.TransactionContext startTransaction

信息: Began transaction (1) for test context [DefaultTestContext@6eb2384f testClass = ShopServiceTest, testInstance = com.imooc.o2o.service.ShopServiceTest@3c9c0d96, testMethod = testAddShop@ShopServiceTest, testException = [null], mergedContextConfiguration = [MergedContextConfiguration@4e31276e testClass = ShopServiceTest, locations = '{classpath:spring/spring-dao.xml, classpath:spring/spring-service.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextCustomizers = set[[empty]], contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]]; transaction manager [org.springframework.jdbc.datasource.DataSourceTransactionManager@3a4621bd]; rollback [true]

2018-05-12 01:21:56.067 [main] DEBUG com.imooc.o2o.dao.ShopDao.insertShop - ==>  Preparing: INSERT INTO tb_shop(owner_id,area_id,shop_category_id,shop_name,shop_desc,shop_addr, phone,shop_img,priority,create_time,last_edit_time,enable_status,advice) VALUES (?,?,?, ?,?,?,?,?,?, ?,?,?,?) 

2018-05-12 01:21:56.091 [main] DEBUG com.imooc.o2o.dao.ShopDao.insertShop - ==> Parameters: 9(Long), 2(Integer), 36(Long), 测试店铺2(String), test2(String), test2(String), test2(String), null, null, 2018-05-12 01:21:56.051(Timestamp), 2018-05-12 01:21:56.051(Timestamp), 0(Integer), 审核中(String)

2018-05-12 01:21:56.093 [main] DEBUG com.imooc.o2o.dao.ShopDao.insertShop - <==    Updates: 1

2018-05-12 01:21:56.100 [main] DEBUG com.imooc.o2o.util.ImageUtil - current relativeAddr is :upload\item\shop\93\2018051201215670289.jpg

2018-05-12 01:21:56.100 [main] DEBUG com.imooc.o2o.util.ImageUtil - current complete addr is :D:\jiaweidata\image\upload\item\shop\93\2018051201215670289.jpg

2018-05-12 01:21:56.259 [main] DEBUG com.imooc.o2o.dao.ShopDao.updateShop - ==>  Preparing: update tb_shop SET shop_name=?, shop_desc=?, shop_Addr=?, phone=?, shop_img=?, last_edit_time=?, enable_status=?, advice=?, shop_category_id=?, area_id=? where shop_id = ? 

2018-05-12 01:21:56.260 [main] DEBUG com.imooc.o2o.dao.ShopDao.updateShop - ==> Parameters: 测试店铺2(String), test2(String), test2(String), test2(String), upload\item\shop\93\2018051201215670289.jpg(String), 2018-05-12 01:21:56.051(Timestamp), 0(Integer), 审核中(String), 36(Long), 2(Integer), 93(Long)

2018-05-12 01:21:56.261 [main] DEBUG com.imooc.o2o.dao.ShopDao.updateShop - <==    Updates: 1

五月 12, 2018 1:21:56 上午 org.springframework.test.context.transaction.TransactionContext endTransaction

信息: Rolled back transaction for test context [DefaultTestContext@6eb2384f testClass = ShopServiceTest, testInstance = com.imooc.o2o.service.ShopServiceTest@3c9c0d96, testMethod = testAddShop@ShopServiceTest, testException = [null], mergedContextConfiguration = [MergedContextConfiguration@4e31276e testClass = ShopServiceTest, locations = '{classpath:spring/spring-dao.xml, classpath:spring/spring-service.xml}', classes = '{}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{}', contextCustomizers = set[[empty]], contextLoader = 'org.springframework.test.context.support.DelegatingSmartContextLoader', parent = [null]]].


写回答

1回答

翔仔

2018-05-12

同学好,从你贴的信息里我没看到错误在哪里,你其实应该提供 failure trace那边的信息。并且这些问题确实比较简单,控制台也输出相关sql语句了,你可以把你的语句贴到mysql客户端,然后执行一下,看看错在哪里,然后再去修复就行了。这种问题尽量自己多搞搞,工作中常遇到,一定要进步,调试和看信息定位是程序员的基础。

这里输出了update tb_shop SET shop_name=?, shop_desc=?, shop_Addr=?, phone=?, shop_img=?, last_edit_time=?, enable_status=?, advice=?, shop_category_id=?, area_id=? where shop_id = ? 

参数如下,你可以按照顺序去把?替换成下面的参数去执行看看。

 Parameters: 测试店铺2(String), test2(String), test2(String), test2(String), upload\item\shop\93\2018051201215670289.jpg(String), 2018-05-12 01:21:56.051(Timestamp), 0(Integer), 审核中(String), 36(Long), 2(Integer), 93(Long)

一般这种问题如果sql执行正常,那么肯定是店铺图片那块有问题,需要你调试一下

0
1
慕丝1454223
我发现我在shopServiceTest的addshop里加了 @Transactional,谢谢老师了。
2018-05-14
共1条回复

Java双版本(SSM到SpringBoot)校园商铺全栈开发

SSM商铺V1.0,解决毕设痛点;SpringBoot商铺V2.0,满足工作刚需

5113 学习 · 8144 问题

查看课程