-2

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.
Jitesh Prajapati
  • 2,533
  • 4
  • 29
  • 51
  • "added the jar file". do you understand why this is not helpful? if you are building a web application that can send emails, you should stop considering it to be a "simple web application", if only for all the authentication to come along. – Stultuske May 27 '19 at 08:56
  • 3
    You haven't added the actual code, but from the stack trace, the main message should be pretty straightforward: "java.io.FileNotFoundException: 53d029e7ee814c345dfd1dee02b50c78.jpg (Access is denied)" – Mena May 27 '19 at 08:57
  • FileNotFoundException ... the name of the Exception itself should tell you in which way to look – Stultuske May 27 '19 at 08:57

1 Answers1

0

500 http code means there is something wrong with your code, as you pasted, the file named 53d029e7ee814c345dfd1dee02b50c78.jpg cannot be found in your code. So check your code carefully.

By the way, pasting the code when encountered 500 error is always positive so that they can give you a hand.