按照老师的代码,启动的时候报错

按照老师的代码,启动的时候报错

具体报错内容是:

javax.imageio.IIOException: Can't create output stream!

at javax.imageio.ImageIO.write(ImageIO.java:1574)

at com.xinyu.code.CaptcahCode.drawImage(CaptcahCode.java:42)

at org.apache.jsp.code_jsp._jspService(code_jsp.java:117)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)

at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:443)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)

at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)

at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)

at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)

at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1468)

at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:748)

Caused by: javax.imageio.IIOException: Can't create cache file!

at javax.imageio.ImageIO.createImageOutputStream(ImageIO.java:423)

at javax.imageio.ImageIO.write(ImageIO.java:1572)

... 30 more

Caused by: java.nio.file.AccessDeniedException: C:\Program Files\Apache Software Foundation\Tomcat 8.5\temp\imageio5810503370608236331.tmp

at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83)

at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)

at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)

at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:230)

at java.nio.file.Files.newByteChannel(Files.java:361)

at java.nio.file.Files.createFile(Files.java:632)

at java.nio.file.TempFileHelper.create(TempFileHelper.java:138)

at java.nio.file.TempFileHelper.createTempFile(TempFileHelper.java:161)

at java.nio.file.Files.createTempFile(Files.java:897)

at javax.imageio.stream.FileCacheImageOutputStream.<init>(FileCacheImageOutputStream.java:88)

at com.sun.imageio.spi.OutputStreamImageOutputStreamSpi.createOutputStreamInstance(OutputStreamImageOutputStreamSpi.java:68)

at javax.imageio.ImageIO.createImageOutputStream(ImageIO.java:419)

... 31 more

这是我tomcat安装的有问题吗? 还是什么原因导致的呢?

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

登陆购买课程后可参与讨论,去登陆

1回答
chrismorgen 2018-06-13 15:03:43

根据报错信息来看,建议你在tomcat的目录下新建temp文件夹,然后重启tomcat服务试试,如果我的建议解决了你的问题,请采纳,祝学习愉快~

  • 提问者 慕雪8062931 #1
    我的tomcat目录中有temp文件夹, 我之前也试过删除了然后重新建一个temp. 还是不行...
    2018-06-13 15:29:15
  • chrismorgen 回复 提问者 慕雪8062931 #2
    你新建一个新的空项目,发布到Tomcat,看看Tomcat能不能正常启动。
    2018-06-13 15:43:35
  • 提问者 慕雪8062931 #3
    其他的项目可以正常启动 就这个不行..
    2018-06-13 15:47:03
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
从网页搭建入门Java Web2018版
  • 参与学习           人
  • 提交作业       1088    份
  • 解答问题       10205    个

如果你有Java语言基础,又想以后从事Java Web开发,那么本路径是你的不二选择!本路径从网页搭建开始入手,通过大量案例来学习Java Web基础。定能助你完成Java Web小白的蜕变!

了解课程
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师