• Post Reply Bookmark Topic Watch Topic
  • New Topic

invoking a standalone app from jsp

 
Ankit Doshi
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an application, for the maintenance of which, I have created a jsp page with tomcat, so that application can be started/stopped from browser. Now to start the application, what I need to do is, get the Runtime object, and call the exec method of runtime, passing as argument "java -classpath myclasspath myApp 1>/var/log/app.log 2>&1 &". This application remains on continuously, thats why I need to put it in background and redirect the output/error logs. Now, when I execute this command using exec method, it doesn't return from the exec call, neither does any output/error goes into the specified log file, though the processes of the application are started. Whats I am trying to do here is that I am trying to invoke my application in its own jvm, from the jvm of tomcat. Why is it not returning from this call? What could be the solution to this?
Waiting for replies,
Ankit.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the application remains on continuously, then the Process created by exec continues to monitor it - that hangs up the JSP thread.
You might start the app by executing a batch file, that can return as soon as the command executes.
Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!