Search code examples
javatomcatjvmtomcat6

Unrecognized option: -security in Tomcat


I'm trying to enable SecurityManager in Tomcat 6.0.43 using this doc: https://tomcat.apache.org/tomcat-6.0-doc/security-manager-howto.html

When I start Tomcat with "-security" option, I get the following error in catalina.out:

Unrecognized option: -security
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

I tried to use OpenJDK JRE 1.7 and Oracle JRE 1.7. In both cases I've got the same error.

Am I missing something?

UPDATE

The command I'm using is:

export JRE_HOME=/opt/jre
export CATALINA_OPTS="-XX:MaxPermSize=128m -Xbootclasspath/a:"/opt/apache-tomcat/lib/*"-Dcatalina.home="/opt/apache-tomcat" -Dlog4j.configuration=file:"/opt/apache-tomcat/lib/log4j.properties" -Xms256m -Xmx256m -security"
catalina.sh start

Solution

  • You can't use -security in CATALINA_OPTS. It has to be a parameter passed-into the script on the command-line, like this:

    $ export CATALINA_OPTS="-XX:MaxPermSize:128 [...]"
    $ $CATALINA_HOME/bin/catalina.sh -security start