user2201501
user2201501

Reputation:

TeamCity - start tomcat

I'm trying to start tomcat with a teamcity deployment build step. The steps below all work with no issues when ran directly, but do not work in a teamcity step. The java window appears and closes, as though the build step kills all child processes when completed. I have tried all of the following:

batch (command line running a batch in sources, or right in teamcity script, and command line, and process build types):

call "%env.CATALINA_HOME%\bin\startup.bat"
start "%env.CATALINA_HOME%\bin\startup.bat"
cmd /k "%env.CATALINA_HOME%\bin\startup.bat"
start "DEV server" "%env.CATALINA_HOME%\bin\startup.bat"

powershell:

# wasnt sure if env var was being carried over, not relevant 
$env:CATALINA_HOME = %env.CATALINA_HOME%
Start-Process "%env.CATALINA_HOME%\bin\startup.bat"

is there some way to tell TeamCity 10 build step 'hey, leave whatever was started running'?

CATALINA_HOME is an environment variable in the teamcity parameters (env.CATALINA_HOME) and is set to "C:\apache-tomcat" which is correct.

Some additional information: the TC server and agent is running as a user account, the user account has access to all folders (and is local admin) as well.

Upvotes: 1

Views: 1449

Answers (1)

user2201501
user2201501

Reputation:

in tomcat bin\setenv.bat I had CATALINA_OPTS -XmX and -Xms parameters which were very large and required 64 bit java.

When doing this specific build parameter (which I recommend for debugging, it will block the TC build)

%env.CATALINA_HOME%\bin\catalina.bat

(argument: run)

I then got an exit code 1 build failure with a useful error message (but no tomcat logs):

[08:25:24]Error: Could not create the Java Virtual Machine.
[08:25:24]Error: A fatal exception has occurred. Program will exit.
[08:25:24]Invalid maximum heap size: -Xmx32768m
[08:25:24]The specified size exceeds the maximum representable size.
[08:25:24]Process exited with code 1

If you need large Xmx and Xms of a child process, the BUILD AGENT executing the build needs to be running from 64 bit as well! In my case, I had, eg

C:\Teamcity_BuildAgent_Deploy\jre

I copy pasted my 64 bit jre installation in there as well per TC docs and then it could start processes with large Xmx and Xms. I did not adjust TEAMCITY_AGENT_MEM_OPTS or any batches.

Upvotes: 1

Related Questions