5

I am using Jetty 7.4 for one of my projects. I need to configure it so that it can start/stop automatically whenever the server starts up or goes down. Also, I should be able to start/stop the server on demand. I am using the start/stop script that comes along with jetty(bin/jetty.sh). The server starts just fine. However, when it comes to stopping the server, I am facing some problems.

Jetty expects you to start the server with "--exec" command line parameter and this parameter spawns another JVM instance. Now there are two processes running for jetty. When you try to stop the jetty server using the script the first process dies successfully. However, I can still see the spawned process.

I've searched the web and people have asked this question at multiple places but I could not find a solution to this problem. Any ideas?

thanks,

NG

systemboot
  • 860
  • 2
  • 8
  • 22

1 Answers1

1

This doesn't really answer the question, but I worked around this by specifying JVM options in a new file in /etc/default/jetty. There you can set JVM options using something like this:

JAVA_OPTIONS="-XX:MaxPermSize=128m -Xms1024m -Xmx1024m"

Then you won't have to spawn another process using --exec and you can just use jetty.sh to start and stop the one process normally.

Bart
  • 1,928
  • 2
  • 14
  • 13
  • I can always start jetty without --exec parameter, and jetty.sh start/stop commands will work just fine. However, it is my understanding, if you want to run jetty with advance features like JMX etc, you need start the server with "--exec" parameter. I can be wrong though. – systemboot May 24 '11 at 15:02
  • @user766453 - I'm a relative noob to jetty too, but `--exec` is only used for passing arguments directly to the JVM (ie, memory settings, system properties.) What I've shown is another way to pass arguments directly to the JVM when using `jetty.sh`. Either way, I don't _think_ enabling JMX requires setting arguments on the JVM. It just requires setting properties on Jetty, an important distinction. http://wiki.eclipse.org/Jetty/Tutorial/JMX – Bart May 24 '11 at 16:44