As a beginner to Jsp
. I'm building a simple web application that mail with gmail. When I run the below code, I'm getting the following error
HTTP Status 500 - Internal Server Error(access denied)
and web server is tomcat. I've also downloaded and added the jar file. Don't know what went wrong and couldn't find any helpful answer on google as yet. I'm getting the same error for both the JSP(one for login and another for register)files in my project.
NOTE: same code working fine with wildfly 16 but and same code is working fine without attachment in tomcat 9
HTTP Status 500 – Internal Server Error
Type Exception Report
Message 53d029e7ee814c345dfd1dee02b50c78.jpg (Access is denied)
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
java.io.FileNotFoundException: 53d029e7ee814c345dfd1dee02b50c78.jpg (Access is denied)
java.io.FileOutputStream.open0(Native Method)
java.io.FileOutputStream.open(Unknown Source)
java.io.FileOutputStream.<init>(Unknown Source)
java.io.FileOutputStream.<init>(Unknown Source)
net.codejava.mail.SendMailAttachServlet.saveUploadedFiles(SendMailAttachServlet.java:97)
net.codejava.mail.SendMailAttachServlet.doPost(SendMailAttachServlet.java:53)
javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
Note The full stack trace of the root cause is available in the server logs.