Executing js-upgrade-newdb.sh under a non-root user account fails with 'Permission denied ' errors

Issue:

The following errors were thrown in the js-upgrade-pro_<datetime>.log when trying to upgrade 6.1 to 6.4.2 using js-upgrade-newdb.sh as a non-root user:

[java] Caused by: org.springframework.beans.factory.BeanCreationException: 
       Error creating bean with name 'systemLoggedInUserStorage' 
       defined in file [/opt/userhome/jasperreports-install/buildomatic/conf_source/iePro/applicationContext.xml]: 
               Cannot resolve reference to bean 'systemUserStorageCache' while setting bean property 'cache';
...
[java] Caused by: net.sf.ehcache.CacheException: java.io.IOException: Permission denied 
[java]     at net.sf.ehcache.DiskStorePathManager$DiskStorePath.<init>(DiskStorePathManager.java:331)

Solution:

In the file ../buildomatic/conf_source/iePro/applicationContext.xml, there exists the following property:

<prop key="ehcache.disk.store.dir">#{ systemProperties['java.io.tmpdir'] }</prop>

The user needs to have full permissions to the path referenced by java.io.tmpdir. This temp directory should not have any subdirectories: main, buffer, adhocCache. If they exist then they should first be deleted.

In order to determine what path this system variable is pointing to, you can first set the debug component for class DiskStorePathManager. Please refer to 'Debugging options' below.

There are two ways to override the path of 'java.io.tmpdir'.

  1. Including -Djava.io.tmpdir for ANT_OPTS in file ..\buildomatic\bin\do-js-setup.sh since running js-upgrade-newdb.sh will execute this script.

    Example:

    export ANT_OPTS="$ANT_OPTS -Dnet.sf.ehcache.disabled=true -Xms512m -Xmx2048m -XX:PermSize=128m -Djava.io.tmpdir=/opt/userhome/tmp"
  2. Edit ../buildomatic/conf_source/iePro/applicationContext.xml and change to user.home system property. This is usually the path to the users home dir. Eg /opt/userhome

    <prop key="ehcache.disk.store.dir">#{ systemProperties['user.home'] }</prop>

When running the upgrade script, watch for temp files and the following 3 directories that will be created:

  • /opt/userhome/main

  • /opt/userhome/buffer

  • /opt/userhome/adhocCache

Note: If you are able to run a Diagnostic report on the JR Server, the Diagnostic report will show the paths for the system properties, java.io.tmpdir and user.home.

Debugging options:

In order to determine what the disk store path is, you can add the following logging component to the file ..\buildomatic\conf_source\iePro\log4j.properties :

log4j.logger.net.sf.ehcache.DiskStorePathManager=debug

and search for "Using diskstore path" in the log file. This is the path that requires the appropriate permissions set for the user. Example log entries:

[java] Using diskstore path /opt/userhome/main
[java] Holding exclusive lock on /opt/userhome/main/.ehcache-diskstore.lock

Feedback