Start tomcat with specific java parameters

I start Tomcat using startup.bat in the TOMCAT_HOME \ bin directory.
I need to enable all java debug traces.
In my web application (Note: this is actually axis2 web service). I did:
System.setProperty("javax.net.debug","all");
But that did not work. Nothing is printed on the Tomcat console.
I tried to put this property as a parameter in Tomcat at startup, so I edited the catalina.bat file as follows:
Before:

 if not "%LOGGING_MANAGER%" == "" goto noJuliManager set LOGGING_MANAGER=-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager :noJuliManager set JAVA_OPTS=%JAVA_OPTS% %LOGGING_MANAGER% 

After:

 if not "%LOGGING_MANAGER%" == "" goto noJuliManager set LOGGING_MANAGER=-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager :noJuliManager set JAVA_OPTS=%JAVA_OPTS% %LOGGING_MANAGER% set JAVA_OPTS=-Djavax.net.debug=all %JAVA_OPTS% 

I’m not sure if this is the place to record it in catalina.bat, but it seemed reasonable to me.
There was no success.
So how can I start tomcat with the -Djava option?
In particular, how can I enable

System.setProperty("javax.net.debug","all"); so what can i do debugging in my web application?

Thanks.

+4
source share
2 answers

The β€œofficial” way to set advanced options for Tomcat is to create bin/catalina.sh on Unix or bin\catalina.bat on Windows. In your (Windows) case, the file should look like this:

 set CATALINA_OPTS=%CATALINA_OPTS% -Djavax.net.debug=all 
+4
source

A hacker solution is to search for the entire JAVA_OPTS set in the catalina.bat AND startup.bat file and add something there.

You must find one or more of the installed JAVA_OPTS = ......., and you can add something there. This is what I do when I need to add additional options and I don’t have time to understand why @mindas Solution does not work.

0
source

Source: https://habr.com/ru/post/1343426/


All Articles