Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

start tomcat with specific java parameters [closed]

I am starting Tomcat using the startup.bat in the TOMCAT_HOME\bin directory.
I need to enable all the java's debugging traces.
In my web app (Note: Actually it is an axis2 web service) I did:
System.setProperty("javax.net.debug","all");
But it did not work.
Nothing printed to Tomcat console.
I tried to put this property as parameter in Tomcat on start-up so I edited the catalina.bat 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 am not sure if this is the write place to put it in catalina.bat, but it seemed reasonable to me.
No success as well.
So how can I start tomcat with a -Djava option?
Specifically how can I enable

System.setProperty("javax.net.debug","all"); so that I can do the debugging in my web app?

Thank you.

like image 311
Cratylus Avatar asked Mar 12 '11 10:03

Cratylus


1 Answers

The "official" way to set extra parameters to Tomcat is via creating bin/catalina.sh in Unix or bin\catalina.bat in Windows. In your (Windows) case, the file should look like as follows:

set CATALINA_OPTS=%CATALINA_OPTS% -Djavax.net.debug=all
like image 147
mindas Avatar answered Sep 22 '22 06:09

mindas