Skip to content
Snippets Groups Projects
Commit 7eaf4830 authored by Vincent Massol's avatar Vincent Massol
Browse files

XWIKI-11377: Make it easy to run a JMX console against the Jetty standalone distribution

parent f5cad889
No related branches found
No related tags found
No related merge requests found
......@@ -61,6 +61,11 @@
<artifactId>jetty-start</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jmx</artifactId>
<version>${jetty.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
......
<?xml version="1.0"?>
<!--
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- =========================================================== -->
<!-- Set the java.rmi.server.hostname property in case you've -->
<!-- got a misconfigured /etc/hosts entry or the like. -->
<!-- =========================================================== -->
<!--
<Call class="java.lang.System" name="setProperty">
<Arg>java.rmi.server.hostname</Arg>
<Arg>127.0.0.1</Arg>
</Call>
-->
<!-- =========================================================== -->
<!-- Get the platform mbean server -->
<!-- =========================================================== -->
<Call id="MBeanServer" class="java.lang.management.ManagementFactory"
name="getPlatformMBeanServer" />
<!-- =========================================================== -->
<!-- Initialize the Jetty MBean container -->
<!-- =========================================================== -->
<Call name="addBean">
<Arg>
<New id="MBeanContainer" class="org.eclipse.jetty.jmx.MBeanContainer">
<Arg>
<Ref refid="MBeanServer" />
</Arg>
</New>
</Arg>
</Call>
<!-- Add the static log -->
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.util.log.Log" />
</Arg>
</Call>
</Configure>
# ---------------------------------------------------------------------------
# See the NOTICE file distributed with this work for additional
# information regarding copyright ownership.
#
# This is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of
# the License, or (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this software; if not, write to the Free
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
# ---------------------------------------------------------------------------
#
# JMX Module
#
[depend]
server
[lib]
lib/jetty-jmx-${jetty.version}.jar
[xml]
etc/jetty-jmx.xml
......@@ -37,6 +37,7 @@ usage() {
echo "-sp, --stopport: The Jetty stop port to use. Overrides any value from JETTY_STOP_PORT. Defaults to 8079."
echo "-ld, --lockdir: The directory where the executing process id is stored to verify that that only one instance"
echo " is started. Defaults to /var/tmp."
echo "-j, --jmx: Allows monitoring the Jetty server with a JMX console (such as jconsole)."
echo ""
echo "Example: start_xwiki.sh -p 8080 -sp 8079"
}
......@@ -94,6 +95,10 @@ while [[ $# > 0 ]]; do
XWIKI_LOCK_DIR="$1"
shift
;;
-j|--jmx)
XWIKI_OPTS="$XWIKI_OPTS -Dcom.sun.management.jmxremote"
JETTY_OPTS="$JETTY_OPTS --module=jmx"
;;
-h|--help)
usage
exit 1
......
......@@ -36,6 +36,7 @@ usage() {
echo "-sp, --stopport: The Jetty stop port to use. Overrides any value from JETTY_STOP_PORT. Defaults to 8079."
echo "-ld, --lockdir: The directory where the executing process id is stored to verify that that only one instance"
echo " is started. Defaults to /var/tmp."
echo "-j, --jmx: Allows monitoring the Jetty server with a JMX console (such as jconsole)."
echo "-yp, --yourkitpath: The path where Yourkit can find the agent. If not passed then YourKit won't be enabled."
echo " For example: \"/Applications/YourKit Java Profiler 7.0.11.app/bin/mac\""
echo " or \"/home/User/yjp-11.0.8/bin/linux-x86-64/\""
......@@ -98,6 +99,10 @@ while [[ $# > 0 ]]; do
XWIKI_LOCK_DIR="$1"
shift
;;
-j|--jmx)
XWIKI_OPTS="$XWIKI_OPTS -Dcom.sun.management.jmxremote"
JETTY_OPTS="$JETTY_OPTS --module=jmx"
;;
-yp|--yourkitpath)
YOURKIT_PATH="$1"
shift
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment