addShop error:addShopImg error:null
来源:4-5 店铺注册之Service层的实现
小毛6823960
2020-06-22
D:\A_Program\jdk_8\bin\java.exe -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:D:\A_Program\idea 2019.3.3\IntelliJ IDEA 2019.2.4\lib\idea_rt.jar=59920:D:\A_Program\idea 2019.3.3\IntelliJ IDEA 2019.2.4\bin" -Dfile.encoding=UTF-8 -classpath "D:\A_Program\idea 2019.3.3\IntelliJ IDEA 2019.2.4\lib\idea_rt.jar;D:\A_Program\idea 2019.3.3\IntelliJ IDEA 2019.2.4\plugins\junit\lib\junit5-rt.jar;D:\A_Program\idea 2019.3.3\IntelliJ IDEA 2019.2.4\plugins\junit\lib\junit-rt.jar;D:\A_Program\jdk_8\jre\lib\charsets.jar;D:\A_Program\jdk_8\jre\lib\deploy.jar;D:\A_Program\jdk_8\jre\lib\ext\access-bridge-64.jar;D:\A_Program\jdk_8\jre\lib\ext\cldrdata.jar;D:\A_Program\jdk_8\jre\lib\ext\dnsns.jar;D:\A_Program\jdk_8\jre\lib\ext\jaccess.jar;D:\A_Program\jdk_8\jre\lib\ext\jfxrt.jar;D:\A_Program\jdk_8\jre\lib\ext\localedata.jar;D:\A_Program\jdk_8\jre\lib\ext\nashorn.jar;D:\A_Program\jdk_8\jre\lib\ext\sunec.jar;D:\A_Program\jdk_8\jre\lib\ext\sunjce_provider.jar;D:\A_Program\jdk_8\jre\lib\ext\sunmscapi.jar;D:\A_Program\jdk_8\jre\lib\ext\sunpkcs11.jar;D:\A_Program\jdk_8\jre\lib\ext\zipfs.jar;D:\A_Program\jdk_8\jre\lib\javaws.jar;D:\A_Program\jdk_8\jre\lib\jce.jar;D:\A_Program\jdk_8\jre\lib\jfr.jar;D:\A_Program\jdk_8\jre\lib\jfxswt.jar;D:\A_Program\jdk_8\jre\lib\jsse.jar;D:\A_Program\jdk_8\jre\lib\management-agent.jar;D:\A_Program\jdk_8\jre\lib\plugin.jar;D:\A_Program\jdk_8\jre\lib\resources.jar;D:\A_Program\jdk_8\jre\lib\rt.jar;D:\毕设demo\o2o\target\test-classes;D:\毕设demo\o2o\target\classes;D:\Maven_warehouse\net\coobird\thumbnailator\0.4.8\thumbnailator-0.4.8.jar;D:\Maven_warehouse\junit\junit\4.12\junit-4.12.jar;D:\Maven_warehouse\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;D:\Maven_warehouse\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;D:\Maven_warehouse\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;D:\Maven_warehouse\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;D:\Maven_warehouse\org\springframework\spring-core\5.1.8.RELEASE\spring-core-5.1.8.RELEASE.jar;D:\Maven_warehouse\org\springframework\spring-jcl\5.1.8.RELEASE\spring-jcl-5.1.8.RELEASE.jar;D:\Maven_warehouse\org\springframework\spring-beans\5.1.8.RELEASE\spring-beans-5.1.8.RELEASE.jar;D:\Maven_warehouse\org\springframework\spring-context\5.1.8.RELEASE\spring-context-5.1.8.RELEASE.jar;D:\Maven_warehouse\org\springframework\spring-aop\5.1.8.RELEASE\spring-aop-5.1.8.RELEASE.jar;D:\Maven_warehouse\org\springframework\spring-expression\5.1.8.RELEASE\spring-expression-5.1.8.RELEASE.jar;D:\Maven_warehouse\org\springframework\spring-jdbc\5.1.8.RELEASE\spring-jdbc-5.1.8.RELEASE.jar;D:\Maven_warehouse\org\springframework\spring-tx\5.1.8.RELEASE\spring-tx-5.1.8.RELEASE.jar;D:\Maven_warehouse\org\springframework\spring-web\5.1.8.RELEASE\spring-web-5.1.8.RELEASE.jar;D:\Maven_warehouse\org\springframework\spring-webmvc\5.1.8.RELEASE\spring-webmvc-5.1.8.RELEASE.jar;D:\Maven_warehouse\org\springframework\spring-test\5.1.8.RELEASE\spring-test-5.1.8.RELEASE.jar;D:\Maven_warehouse\javax\servlet\javax.servlet-api\4.0.1\javax.servlet-api-4.0.1.jar;D:\Maven_warehouse\com\fasterxml\jackson\core\jackson-databind\2.9.9\jackson-databind-2.9.9.jar;D:\Maven_warehouse\com\fasterxml\jackson\core\jackson-annotations\2.9.0\jackson-annotations-2.9.0.jar;D:\Maven_warehouse\com\fasterxml\jackson\core\jackson-core\2.9.9\jackson-core-2.9.9.jar;D:\Maven_warehouse\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;D:\Maven_warehouse\org\mybatis\mybatis\3.5.1\mybatis-3.5.1.jar;D:\Maven_warehouse\org\mybatis\mybatis-spring\2.0.1\mybatis-spring-2.0.1.jar;D:\Maven_warehouse\mysql\mysql-connector-java\8.0.16\mysql-connector-java-8.0.16.jar;D:\Maven_warehouse\com\google\protobuf\protobuf-java\3.6.1\protobuf-java-3.6.1.jar;D:\Maven_warehouse\com\mchange\c3p0\0.9.5.4\c3p0-0.9.5.4.jar;D:\Maven_warehouse\com\mchange\mchange-commons-java\0.2.15\mchange-commons-java-0.2.15.jar;D:\Maven_warehouse\com\github\penggle\kaptcha\2.3.2\kaptcha-2.3.2.jar;D:\Maven_warehouse\com\jhlabs\filters\2.0.235-1\filters-2.0.235-1.jar;D:\Maven_warehouse\commons-fileupload\commons-fileupload\1.3.2\commons-fileupload-1.3.2.jar;D:\Maven_warehouse\commons-io\commons-io\2.2\commons-io-2.2.jar;D:\Maven_warehouse\redis\clients\jedis\2.9.0\jedis-2.9.0.jar;D:\Maven_warehouse\org\apache\commons\commons-pool2\2.4.2\commons-pool2-2.4.2.jar" com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit4 pin.hao.o2o.service.ShopServiceTest,testAddShop
2020-06-22 21:24:03.791 [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]
2020-06-22 21:24:03.805 [main] INFO o.s.t.c.support.DefaultTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@de3a06f, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@76b10754, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@2bea5ab4, org.springframework.test.context.support.DirtiesContextTestExecutionListener@3d8314f0, org.springframework.test.context.transaction.TransactionalTestExecutionListener@2df32bf7, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@530612ba]
2020-06-22 21:24:04.341 [MLog-Init-Reporter] INFO com.mchange.v2.log.MLog - MLog clients using slf4j logging.
2020-06-22 21:24:04.987 [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]
2020-06-22 21:24:05.497 [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 -> 1hgeby9aa1p3imqf1vg45lt|202b0582, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.cj.jdbc.Driver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> 1hgeby9aa1p3imqf1vg45lt|202b0582, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql://localhost:3306/o2o?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC , maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 30, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 10, numHelperThreads -> 3, preferredTestQuery -> null, privilegeSpawnedThreads -> false, properties -> {user=******, password=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ]
2020-06-22 21:24:05.512 [main] WARN com.mchange.v2.resourcepool.BasicResourcePool - Bad pool size config, start 3 < min 10. Using 10 as start.
2020-06-22 21:24:05.693 [main] DEBUG pin.hao.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 (?,?,?,?, ?,?,?,?,?, ?,?, ?,?)
2020-06-22 21:24:05.726 [main] DEBUG pin.hao.o2o.dao.ShopDao.insertShop - ==> Parameters: 1(Long), 2(Integer), 1(Long), 测试的店铺1(String), test1(String), test1(String), test1(String), null, null, 2020-06-22 21:24:05.675(Timestamp), 2020-06-22 21:24:05.675(Timestamp), 0(Integer), 审核中(String)
2020-06-22 21:24:05.727 [main] DEBUG pin.hao.o2o.dao.ShopDao.insertShop - <== Updates: 1
pin.hao.o2o.exceptions.ShopOperationException: addShop error:addShopImg error:null
at pin.hao.o2o.service.impl.ShopServiceImpl.addShop(ShopServiceImpl.java:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
at com.sun.proxy.$Proxy27.addShop(Unknown Source)
at pin.hao.o2o.service.ShopServiceTest.testAddShop(ShopServiceTest.java:41)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Process finished with exit code -1
写回答
1回答
-
同学好,可以把ImgUtil里面的generateThumbnail方法里面的catch异常給抛出来,再看看是啥异常,那里把异常吞掉了,是个不太好的地方,可以改改
一般这个问题要么就是文件路径没搞对,要么就是水印路径由于加了basePath获取不到,建议从绝对路径如D:/aaaa/bbbb/watermark.jpg 去获取水印,因为basePath每个同学的环境不一样,获取到的值也不一样,后续2.0咱们也是这样做的:)
00
相似问题