Search code examples
tomcatshcatalinacatalina.out

error message "/opt/tomcat/bin/catalina.sh: 1: eval: Syntax error: Unterminated quoted string


In my catalina.out I have this error

/opt/tomcat/bin/catalina.sh: 1: eval: Syntax error: Unterminated quoted string

I think this means that a string is declared with a quotation mark (") but it doesn't have the closing quotation mark, but I don't find the error.

Any suggestions to find the error?

I use tomcat 8.5.3.32 and I only add this to catalina.sh

JAVA_OPTS="$JAVA_OPTS -Xms2048m -Xmx4096m -XX:PermSize=512m -XX:MaxPermSize=512m"

Solution

  • It's best to restore the default catalina.sh file and never change it.

    Instead, create a setenv.sh file in the same directory, and do all of your configuration there. That file will not be overwritten by a future tomcat upgrade, and will continue to keep your personal configuration changes going forward.

    For the problem at hand: Evaluate if your $JAVA_OPTS already contains quotes - e.g. through a directory that contains a space. And make sure the whole expanded line is properly formatted.

    But an even better fix: You don't want to make the changes you're doing in JAVA_OPTS, but in CATALINA_OPTS (here's why). Set its value - in setenv.sh - to

    CATALINA_OPTS="$CATALINA_OPTS -Xms2048m -Xmx4096m -XX:PermSize=512m -XX:MaxPermSize=512m"
    

    (or follow the other recommendation from my linked answer and use identical memory settings for -Xms and -Xmx)