JBoss ON 3.3 server update fails on Windows with "Cannot open C:\opt\jboss\...\~4,2~6,2~2,2~8,2~10,2~12,2\..." due to JAVA_HOME containing spaces
Environment
- Red Hat JBoss Operations Network (ON) 3.3.6, 3.3.7
- Microsoft Windows operating system
- Executing
apply-updates.bat - Java Runtime Environment (JRE) installed in directory containing spaces such as
C:\Program Files\Java\jre1.8.0_77
Issue
-
Unable to upgrade server
-
Error:
'C:\Program' is not recognized as an internal or external command, operable program or batch file. -
Errors trying to apply update:
A subdirectory or file C:\opt\jboss\on\jon-server-3.3.0.GA\..\rhq-agent\.patched\~4 already exists. Error occurred while processing: C:\opt\jboss\on\jon-server-3.3.0.GA\..\rhq-agent\.patched\~4. A subdirectory or file 2~6 already exists. Error occurred while processing: 2~6. ... The system cannot find the path specified. FINDSTR: Cannot open C:\opt\jboss\on\jon-server-3.3.0.GA\.patched\~4,2~6,2~2,2~8,2~10,2~12,2\writable.log Access is denied. -
Update attempts to create a new directory named
.patched\~4,2~6,2~2,2~8,2~10,2~12,2 -
apply-updatesfails ifJAVA_HOMEorRHQ_JAVA_HOMEpath contains spaces
Resolution
You can workaround this issue using any of the following methods:
-
Install the JRE in a directory that does not contain spaces.
For example,
C:\jre -
Create a symbolic link to your installed JRE in a location that does not contain spaces using the Windows Content from technet.microsoft.com is not included.
mklinkcommand.For example,
mklink /d C:\java\jre8 "C:\Program Files\Java\jre1.8.0_77" -
Define your
JAVA_HOMEor equivalent environment variable using its Windows short name.For example,
SET RHQ_JAVA_HOME=C:\PROGRA~1\Java\JRE18~1.0_7This can be done for any of the
JAVA_HOMEspecific overridesRHQ_JAVA_EXE_FILE_PATH,RHQ_AGENT_JAVA_EXE_FILE_PATH,RHQ_AGENT_JAVA_HOME,RHQ_JAVA_HOME, andJAVA_HOME.
Root Cause
The apply-updates.bat Windows command script does not properly quote the java.exe command and its path when executing the JRE. This will result in any JRE path that contains spaces or other special or reserved characters causing the apply-updates script to fail execution.
This issue has been captured in This content is not included.Red Hat Bugzilla 1404820 and will be reviewed in a future release.
Diagnostic Steps
-
The console output will reveal the following output. No update.log is created due to this failure:
'C:\Program' is not recognized as an internal or external command, operable program or batch file. [Wed 12/14/2016 10:34:12.93] Starting Update Successfully detected server to update [C:\opt\jboss\on\jon-server-3.3.0.GA] Proceeding with application of patch [07] to [C:\opt\jboss\on\jon-server-3.3.0.GA] Successfully detected agent to update [C:\opt\jboss\on\jon-server-3.3.0.GA\..\rhq-agent] A subdirectory or file C:\opt\jboss\on\jon-server-3.3.0.GA\..\rhq-agent\.patched\~4 already exists. Error occurred while processing: C:\opt\jboss\on\jon-server-3.3.0.GA\..\rhq-agent\.patched\~4. A subdirectory or file 2~6 already exists. Error occurred while processing: 2~6. A subdirectory or file 2~2 already exists. Error occurred while processing: 2~2. A subdirectory or file 2~8 already exists. Error occurred while processing: 2~8. A subdirectory or file 2~10 already exists. Error occurred while processing: 2~10. A subdirectory or file 2~12 already exists. Error occurred while processing: 2~12. A subdirectory or file 2 already exists. Error occurred while processing: 2. Proceeding with application of patch [07] to [C:\opt\jboss\on\jon-server-3.3.0.GA\..\rhq-agent] The system cannot find the path specified. Access is denied. The system cannot find the path specified. Assessing permissions needed during update process.... The system cannot find the path specified. The system cannot find the path specified. The system cannot find the path specified. The system cannot find the path specified. The system cannot find the path specified. FINDSTR: Cannot open C:\opt\jboss\on\jon-server-3.3.0.GA\.patched\~4,2~6,2~2,2~8,2~10,2~12,2\writable.log The system cannot find the path specified. The system cannot find the path specified. The system cannot find the path specified. FINDSTR: Cannot open C:\opt\jboss\on\jon-server-3.3.0.GA\.patched\~4,2~6,2~2,2~8,2~10,2~12,2\writable.log ... The system cannot find the path specified. FINDSTR: Cannot open C:\opt\jboss\on\jon-server-3.3.0.GA\.patched\~4,2~6,2~2,2~8,2~10,2~12,2\writable.log The system cannot find the path specified. FINDSTR: Cannot open C:\opt\jboss\on\jon-server-3.3.0.GA\.patched\~4,2~6,2~2,2~8,2~10,2~12,2\writable.log The system cannot find the path specified. The system cannot find the path specified. The system cannot find the path specified. FINDSTR: Cannot open C:\opt\jboss\on\jon-server-3.3.0.GA\.patched\~4,2~6,2~2,2~8,2~10,2~12,2\writable.log Access is denied.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.