Hi,
I was wondering if anyone could enlighten me as to the best way to call runtime.exec() from an ejb. Now, I know that the spec disallows it and really I would prefer to adheer to the spec.
So, is the only other option setting up a Corba service and running it that way ? If anyone has any experience with this or any ideas I would really like to hear them.
Thanks
David
-
Runtime.exec() from EJB (6 messages)
- Posted by: David Harte
- Posted on: January 09 2003 09:43 EST
Threaded Messages (6)
- Runtime.exec() from EJB by Tomas Inger on January 09 2003 13:00 EST
- Runtime.exec() from EJB by David Harte on January 09 2003 13:16 EST
- Runtime.exec() from EJB by Robert Simmons on January 11 2003 05:54 EST
- Runtime.exec() from EJB by David Harte on January 09 2003 13:16 EST
- Security problem by J. B. Rainsberger on January 13 2003 10:57 EST
- Security problem by David Harte on January 14 2003 09:17 EST
- Security problem by J. B. Rainsberger on January 28 2003 09:12 EST
- Security problem by David Harte on January 14 2003 09:17 EST
-
Runtime.exec() from EJB[ Go to top ]
- Posted by: Tomas Inger
- Posted on: January 09 2003 13:00 EST
- in response to David Harte
Hi!
I think you can call it directly from the EJB as long as you really know what you are doing. (Like breaking the spec.)
And you should know that the Java code depends on the operating system. However, this can be solved with some variant of the Abstract Factory pattern (together with a Singleton) where you define an interface for the abstract factory and put the implementation's implementing class as configuration. Then you have to implement and test one class for every new oåerating system.
Examples of similar things in the Java API are the JDBC driver and the DOM API for XML. And the most obvious example should be the InitialContext!
/Tomas -
Runtime.exec() from EJB[ Go to top ]
- Posted by: David Harte
- Posted on: January 09 2003 13:16 EST
- in response to Tomas Inger
Thomas,
Thanks for the interesting reply, do you not mean the Factory Method pattern though (as opposed to the Abstract Factory Pattern) ?
David -
Runtime.exec() from EJB[ Go to top ]
- Posted by: Robert Simmons
- Posted on: January 11 2003 05:54 EST
- in response to David Harte
Actually that is a big no-no. EJBs are not allowed to use any thread mechanisms or OS commands. What exactly are you tryign to do? -
Security problem[ Go to top ]
- Posted by: J. B. Rainsberger
- Posted on: January 13 2003 10:57 EST
- in response to David Harte
Issuing an OS call from an EJB is a potential security hole. Do not do this. Consider making that other service available online and access it as a web service. Without knowing specifically what you're trying to do, it's difficult to make further suggestions.
Good luck. -
Security problem[ Go to top ]
- Posted by: David Harte
- Posted on: January 14 2003 09:17 EST
- in response to J. B. Rainsberger
Thanks for all the suggestions,
What we need to do is to be able to run an executable from our ejb's. However, I do reckognise the problems associated with this and what the spec states.
I think the way forward is to make the executable available as a web service (as suggested) and use it that way. In fact we are currently looking at IBM's BPWS4J for web services integration, it seems to work very well .... so far.
Thanks again,
David -
Security problem[ Go to top ]
- Posted by: J. B. Rainsberger
- Posted on: January 28 2003 09:12 EST
- in response to David Harte
I'm glad that you found my suggestion helpful. I wish you the best of luck with the design choice you've made. It should work well for you.