This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

runtime.exec on WebSphere Application Server not working  RSS feed

Rishikesh Dagwal
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am using [ IBM WebSphere Application Server,, Build Number: o0445.08, Build Date: 11/10/04 ]
This server is running as windows service.

I have a web application deployed on it. The task of this web application is to start a exe file using following code

Runtime runtime = Runtime.getRuntime();
Process p = runtime.exec( command, env );

command = the executable with parameters
env = String array that contains strings (in key=value format) read from a file env.txt.

This env.txt file is a properties file and contains system environment variables.

One property from this file contains path of a mapped network drive i.e. MY_DATA=Y:\\
The executable stated above reads from the mapped network drive.
When I deployed and started this application on WebSphere Application Server,, exe fails to start . If I use UNC path instead of mapped network drive path ( i.e. \\\\host\\sharedFolderName instaed of Y:\\ ) then exe starts normally.

In stand alone mode ( run from command promt ) this exe runs normally using the same env with both mapped network drive as well as UNC path.

I have deployed same application on tomcat 5.5.20 and WAS CE 1.0. It runs normally on these servers. Problem occurs only on WebSphere Application Server, running as windows service.

I discovered one work around for this issue. I removed windows service for the WebSphere Application Server, using 'wasservice.exe -remove' command. Started websphere server using startServer.bat file. In this case exe gets started normally using both mapped network drive as well as UNC path.

Can any one suggest where is the problem and what is the solution for it if want my WebSphere Application Server, is to be run as windows service?

I am sure that problem is some where in process context where exe gets executed. Becasue the same thing is running normally in both WAS CE 1.0 and Tomcat 5.5.20. May be the process context for these two server are different which can understand the mapped network drive. Also when I remove windows services for WebSphere Application Server, then it runs fine because may be it is using the different process context.

If anyone have idea about it kindly share it ASAP.

Best Regards,
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!