请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

D:\projectdev\image\D:\TuPian\items\shop\49.JPEG (文件名、目录名或卷标语法不正确。)

2018-06-11 15:06:55.976 [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-06-11 15:06:56.014 [main] DEBUG com.imooc.o2o.dao.ShopDao.insertShop - ==> Parameters: 1(Long), 2(Integer), 11(Long), 测试的sk店铺(String), test(String), test(String), test(String), null, null, 2018-06-11 15:06:55.951(Timestamp), 2018-06-11 15:06:55.951(Timestamp), 0(Integer), 审核中(String)

2018-06-11 15:06:56.016 [main] DEBUG com.imooc.o2o.dao.ShopDao.insertShop - <==    Updates: 1

2018-06-11 15:06:56.025 [main] DEBUG com.imooc.o2o.until.ImageUtil - current relativeAddr isD:\TuPian\items\shop\49\2018061115065698879.jpg

2018-06-11 15:06:56.025 [main] DEBUG com.imooc.o2o.until.ImageUtil - current completeAddr isD:\projectdev\image\D:\TuPian\items\shop\49\2018061115065698879.jpg

2018-06-11 15:06:56.188 [main] ERROR com.imooc.o2o.until.ImageUtil - java.io.FileNotFoundException: D:\projectdev\image\D:\TuPian\items\shop\49.JPEG (文件名、目录名或卷标语法不正确。)

java.io.FileNotFoundException: D:\projectdev\image\D:\TuPian\items\shop\49.JPEG (文件名、目录名或卷标语法不正确。)

at java.io.FileOutputStream.open0(Native Method)

at java.io.FileOutputStream.open(FileOutputStream.java:270)

at java.io.FileOutputStream.<init>(FileOutputStream.java:213)

at java.io.FileOutputStream.<init>(FileOutputStream.java:162)

at net.coobird.thumbnailator.tasks.io.FileImageSink.write(Unknown Source)

at net.coobird.thumbnailator.tasks.SourceSinkThumbnailTask.write(Unknown Source)

at net.coobird.thumbnailator.Thumbnailator.createThumbnail(Unknown Source)

at net.coobird.thumbnailator.Thumbnails$Builder.toFile(Unknown Source)

at com.imooc.o2o.until.ImageUtil.generateThumbnail(ImageUtil.java:63)

at com.imooc.o2o.service.impl.ShopServiceImpl.addShopImg(ShopServiceImpl.java:64)

at com.imooc.o2o.service.impl.ShopServiceImpl.addShop(ShopServiceImpl.java:43)

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

at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)

at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)

at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)

at com.sun.proxy.$Proxy23.addShop(Unknown Source)

at com.imooc.o2o.service.ShopServiceTest.testAddShop(ShopServiceTest.java:43)

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.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:252)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)

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

at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)

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

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

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

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

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

2018-06-11 15:06:56.221 [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=?, area_id=?, shop_category_id=? where shop_id=? 


正在回答 回答被采纳积分+3

1回答

翔仔 2018-06-11 20:21:04

同学好,错误非常明确啊,

D:\projectdev\image\D:\TuPian\items\shop\49.JPEG 

你的这个文件路径并不存在,你可以调试一下,看看你实际存储的文件路径为什么是这个,我猜你用了绝对值路径去弄外加我们写死了的前缀路径D:\projectdev\image,导致保存图片的时候报错,请仔细检查。此类问题希望同学能借此培养独立解决问题的能力:)

0 回复 有任何疑惑可以回复我~
  • 提问者 慕田峪2175044 #1
    去掉绝对路径,系统又找不到文件了,翔哥。。。
    targetAddr:D:\TuPian\items\shop\73\
    relativeAddr:D:\TuPian\items\shop\73\2018061120502887678.jpg
    2018-06-11 20:50:28.959 [main] DEBUG com.imooc.o2o.until.ImageUtil - current relativeAddr isD:\TuPian\items\shop\73\2018061120502887678.jpg
    2018-06-11 20:50:28.960 [main] DEBUG com.imooc.o2o.until.ImageUtil - current completeAddr isD:\projectdev\imageD:\TuPian\items\shop\73\2018061120502887678.jpg
    2018-06-11 20:50:29.134 [main] ERROR com.imooc.o2o.until.ImageUtil - addImagejava.io.FileNotFoundException: D:\TuPian\items\shop\73\2018061120502887678.jpg (系统找不到指定的路径。)
    java.io.FileNotFoundException: D:\TuPian\items\shop\73\2018061120502887678.jpg (系统找不到指定的路径。)
    回复 有任何疑惑可以回复我~ 2018-06-11 20:52:35
  • 翔仔 回复 提问者 慕田峪2175044 #2
    同学你这个D:\TuPian\items\shop\73\2018061120502887678.jpg 你确定是有的吗?你得保证D:\TuPian\items\shop\73这个路径下有2018061120502887678.jpg 这个图片呀。。。
    我看错误已经很清晰了呀。还有这种问题你可以设置断点调试看看错在哪一步,然后再结合实际看看就能看出问题了
    回复 有任何疑惑可以回复我~ 2018-06-11 21:08:36
  • 提问者 慕田峪2175044 回复 翔仔 #3
    感谢翔哥,找到了,public static String getShopImagePath(long shopId){
    		String imagePath = "D:/TuPian/items/shop/"+shopId+"/";
    		return imagePath.replace("/",seperator);
    	}
    这个地方不应该写  D:   还是文件流与操作系统不太懂。
    回复 有任何疑惑可以回复我~ 2018-06-11 21:33:57
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号