"java.io.FileNotFoundException" error when attempting to run Cell Management Tool commands
search cancel

"java.io.FileNotFoundException" error when attempting to run Cell Management Tool commands

book

Article ID: 325585

calendar_today

Updated On:

Products

VMware Cloud Director

Issue/Introduction

Symptoms:
  • Cannot execute any commands using cell-management-tool from VCD Cells
  • Attempting to run a cell-management-tool command gives an error similar to the following:
log4j:ERROR Could not read configuration file from URL [file:/opt/vmware/vcloud-director/etc/cmt-logging.properties].
java.io.FileNotFoundException: /opt/vmware/vcloud-director/etc/cmt-logging.properties (Permission denied)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(FileInputStream.java:195)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at java.io.FileInputStream.<init>(FileInputStream.java:93)
        at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
        at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
        at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:557)
        at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:526)
        at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)
        at org.apache.log4j.Logger.getRootLogger(Logger.java:135)
        at com.vmware.vcloud.logging.helper.LoggerHelper.isLog4jConfigured(LoggerHelper.java:464)
        at com.vmware.vcloud.logging.helper.LoggerHelper.getLoggerFromLog4jLoggerFactoryService(LoggerHelper.java:443)
        at com.vmware.vcloud.logging.helper.LoggerHelper.getLogger(LoggerHelper.java:185)
        at com.vmware.vcloud.cell.management.CellManagementTool.<clinit>(CellManagementTool.java:65)
log4j:ERROR Ignoring configuration file [file:/opt/vmware/vcloud-director/etc/cmt-logging.properties].


Cause

This issue can occur if the permissions, owner, or both on the file /opt/vmware/vcloud-director/etc/cmt-logging.properties were modified.
The cell-management-tool runs using the vcloud user and this user must have access to the file for commands to complete.

Resolution

To resolve this issue, correct the ownership of the /opt/vmware/vcloud-director/etc/cmt-logging.properties file on the VCD Cell.
  1. Change Directory to /opt/vmware/vcloud-director/etc/ where the cmt-logging.properties is located.
cd /opt/vmware/vcloud-director/etc/
  1. Check the current permissions on the file.
ls -l cmt-logging.properties

An example of incorrect properties would be the following:
-r-------- 1 root root 2090 Apr  3 15:47 cmt-logging.properties
  1. Change the owner to the vcloud user.
chown vcloud:vcloud cmt-logging.properties
  1. Set the permissions on the file to the expected default.
chmod 640 cmt-logging.properties
  1. Confirm that the owner and permissions are updated.
ls -l cmt-logging.properties

An example of incorrect properties would be the following:
-rw-r----- 1 vcloud vcloud 2090 Apr  3 15:47 cmt-logging.properties
  1. Retry the cell-management-tool command which was previously failing, for example:
/opt/vmware/vcloud-director/bin/cell-management-tool -u administrator cell -t