File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Starting a process from within a Servlet

 
Markus Kahl
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

I'm trying to run a Groovy script from within a servlet.
For this a wrote a class which used on its own, outside the servlet container,
works perfectly fine.
However, if it is used inside the servlet container (Tomcat by the way),
it does not work at all.

It seems to me, that there are some problems with the environment.
But also setting the path for the groovy executable didn't seem to do the trick.

Here is the code:



When run inside the servlet container this results in the following output:

Unrecognized option: Files
error: jvm creation failed with code -1: unknown error


I'm doing this on Windows and that "option Files" probably comes from "C:\Program Files\...".
I don't know where exactly the problem lies, especially as it only occurs when run inside the servlet container.

That "jvm creation failed" puzzles me. Is it possible, that the groovy executable is actually executed but then
groovy lacks some environment variables or why is there something about a JVM being created?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd imagine it's because of the space in the path, causing the command line processor to separate the command line parameters. You'd need to quote it.

That said--given that there are better ways to run Groovy from inside a Java program, this seems like a Really Bad way to do it.
 
Markus Kahl
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I actually tried that first.
But again I had problems. With the same code I could run the groovy script
in a stand-alone J2SE app but when run inside the servlet container it didn't work.
The code that is supposed to run the script is called but nothing happens.

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic