Tomcat update/install fails on windows

dhausman
Contributor

Trying to run the windows installer to upgrade tomcat and it keeps failing. I even tried uninstalling Jamf. Removed the JSS folder. Ran the installer to install clean.... Still failing. Looks like it is tomcat.

Here is the relevant log information from the installer. Anyone have any advice?

Calling custom action JAMF.JSS.InstallUtilities!JAMF.JSS.InstallUtilities.CustomActions.InstallTomcat
JSS (c) (40:01) [20:00:41:617]: Installing the Tomcat service...
JSS (c) (40:01) [20:00:41:617]: Path for Tomcat = 'D:JSSTomcat'
JSS (c) (40:01) [20:00:41:617]: JSS_JDK_HOME_DIR=C:Program FilesJavajdk1.8.0_171
JSS (c) (40:01) [20:00:41:617]: JSS_JRE_HOME_DIR=C:Program FilesJavajre1.8.0_171
Exception thrown by custom action:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: There was an unexpected error running '"D:JSSTomcatinservice.bat" install'! ---> System.TimeoutException: Running '"D:JSSTomcatinservice.bat"' timed out after '30' seconds. at JAMF.JSS.InstallUtilities.Utilities.LaunchExe.Run() --- End of inner exception stack trace --- at JAMF.JSS.InstallUtilities.Utilities.LaunchExe.Run() at JAMF.JSS.InstallUtilities.Tomcat.RunServiceBatFile(String action) at JAMF.JSS.InstallUtilities.Tomcat.Install() at JAMF.JSS.InstallUtilities.CustomActions.InstallTomcat(Session session) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object parameters, Object arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture) at Microsoft.Deployment.WindowsInstaller.CustomActionProxy.InvokeCustomAction(Int32 sessionHandle, String entryPoint, IntPtr remotingDelegatePtr)
CustomAction JSS_InstallUtilities_CA_InstallTomcat returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 20:01:11: JSS_InstallUtilities_CA_InstallTomcat. Return value 3.
Action ended 20:01:11: INSTALL. Return value 3.
MSI (s) (A4:3C) [20:01:11:760]: MainEngineThread is returning 1603
MSI (s) (A4:00) [20:01:11:776]: RESTART MANAGER: Session closed.
MSI (s) (A4:00) [20:01:11:776]: No System Restore sequence number for this installation.
MSI (s) (A4:00) [20:01:11:776]: User policy value 'DisableRollback' is 0
MSI (s) (A4:00) [20:01:11:776]: Machine policy value 'DisableRollback' is 0
MSI (s) (A4:00) [20:01:11:776]: Incrementing counter to disable shutdown. Counter after increment: 0
MSI (s) (A4:00) [20:01:11:776]: Note: 1: 1402 2: HKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrentVersionInstallerRollbackScripts 3: 2 MSI (s) (A4:00) [20:01:11:776]: Note: 1: 1402 2: HKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrentVersionInstallerRollbackScripts 3: 2 MSI (s) (A4:00) [20:01:11:776]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1
MSI (s) (A4:00) [20:01:11:776]: Destroying RemoteAPI object.
MSI (s) (A4:28) [20:01:11:776]: Custom Action Manager thread ending.
MSI (c) (88:1C) [20:01:11:776]: Back from server. Return value: 1603
MSI (c) (88:1C) [20:01:11:776]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1
MSI (c) (88:1C) [20:01:11:776]: PROPERTY CHANGE: Deleting SECONDSEQUENCE property. Its current value is '1'.
Action ended 20:01:11: ExecuteAction. Return value 3.
MSI (c) (88:1C) [20:01:11:776]: Doing action: FatalError
Action start 20:01:11: FatalError.
MSI (c) (88:8C) [20:02:00:781]: Doing action: JSS_OpenMsiLogFile
Action start 20:02:00: JSS_OpenMsiLogFile.
MSI (c) (88:8C) [20:02:02:360]: Doing action: JSS_ShowMsiLogFile
Action start 20:02:02: JSS_ShowMsiLogFile.
MSI (c) (88:8C) [20:02:14:876]: Doing action: JSS_ShowMsiLogFile
Action start 20:02:14: JSS_ShowMsiLogFile.
MSI (c) (88:8C) [20:02:16:564]: Doing action: AI_RemoveTempFiles
Action start 20:02:16: AI_RemoveTempFiles.
MSI (c) (88:78) [20:02:16:564]: Invoking remote custom action. DLL: C:UsersADMINI~1AppDataLocalTempMSI6745.tmp, Entrypoint: RemoveTempFiles
MSI (c) (88!08) [20:02:16:564]: PROPERTY CHANGE: Adding AITEMPFILESREMOVED property. Its value is 'YES'.
Action ended 20:02:16: AI_RemoveTempFiles. Return value 1.
Action ended 20:02:16: FatalError. Return value 2.
Action ended 20:02:16: INSTALL. Return value 3.
Action ended 20:02:00: JSS_OpenMsiLogFile. Return value 1631.
Action ended 20:02:02: JSS_ShowMsiLogFile. Return value 1631.
Action ended 20:02:14: JSS_ShowMsiLogFile. Return value 1631.
MSI (c) (88:1C) [20:02:16:580]: Destroying RemoteAPI object.
MSI (c) (88:C8) [20:02:16:595]: Custom Action Manager thread ending.
=== Logging stopped: 8/22/2018 20:02:16 ===
MSI (c) (88:1C) [20:02:16:595]: Note: 1: 1708 MSI (c) (88:1C) [20:02:16:595]: Product: Jamf Pro -- Installation failed.

MSI (c) (88:1C) [20:02:16:595]: Windows Installer installed the product. Product Name: Jamf Pro. Product Version: 10.6.2.0. Product Language: 1033. Manufacturer: Jamf. Installation success or error status: 1603.

MSI (c) (88:1C) [20:02:16:595]: Grabbed execution mutex.
MSI (c) (88:1C) [20:02:16:595]: Cleaning up uninstalled install packages, if any exist
MSI (c) (88:1C) [20:02:16:595]: MainEngineThread is returning 1603
=== Verbose logging stopped: 8/22/2018 20:02:16 ===

12 REPLIES 12

pinsent
New Contributor III

Can you post what is in the service.bat file?

That appears to be the source of 30 second time out error.

Sometimes it takes a good while for Tomcat to stop and/or start the service.

Have you tried manually stopping the service and then running the update?

dhausman
Contributor

I probably should have posted... I had the tomcat service stopped already before I ran the uninstall. Then I rebooted (after the install there was no tomcat service installed) and then I installed. So if the installer is waiting for the service to stop... there is no service. I will go back and try and pull the batch file out.

dhausman
Contributor

Here is the service.bat

@echo off
rem Licensed to the Apache Software Foundation (ASF) under one or more
rem contributor license agreements. See the NOTICE file distributed with
rem this work for additional information regarding copyright ownership.
rem The ASF licenses this file to You under the Apache License, Version 2.0
rem (the "License"); you may not use this file except in compliance with
rem the License. You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.

rem ---------------------------------------------------------------------------
rem NT Service Install/Uninstall script
rem
rem Options
rem install Install the service using Tomcat8 as service name.
rem Service is installed using default settings.
rem remove Remove the service from the System.
rem
rem name (optional) If the second argument is present it is considered
rem to be new service name
rem ---------------------------------------------------------------------------

setlocal

set "SELF=%~dp0%service.bat"
rem Guess CATALINA_HOME if not defined
set "CURRENT_DIR=%cd%"
if not "%CATALINA_HOME%" == "" goto gotHome
set "CATALINA_HOME=%cd%"
if exist "%CATALINA_HOME%in omcat8.exe" goto okHome
rem CD to the upper dir
cd ..
set "CATALINA_HOME=%cd%"
:gotHome
if exist "%CATALINA_HOME%in omcat8.exe" goto okHome
echo The tomcat8.exe was not found...
echo The CATALINA_HOME environment variable is not defined correctly.
echo This environment variable is needed to run this program
goto end
:okHome
rem Make sure prerequisite environment variables are set
if not "%JAVA_HOME%" == "" goto gotJdkHome
if not "%JRE_HOME%" == "" goto gotJreHome
echo Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
echo Service will try to guess them from the registry.
goto okJavaHome
:gotJreHome
if not exist "%JRE_HOME%injava.exe" goto noJavaHome
goto okJavaHome
:gotJdkHome
if not exist "%JAVA_HOME%injavac.exe" goto noJavaHome
rem Java 9 has a different directory structure
if exist "%JAVA_HOME%jreinjava.exe" goto preJava9Layout
if not exist "%JAVA_HOME%injava.exe" goto noJavaHome
if not "%JRE_HOME%" == "" goto okJavaHome
set "JRE_HOME=%JAVA_HOME%"
goto okJavaHome
:preJava9Layout
if not "%JRE_HOME%" == "" goto okJavaHome
set "JRE_HOME=%JAVA_HOME%jre"
goto okJavaHome
:noJavaHome
echo The JAVA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
echo NB: JAVA_HOME should point to a JDK not a JRE
goto end
:okJavaHome
if not "%CATALINA_BASE%" == "" goto gotBase
set "CATALINA_BASE=%CATALINA_HOME%"
:gotBase

set "EXECUTABLE=%CATALINA_HOME%in omcat8.exe"

rem Set default Service name
set SERVICE_NAME=Tomcat8
set DISPLAYNAME=Apache Tomcat 8.5 %SERVICE_NAME%

rem Java 9 no longer supports the java.endorsed.dirs
rem system property. Only try to use it if
rem JAVA_ENDORSED_DIRS was explicitly set
rem or CATALINA_HOME/endorsed exists.
set ENDORSED_PROP=ignore.endorsed.dirs
if "%JAVA_ENDORSED_DIRS%" == "" goto noEndorsedVar
set ENDORSED_PROP=java.endorsed.dirs
goto doneEndorsed
:noEndorsedVar
if not exist "%CATALINA_HOME%endorsed" goto doneEndorsed
set ENDORSED_PROP=java.endorsed.dirs
:doneEndorsed

if "x%1x" == "xx" goto displayUsage
set SERVICE_CMD=%1
shift
if "x%1x" == "xx" goto checkServiceCmd
:checkUser
if "x%1x" == "x/userx" goto runAsUser
if "x%1x" == "x--userx" goto runAsUser
set SERVICE_NAME=%1
set DISPLAYNAME=Apache Tomcat 8.5 %1
shift
if "x%1x" == "xx" goto checkServiceCmd
goto checkUser
:runAsUser
shift
if "x%1x" == "xx" goto displayUsage
set SERVICE_USER=%1
shift
runas /env /savecred /user:%SERVICE_USER% "%COMSPEC% /K "%SELF%" %SERVICE_CMD% %SERVICE_NAME%"
goto end
:checkServiceCmd
if /i %SERVICE_CMD% == install goto doInstall
if /i %SERVICE_CMD% == remove goto doRemove
if /i %SERVICE_CMD% == uninstall goto doRemove
echo Unknown parameter "%SERVICE_CMD%"
:displayUsage
echo.
echo Usage: service.bat install/remove [service_name] [/user username]
goto end

:doRemove
rem Remove the service
echo Removing the service '%SERVICE_NAME%' ...
echo Using CATALINA_BASE: "%CATALINA_BASE%"

"%EXECUTABLE%" //DS//%SERVICE_NAME% ^ --LogPath "%CATALINA_BASE%logs"
if not errorlevel 1 goto removed
echo Failed removing '%SERVICE_NAME%' service
goto end
:removed
echo The service '%SERVICE_NAME%' has been removed
goto end

:doInstall
rem Install the service
echo Installing the service '%SERVICE_NAME%' ...
echo Using CATALINA_HOME: "%CATALINA_HOME%"
echo Using CATALINA_BASE: "%CATALINA_BASE%"
echo Using JAVA_HOME: "%JAVA_HOME%"
echo Using JRE_HOME: "%JRE_HOME%"

rem Try to use the server jvm
set "JVM=%JRE_HOME%inserverjvm.dll"
if exist "%JVM%" goto foundJvm
rem Try to use the client jvm
set "JVM=%JRE_HOME%inclientjvm.dll"
if exist "%JVM%" goto foundJvm
echo Warning: Neither 'server' nor 'client' jvm.dll was found at JRE_HOME.
set JVM=auto
:foundJvm
echo Using JVM: "%JVM%"

set "CLASSPATH=%CATALINA_HOME%inootstrap.jar;%CATALINA_BASE%in omcat-juli.jar"
if not "%CATALINA_HOME%" == "%CATALINA_BASE%" set "CLASSPATH=%CLASSPATH%;%CATALINA_HOME%in omcat-juli.jar"

if "%SERVICE_STARTUP_MODE%" == "" set SERVICE_STARTUP_MODE=manual
if "%JvmMs%" == "" set JvmMs=128
if "%JvmMx%" == "" set JvmMx=256

"%EXECUTABLE%" //IS//%SERVICE_NAME% ^ --Description "Apache Tomcat 8.5.32 Server - http://tomcat.apache.org/" ^ --DisplayName "%DISPLAYNAME%" ^ --Install "%EXECUTABLE%" ^ --LogPath "%CATALINA_BASE%logs" ^ --StdOutput auto ^ --StdError auto ^ --Classpath "%CLASSPATH%" ^ --Jvm "%JVM%" ^ --StartMode jvm ^ --StopMode jvm ^ --StartPath "%CATALINA_HOME%" ^ --StopPath "%CATALINA_HOME%" ^ --StartClass org.apache.catalina.startup.Bootstrap ^ --StopClass org.apache.catalina.startup.Bootstrap ^ --StartParams start ^ --StopParams stop ^ --JvmOptions "-Dcatalina.home=%CATALINA_HOME%;-Dcatalina.base=%CATALINA_BASE%;-D%ENDORSED_PROP%=%CATALINA_HOME%endorsed;-Djava.io.tmpdir=%CATALINA_BASE% emp;-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager;-Djava.util.logging.config.file=%CATALINA_BASE%conflogging.properties;%JvmArgs%" ^ --JvmOptions9 "--add-opens=java.base/java.lang=ALL-UNNAMED#--add-opens=java.base/java.io=ALL-UNNAMED#--add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED" ^ --Startup "%SERVICE_STARTUP_MODE%" ^ --JvmMs "%JvmMs%" ^ --JvmMx "%JvmMx%"
if not errorlevel 1 goto installed
echo Failed installing '%SERVICE_NAME%' service
goto end
:installed
echo The service '%SERVICE_NAME%' has been installed.

:end
cd "%CURRENT_DIR%"

ShaunRMiller83
Contributor III

I just had this problem today on my test server after I updated to 10.6.2.

I worked with my JAMF Buddy to resolve it. It's a bug (PI-005531).

I worked on this for about 5 hours before I gave up and called JAMF so I am hoping this helps you and others get this resolved.

Updated the Java Options in C:Program FilesJSSTomcatin omcat8w.exe

-Dcatalina.home=C:Program FilesJSSTomcat 
-Dcatalina.base=C:Program FilesJSSTomcat 
-Djava.endorsed.dirs=C:Program FilesJSSTomcatendorsed 
-Djava.io.tmpdir=C:Program FilesJSSTomcat	emp 
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 
-Djava.util.logging.config.file=C:Program FilesJSSTomcatconflogging.properties

Restarted Tomcat

dhausman
Contributor

I checked my java options....

-Dcatalina.home=D:JSSTomcat
-Dcatalina.base=D:JSSTomcat
-Dignore.endorsed.dirs=D:JSSTomcatendorsed
-Djava.io.tmpdir=D:JSSTomcat emp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=D:JSSTomcatconflogging.properties

Looked good there.
As an update, this is how I got it installed this time...

When I run the Jamf Installer msi, it gets to the very end of the install where it installs a new tomcat service but for whatever reason the jamf installer times out and quits and gives me an error. I look in the jss directory and everything is there.

My work around to get jamf updated is to go into d:/jss/tomcat/bin and run service.bat install after I run the jamf install/upgrade package and it fails. It takes around 90 seconds, but it gets the tomcat service installed properly.

I have a support ticket open with Jamf. I would love to get an installer that gives me 2 minutes for that service to install. I bet the Jamf msi would not fail if the tomcat service installation batch file had enough time.

hansjoerg_watzl
Contributor II

@ShaunRMiller83 Hmm...so your fix was just to update the java options and restart the service? Before or after running the JAMF installer?

I wanted to update our JAMF Pro 10.6.0 to 10.6.2 these days (running on a Windows 2008 R2 server), but I guess, I'm waiting and hope for a quick fix.

ShaunRMiller83
Contributor III

Correct, we did the upgrade to 10.6.2, Changed the Java options, and restart Tomcat

dhausman
Contributor

Small update, Was testing something with Jamf... I did a clone of my VM for my Jamf server and started it up with a network card. I did an uninstall and a reinstall and everything worked perfect no errors. So I am wondering if the network is coming into play for the service install. My current plan is when the next version of Jamf comes out, I am going to snapshot my VM, do an upgrade. If the installer fails again, I am going to restore the snapshot and try again without a NIC and see if it works that way. Will post my results here.

jhayes
New Contributor II

I'm having the same issue; the install gets to the point where it is trying to install the new Tomcat8 service, times out, and then fails. I found in the MSI log the following:

E�x�c�e�p�t�i�o�n� �t�h�r�o�w�n� �b�y� �c�u�s�t�o�m� �a�c�t�i�o�n�:�

�S�y�s�t�e�m�.�R�e�f�l�e�c�t�i�o�n�.�T�a�r�g�e�t�I�n�v�o�c�a�t�i�o�n�E�x�c�e�p�t�i�o�n�:� �E�x�c�e�p�t�i�o�n� �h�a�s� �b�e�e�n� �t�h�r�o�w�n� �b�y� �t�h�e� �t�a�r�g�e�t� �o�f� �a�n� �i�n�v�o�c�a�t�i�o�n�.� �-�-�-�>� �S�y�s�t�e�m�.�E�x�c�e�p�t�i�o�n�:� �T�h�e�r�e� �w�a�s� �a�n� �u�n�e�x�p�e�c�t�e�d� �e�r�r�o�r� �r�u�n�n�i�n�g� �'�"�C�:��P�r�o�g�r�a�m� �F�i�l�e�s��J�S�S��T�o�m�c�a�t��b�i�n��s�e�r�v�i�c�e�.�b�a�t�"� �i�n�s�t�a�l�l�'�!� �-�-�-�>� �S�y�s�t�e�m�.�T�i�m�e�o�u�t�E�x�c�e�p�t�i�o�n�:� �R�u�n�n�i�n�g� �'�"�C�:��P�r�o�g�r�a�m� �F�i�l�e�s��J�S�S��T�o�m�c�a�t��b�i�n��s�e�r�v�i�c�e�.�b�a�t�"�'� �t�i�m�e�d� �o�u�t� �a�f�t�e�r� �'�3�0�'� �s�e�c�o�n�d�s�.�

However, it did create the service. When I start the service manually, I'm able to log into Jamf Pro, but now my Tomcat certificate is expired (it wasn't before). I'm thinking there is a copy/restore process that happens after the Tomcat service is installed but it never gets the chance to do that. Not knowing if other critical changes have happened in addition the the Tomcat SSL cert getting fried, I revert the snapshot. Perhaps I could re-generate a new Tomcat cert and things would work, but it seems to me that Jamf fixing the installer would be a better option.

Any help or advice is welcome,
Justin

hansjoerg_watzl
Contributor II

Anybody tested if the Windows installer for 10.7 is now fixed?

dhausman
Contributor

I have it in change management to install Thursday 9/20. I am working with someone in support, they are going to watch me update.

Dan

dhausman
Contributor

so here is what I found.... If I disable my Network interface card (in software on vmware) the tomcat service installs perfectly. If the network is off, it fails. Support is going back to look into it internally and get back to me.

Dan