aspose file tools*
The moose likes Tomcat and the fly likes -security option on tomcat 5 when run as service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "-security option on tomcat 5 when run as service" Watch "-security option on tomcat 5 when run as service" New topic
Author

-security option on tomcat 5 when run as service

jane sharp
Greenhorn

Joined: Jan 09, 2006
Posts: 2
hi guys

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)
jane sharp
Greenhorn

Joined: Jan 09, 2006
Posts: 2
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
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Jane,
Thank you for replying with the answer.
People do often come across these threads via search engines.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Matthew Hersee
Greenhorn

Joined: Dec 19, 2006
Posts: 9
hi,

I was googling this exact problem.

I dont have access to the tomcat UI. Can somebody tell me which file i need to put those two lines.

Much appreciated

Thanks

Matt
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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 ]
Matthew Hersee
Greenhorn

Joined: Dec 19, 2006
Posts: 9
Hi,

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

Matt
Matthew Hersee
Greenhorn

Joined: Dec 19, 2006
Posts: 9
Hi all,

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.

Thanks

Matt
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Sounds like a real helpful IT department you've got there.

If this were my problem, I'd install Tomcat as a service on another machine, such as my own workstation, and use that as a reference.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: -security option on tomcat 5 when run as service