• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Using getRuntime().exec() within EJB

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Vinoth Selvaraj
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any possibility to implement this requirement from EJB??
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!