Permission denied error from java.io.File.createTempFile
If you get a permission-denied error from java.io.File.createTempFile
, find out if the JVM parameter -Djava.io.tmpdir
is set on the java process. If you didn’t find a java.io.tmpdir
parameter, then grant the user access to the default OS temp directory.
Description description
Environment
Adobe Experience Manager (AEM) (all versions)
Issue/Symptoms
An error occurs in the error.log
that reports java.io.IOException: Permission denied
and the stack trace has java.io.File.createTempFile
in it.
01.06.2017 16:34:02.631 *ERROR* [ qtp1085110594-4453] org.apache.felix.http.jetty Exception while processing request to /system/console/configMgr/com.adobe.cq.experiencelog.impl.ExperienceLogConfigServlet (java.io.IOException: Permission denied)
java.io.IOException: Permission denied
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.createTempFile(File.java:2024)
at org.apache.felix.cm.file.FilePersistenceManager._store(FilePersistenceManager.java:699)
at org.apache.felix.cm.file.FilePersistenceManager.store(FilePersistenceManager.java:660)
at org.apache.felix.cm.impl.CachingPersistenceManagerProxy.store(CachingPersistenceManagerProxy.java:242)
at org.apache.felix.cm.impl.ConfigurationImpl.storeNewConfiguration(ConfigurationImpl.java:462)
at org.apache.felix.cm.impl.ConfigurationImpl.<init>(ConfigurationImpl.java:183)
Resolution resolution
Find out if the JVM parameter -Djava.io.tmpdir
is set on the java process.
On Linux:
-
Run this command:
code language-none ps -ef | grep java
-
Review the JVM parameters searching for
-Djava.io.tmpdir
On Windows, Linux, or Unix:
-
Go to https://aem-host:aem-port/system/console/jmx/java.lang%3Atype%3DRuntime
-
Search for
java.io.tmpdir
on the page. -
Copy the value of
java.io.tmpdir
to the clipboard. -
Go to that path on the Operating System and grant the user that owns the java process full read/write access to that folder.
-
If you didn’t find a
java.io.tmpdir
parameter, then grant the user access to the default OS temp directory.- In Linux and Unix, this directory is
/tmp
by default. - In Windows, the directory is under the user’s home directory (for example:
C:\Users\aemuser\AppData\Local\Temp
).
- In Linux and Unix, this directory is
Cause
The user that owns the AEM java process doesn’t have proper permissions to write in the java process’ temp directory.