| Author |
Using getRuntime().exec() within EJB
|
Vinoth Selvaraj
Greenhorn
Joined: Jun 07, 2006
Posts: 18
|
|
Hi, Is there any restriction in using getRuntime().exec() within EJB to create a new process. Also, can we create threads from within EJB? With Regards Vinoth Selvaraj
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
You can do neither. From the J2EE Spec.:
The enterprise bean must not attempt to manage threads. The enterprise bean must not attempt to start, stop, suspend, or resume a thread, or to change a thread�s priority or name. The enterprise bean must not attempt to manage thread groups.
Calling Runtime.exec() is opening a security hole. Why do you need to do this? [ December 12, 2006: Message edited by: Paul Sturrock ]
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Vinoth Selvaraj
Greenhorn
Joined: Jun 07, 2006
Posts: 18
|
|
The application in which i am working in, has to invoke a perl script in the remote machine and get the results from a file written by it. So, please suggest, how to implementt this in EJB module. Or alternatively can we have a web component in the server which will handle this requirement.
|
 |
Vinoth Selvaraj
Greenhorn
Joined: Jun 07, 2006
Posts: 18
|
|
|
Is there any possibility to implement this requirement from EJB??
|
 |
Deepa Raja
Greenhorn
Joined: Nov 27, 2006
Posts: 7
|
|
In the MDB, Runtime javaRuntime = Runtime.getRuntime(); Process p = javaRuntime.exec(jobName ); p.waitFor(); return p.exitValue(); This will call your job which is specified. It will work. But i dont know that it would be a right choice.(Security)
|
 |
 |
|
|
subject: Using getRuntime().exec() within EJB
|
|
|