*
The moose likes Websphere and the fly likes runtime.exec on WebSphere Application Server not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "runtime.exec on WebSphere Application Server not working" Watch "runtime.exec on WebSphere Application Server not working" New topic
Author

runtime.exec on WebSphere Application Server not working

Rishikesh Dagwal
Greenhorn

Joined: Apr 10, 2008
Posts: 1
Hi,

I am using [ IBM WebSphere Application Server, 6.0.0.1, 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 );
******************************************

Where
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.
i.e.
***********************************************
............................
MY_DATA=Y:\\
.....................
************************************************

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, 6.0.0.1, 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, 6.0.0.1 running as windows service.

I discovered one work around for this issue. I removed windows service for the WebSphere Application Server, 6.0.0.1 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, 6.0.0.1 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, 6.0.0.1 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,
Rishikesh
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: runtime.exec on WebSphere Application Server not working
 
Similar Threads
WebSphere application accessing files from Map Network Drive
System cannot find the path specified
Not able to access Network Drive
Servlet works on WebSphere but not on Tomcat
Map drive access through Java Application running as a service