addshop null
来源:4-5 店铺注册之Service层的实现
11111425
2019-05-09
老师,错误显示addshop null,调试后发现是insertShop出错,请问哪里出错了?
出错的Junit控制台如下
ShopServiceTest如下
出错的控制台
2019-05-10 09:04:24.669[main] INFO o.s.t.c.support.DefaultTestContextBootstrapper - 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]
2019-05-10 09:04:24.685[main] INFO o.s.t.c.support.DefaultTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@75437611, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@350aac89, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@1c5920df, org.springframework.test.context.support.DirtiesContextTestExecutionListener@17f9d882, org.springframework.test.context.transaction.TransactionalTestExecutionListener@79e4c792, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@196a42c3]
2019-05-10 09:04:25.649[MLog-Init-Reporter] INFO com.mchange.v2.log.MLog - MLog clients using slf4j logging.
2019-05-10 09:04:26.026[main] INFO com.mchange.v2.c3p0.C3P0Registry - Initializing c3p0-0.9.5.4 [built 23-March-2019 23:00:48 -0700; debug? true; trace: 10]
2019-05-10 09:04:26.707[main] INFO c.m.v2.c3p0.impl.AbstractPoolBackedDataSource - 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, contextClassLoaderSource -> caller, dataSourceName -> 1br0ztla2186wh3vnh02gt|4cc76301, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.cj.jdbc.Driver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> 1br0ztla2186wh3vnh02gt|4cc76301, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql://localhost:3306/o2o?useUnicode=true&characterEncodeing=utf8, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 30, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 10, numHelperThreads -> 3, preferredTestQuery -> null, privilegeSpawnedThreads -> false, properties -> {password=******, user=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ]
2019-05-10 09:04:26.747[main] WARN com.mchange.v2.resourcepool.BasicResourcePool - Bad pool size config, start 3 < min 10. Using 10 as start.
addShop代码如下
ShopDao的XML配置如下
3回答
-
_yingk_0
2021-04-05
你要看一下 serviceImpl层的定义的 Shopdao 有没有 加Autowired属性 如果没有的话 shop插入不进去
10 -
0kra
2019-05-28
问一下 你这个是怎么解决的
00 -
翔仔
2019-05-09
同学好,shopServiceImpl 第54行是啥呀 说的是那里报错,如果你怀疑是insert报错,看看控制台sql是啥,复制粘贴到mysql客户端试试。
error null应该是被吞掉了,看看catch里报的错是啥,需要打印或者调试下
052019-05-10
相似问题