• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Java Issues-Permissions Denied-Plesk12.0

SamirM

Regular Pleskian
Hi,
i run a VPS with CentOS 7.1 and Plesk 12.0.18 and tomcat 7.0, am having issues with permissions even though all permissions have been enabled. The site runs a page for sellers to add their profile and product images, and when they upload the images, the following error is reported:

type Exception report

message java.io.FileNotFoundException: /var/www/vhosts/domain.com/httpdocs/uploads (Permission denied)

description The server encountered an internal error that prevented it from fulfilling this request.

exception

java.io.IOException: java.io.FileNotFoundException: /var/www/vhosts/perkmart.com/httpdocs/uploads (Permission denied)
Upload.doPost(Upload.java:47)
javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

root cause

java.io.FileNotFoundException: /var/www/vhosts/domain.com/httpdocs/uploads (Permission denied)
java.io.FileOutputStream.open(Native Method)
java.io.FileOutputStream.<init>(FileOutputStream.java:221)
java.io.FileOutputStream.<init>(FileOutputStream.java:171)
org.apache.tomcat.util.http.fileupload.disk.DiskFileItem.write(DiskFileItem.java:377)
Upload.doPost(Upload.java:47)
javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.54 logs.


the uploads folder has the following permissions : rwx-rwx-rw
the java code for the uploads is :

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;

@WebServlet("/upload")
@MultipartConfig(fileSizeThreshold = 1024 * 1024 * 2, // 2MB
maxFileSize = 1024 * 1024 * 10, // 10MB
maxRequestSize = 1024 * 1024 * 50) // 50MB
public class Upload extends HttpServlet {

/**
* Name of the directory where uploaded files will be saved, relative to the
* web application directory.
*/
private static final String SAVE_DIR = "domain.com/uploads/buyer_profile_photos/";

/**
* handles file upload
*/
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// gets absolute path of the web application
// constructs path of the directory to save uploaded file

File fileSaveDir = new File(SAVE_DIR);
if (!fileSaveDir.exists()) {
fileSaveDir.mkdir();
}

for (Part part : request.getParts()) {
String fileName = extractFileName(part);
part.write(savePath + File.separator + fileName);
}
PrintWriter printWriter = response.getWriter();
printWriter.print(request.getServletContext().getRealPath(""));

}

/**
* Extracts file name from HTTP header content-disposition
*/
private String extractFileName(Part part) {
String contentDisp = part.getHeader("content-disposition");
String[] items = contentDisp.split(";");
for (String s : items) {
if (s.trim().startsWith("filename")) {
return s.substring(s.indexOf("=") + 2, s.length() - 1);
}
}
return "";
}
}


can anyone help in identifying the cause of this error

thanks\
samir
 
Thnx UFHH01, i have enabled "777" permissions to the folder, but i still get the same error.....any suggestions
 
i got this one sorted, apparently it was a SELINUX issue which was enabled, made it permissive and it started working, thnx UFHH01
 
Back
Top