[Solved] org.apache.tika.exception.AccessPermissionException

AccessPermissionException is a subclass on TikaException. This exception occurred when a document/file does not allow content extraction. For Example, This exception is most common for PDF type documents, which might cause this type of exception.

public class AccessPermissionException extends TikaException


Always check file access, read, write and executable permission before going to use with TIKA, accordingly perform operations.

File file = new File("TEST-File");

With Java NIO Libraries
boolean isRegularFile = Files.isRegularFile(file);
boolean isHidden = Files.isReadable(file);
boolean isReadable = Files.isReadable(file);
boolean isExecutable = Files.isExecutable(file);
boolean isSymbolicLink = Files.isSymbolicLink(file);
boolean isWritable = Files.isWritable(directory);

With Java IO Libraries
boolean isReadable=file.isReadable();
boolean isWritable=file.setWritable();
boolean isExecutable=file.setExecutable();


Here are list of Constructor for this exception class:

  • AccessPermissionException() : Default constructor
  • AccessPermissionException(String info) : Constructor with exception message
  • AccessPermissionException(String info, Throwable th): Throw exception with message and stack trace.
  • AccessPermissionException(Throwable th): Throw exception message stack trace.