在抓取图片的时候,出现问题

caohaiming_201302 2014-04-09 04:56:38
在抓取图片的时候,出现了问题了异常如下:
java.io.FileNotFoundException: \data\image\tencent\520603.jpg (请求的操作无法在使用用户映射区域打开的文件上执行。)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:194)
at java.io.FileOutputStream.<init>(FileOutputStream.java:145)
at com.u17.ca.util.HtmlUtils.saveCoverFromUrl(HtmlUtils.java:187)
at com.u17.ca.service.impl.TencentComicServiceImpl.getTencentComicInfoFromHtml(TencentComicServiceImpl.java:404)
at com.u17.ca.service.impl.TencentComicServiceImpl.insertDayComic(TencentComicServiceImpl.java:126)
at com.u17.ca.service.impl.TencentComicServiceImpl$$FastClassByCGLIB$$128a663a.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)
at com.u17.ca.service.impl.TencentComicServiceImpl$$EnhancerByCGLIB$$af670091.insertDayComic(<generated>)
at com.u17.ca.service.impl.TencentComicServiceImpl$$FastClassByCGLIB$$128a663a.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)
at com.u17.ca.service.impl.TencentComicServiceImpl$$EnhancerByCGLIB$$e5a369c7.insertDayComic(<generated>)
at com.u17.ca.schedule.TencentStatistics.insertDay(TencentStatistics.java:49)
at com.u17.ca.service.TencentStatisticsTest.everyWeekAppendTencentComicSendMailTest(TencentStatisticsTest.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
java.io.FileNotFoundException: \data\image\tencent\492216.jpg (请求的操作无法在使用用户映射区域打开的文件上执行。)
...全文
165 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
BeautfulSoup 2014-04-09
  • 打赏
  • 举报
回复
程序里面看看file2可读可写不,file2.exist属性为true,才能读写这个文件
caohaiming_201302 2014-04-09
  • 打赏
  • 举报
回复
代码如下: FileOutputStream fos = new FileOutputStream(file2); int len = 0; int off =0; while((len=is.read(byteBuffer))!=-1) { fos.write(byteBuffer, off, len); } 如果被其他进程占用了,怎么办呀
ndsun32 2014-04-09
  • 打赏
  • 举报
回复
路径问题!!!!!!!!
Kenzson 2014-04-09
  • 打赏
  • 举报
回复
文件不存在或者其他进程占用此文件
tony4geek 2014-04-09
  • 打赏
  • 举报
回复
路径问题了。
-江沐风- 2014-04-09
  • 打赏
  • 举报
回复
路径不对吧,都notfound了;

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧