I have Tomcat 6 running on Windows 7. The web application running on this server has one jsp and one servlet. The servlet's only responsibility is to call a vbs script and return to the jsp page. I use the following code to execute the script:
This does not cause any errors and no exceptions are thrown, but the vbs script doesn't run. If I run the same command from the command line, or double click the Alert.vbs file, the script executes correctly. This also works running on Tomcat 4.0 running on Windows 2000 and Tomcat 6.0 running on Windows XP.
To verify the problem is with Tomcat on Win7, I created a simple Swing app that executes the same command when a button is clicked and this works correctly.
Does anyone have any ideas I can try?
Joined: Sep 03, 2010
Found a solution...
The issue is being caused because Tomcat was being run as a service and the service did not have authority to interact with the desktop (Service properties->Log On tab->Allow service to interact with desktop). Checking this box resolves the issue, however, it causes multiple pop-ups to display asking the user if it's alright for the service to do what it is doing (even with UAC turned off).
To get around this, I stopped running Tomcat as a service and started it with the following command:
This starts Tomcat as an application instead of as a service which gives it more authority to interact with Windows. Now the VBS script from my example executes as intended with no user interaction.