Perlos
Perlos

Reputation: 2118

set catalina opts in tomcat configuration

Hi i set parameters for tomcat in configuration window on tab java and field java options. I'd like add to configuration to catalina_opts is there a way how to do it??

In that field i have

-Dcatalina.home=d:\apache-tomcat-7.0.23
-Dcatalina.base=d:\apache-tomcat-7.0.23
-Djava.endorsed=d:\apache-tomcat-7.0.23\endorsed
-Djava.io.tmpdir=d:\apache-tomcat-7.0.23\temp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=d:\apache-tomcat-7.0.23\conf\logging.properties
-XX:MaxPermSize=256m

Edit: 22.06.2012 12:26

I want add this parameters

-Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.port=8777 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=false 
-Djava.rmi.server.hostname=192.168.1.1

Edit: 22.06.2012 12:51

I put these parameters directly into the field "Java options" and it works, not sure why it didn't work the 1st time.

Upvotes: 19

Views: 120639

Answers (5)

Matt Roy
Matt Roy

Reputation: 1535

With Tomcat as Windows service, I found the registry keys you can change to edit Java Options. In my case, it fixed my problem.

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Apache Software Foundation\Procrun 2.0\[service name]\Parameters\Java

Here you can find examples and references.

Upvotes: 3

B.ant
B.ant

Reputation: 141

If you want to use Tomcat as Windows Service, just ignore editing catalina.bat (also CATALONA_OPTS or JAVA_OPTS). After that you install Tomcat as WS, just use ++JvmOptions="<JvmOptions>"(you should be in tomcat_home/bat directory) e.g.

tomcat8.exe //US/Tomcat_Service ++JvmOptions="-D<option>"

Upvotes: 5

borjab
borjab

Reputation: 11675

Unfortunatly if you run it a as a service it won't use the parameters. Use this doc to update the --JvmOptions parameter or edit it directly executing the following command from CATALINA_HOME/bin/

tomcat7w //ES/myServiceName

If you use tomcat .bat scripts I would create the enviroment variable CATALINA_OPTS with all thouse options as a value. The initial script startup.bat will call catalina.bat which will execute something like this depending on the Tomcat version:

%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %JPDA_OPTS% %DEBUG_OPTS% [...]

This way you do not need to modify the tomcat Script and new versions of Tomcat will read this enviroment variable if you make an update, lets say, to Tomcat 8.

Upvotes: 3

Bozho
Bozho

Reputation: 597392

Place the following in catalina.sh (below the documentation)

export CATALINA_OPTS="-Dfoo=foo -Dbar=bar"

Upvotes: 27

mihaisimi
mihaisimi

Reputation: 2029

See here: http://www.springwebdevelopment.com/tomcat-more-memory-catalina_opts

Just in case the link won't work anymore:

On Windows Edit the file $TOMCAT_HOME\bin\startup.bat and insert or alter the following line, substituting for the desired values: set CATALINA_OPTS=...

On Linux Edit the file $TOMCAT_HOME/bin/startup.sh and insert the following line, substituting for the desired value, eg. Bash Shell: export CATALINA_OPTS=... The line you add should go just before the line starting exec “$PRGDIR…

Mihai

Upvotes: 0

Related Questions