Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

execute binary or unix-script from EJB

 
Olexiy Prokhorenko
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello guys,

what is the best way to run external binary or Unix-script from EJB?
is there are any special requirements? notes? important moments?

I would be thankful if you'll be able to share some knowledge on this topic.

thanks.
 
Valentin Tanase
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Olexiy,

First of all, you might consider that your bean could be enlisted within a transaction. It would make me feel quite uncomfortable to know that the result of the transaction depends upon the result of an external process. If your process updates a file but the transaction rolls back, will the file be in a consistent state? Isn�t too much of a thought to have global (distributed) 2PC transactions depending upon an external, uncontrolled process?
Second of all it might raise security issue. You have to grant to the container the permission to run that process. This means that all deployed applications can run the same process.
Finally you might find this article pretty interesting:
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps_p.html
Regards.
 
Olexiy Prokhorenko
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Valentin,

I understand all possible transactions problems.
Unfortunatelly, there is a legacy part of our existing system, which we can't re-write using J2EE power at the moment. I will have to use it AS IS.

That's why I just have to call external binaries and scripts.

Thank you for your link.
Will try to dig deeper into this.

By the way, one of requirements will be generating PDF from existing URL. Can anybody suggest some open-source J2EE library for this purpose?

Thanks.
 
Valentin Tanase
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We're using iText and is pretty good. See:
http://www.lowagie.com/iText
 
Shibu Raj
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For Generation of PDF files we have created a web service which accepts the data in XML file and the formatting info as XSLT file. This is flexible in the sense, other applications also call the same webservice to have the PDF generation power. We used Apache Axis and XML/XSL FO for the PDF conversation.

Good Luck!

Thanks
Shibu
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic