I used to run tomcat 4 as a windows service with automatic startup under srvany.exe. srvany.exe just called startup.bat. I ran my tomcat with the security manager option, specified as usual by the line "set CMD_LINE_ARGS= -security" in startup.bat.
Now I have upgraded to Tomcat 5, which automatically installs as a windows service, which is great. However, I cant find any documentation on how to tell it to run the security manager, since when you run it on automatic startup it doesnt call startup.bat. My guess is that this has to be done using the Configure Tomcat UI, but so far I'v had no success. If I add "-security" after 'start' in the arguments file on the startup tab, I get a message telling me the service started and then stopped. If I try adding "-security" to the java options tab I get a message telling me simply that tomcat will not start. Does anyone know the syntax for telling tomcat to run using the security manager and catalina.policy when tomcat is running as a windows service? (it works just fine if you fire it up from startup.bat, so its nothing wrong with the actual policy file configuration)
Joined: Jan 09, 2006
Thought I'd reply to my own query since I'v now got the answer form another source, in case it helps anyone else. the solution is...
Add two lines (not just one single line) on the java options tab of the Configure Tomcat UI
-Djava.security.manager and -Djava.security.policy=C:\Program Files\Apache Software Foundation\Tomcat 5.0\conf\catalina.policy
and make sure there are no spaces at the start of either line
If you're running Tomcat as a windows service or from the Start menu items, those values are stored in the Windows Registry.
The program regedit can search the registry for those values.
Personally, I hate dealing with the registry. If it were me, I'd just re-install Tomcat and be sure to check the "Start Menus" option during the install wizard.
If you're starting tomcat from the batch files (or the sh scripts on Unix) then you can add them to the JAVA_OPTS environment variable (see the header in catalina.bat or catalina.sh, in the tomcat/conf directory) [ December 21, 2006: Message edited by: Ben Souther ]
Joined: Dec 19, 2006
Thanks very much for getting back to me.
(I need to run tomcat as a windows service)
IT say that its not an option to reinstall the service! So if anyone can help me out by telling me the exact entry i need to hardcode into regedit then that would be great.
Many thanks in advance
Joined: Dec 19, 2006
After routing around in the registry settings i think i have found the right place for these variables. In HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Procrun 2.0\tomcatqasdotcom\Parameters\Java\Options.
OK, when i try and start tomcat via the windows service i now get the following errors in my stdout
The weird thing is that when i run tomcat from a command prompt i get no such errors
I have literally no idea how to proceed from here so any help would be much welcomed.