'Permission Denied' error when adding vFunction Agent to Tomcat Application Server


Overview of the Issue

This issue occurs in the following circumstances:

  1. An organization uses a Tomcat Application Server to run their Java Application
  2. The organization installs the vFunction Sudoless Runtime Agent in a directory that is not associated with the Tomcat Application Server, such as a user’s home directory
  3. The organization changes the permissions and ownership of the base vFunction installation directory to be Read / Write / Execute for all available users and have ownership match the User running the Tomcat Application Server
  4. The Catalina_Opts are modified to accurately add the vFunction Runtime Agent Startup Parameters
  5. Unexpectedly, when the Tomcat Application Server starts, the catalina.out logging throws, “Permission Denied” errors that the vFunction libJVMTIAgent.so cannot be accessed

Steps to Resolve the Issue

Take the following steps to resolve this issue:

  1. SSH to the Tomcat Application Server running the vFunction Runtime Agent
  2. Move the vFunction Installation directory to a location associated with the Tomcat Application Server rather than a specific user. For example:
mv /home/peter/vfunction /opt/
  1. Run the vFunction Agent installation again. When prompted, click “Y” to override the previous installation. For example:
bash /opt/vfunction/opt/vfunction/controller-installation/install.sh -i default-java
  1. Modify the CATALINA_OPTS to make sure all vFunction Runtime Agent Startup Parameters match the new path of the Agent. For example
### Before
-agentpath:/home/ec2-user/vfunction/opt/vfunction/agent/libJVMTIAgent.so=conf=/home/ec2-user/vfunction/etc/sysconfig/vfunction/agent/instances/default-java/native-conf.json -javaagent:/home/ec2-user/vfunction/opt/vfunction/agent/runtime-agent.jar=ConfigLocation=/home/ec2-user/vfunction/etc/sysconfig/vfunction/agent/instances/default-java/vfunction-runtime-override.properties -Dcom.vfunction.logging.logFile=/home/ec2-user/vfunction/var/log/vfunction/instances/default-java/vfagent.log

### After
-agentpath:/opt/vfunction/opt/vfunction/agent/libJVMTIAgent.so=conf=/opt/vfunction/etc/sysconfig/vfunction/agent/instances/default-java/native-conf.json -javaagent:/opt/vfunction/opt/vfunction/agent/runtime-agent.jar=ConfigLocation=/opt/vfunction/etc/sysconfig/vfunction/agent/instances/default-java/vfunction-runtime-override.properties -Dcom.vfunction.logging.logFile=/opt/vfunction/var/log/vfunction/instances/default-java/vfagent.log
  1. Restart the Tomcat Application Server