• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using getRuntime().exec() within EJB

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any possibility to implement this requirement from EJB??
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic