Author: markt
Date: Wed Oct 1 03:47:41 2008
New Revision: 700734
URL: http://svn.apache.org/viewvc?rev=700734&view=rev
Log:
Move JmxRemote to extras. Fix Tomcat hang on shutdown. Improve logging. Update
the docs.
Modified:
tomcat/trunk/build.xml
tomcat/trunk/extras.xml
tomcat/trunk/java/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java
tomcat/trunk/java/org/apache/catalina/mbeans/LocalStrings.properties
tomcat/trunk/webapps/docs/config/listeners.xml
Modified: tomcat/trunk/build.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/build.xml?rev=700734&r1=700733&r2=700734&view=diff
==============================================================================
--- tomcat/trunk/build.xml (original)
+++ tomcat/trunk/build.xml Wed Oct 1 03:47:41 2008
@@ -259,6 +259,7 @@
<exclude name="org/apache/catalina/ant/**" />
<exclude name="org/apache/catalina/cluster/**" />
<exclude name="org/apache/catalina/ha/**" />
+ <exclude name="org/apache/catalina/mbeans/JmxRemote*" />
<exclude name="org/apache/catalina/tribes/**" />
<exclude name="org/apache/catalina/launcher/**" />
<exclude name="org/apache/catalina/storeconfig/**" />
Modified: tomcat/trunk/extras.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/extras.xml?rev=700734&r1=700733&r2=700734&view=diff
==============================================================================
--- tomcat/trunk/extras.xml (original)
+++ tomcat/trunk/extras.xml Wed Oct 1 03:47:41 2008
@@ -82,6 +82,7 @@
<property name="cometd.war" value="${tomcat.extras}/cometd.war"/>
<property name="tomcat-bayeux-samples.jar"
value="${tomcat.extras}/tomcat-bayeux-samples.jar"/>
+ <property name="catalina-jmx-remote.jar"
value="${tomcat.extras}/catalina-jmx-remote.jar"/>
<!-- Classpath -->
<path id="tomcat.classpath">
@@ -330,7 +331,20 @@
</echo>
</target>
- <target name="extras" depends="prepare,commons-logging,webservices,bayeux">
+ <target name="jmx-remote" >
+ <!-- Create the JAR file -->
+ <jar jarfile="${catalina-jmx-remote.jar}">
+ <fileset dir="${tomcat.classes}">
+ <include name="org/apache/catalina/mbeans/JmxRemote*" />
+ </fileset>
+ </jar>
+
+ <checksum file="${catalina-jmx-remote.jar}"
+ forceOverwrite="yes" fileext=".md5" />
+
+ </target>
+
+ <target name="extras"
depends="prepare,commons-logging,webservices,bayeux,jmx-remote">
</target>
<!-- Download and dependency building -->
Modified:
tomcat/trunk/java/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java?rev=700734&r1=700733&r2=700734&view=diff
==============================================================================
---
tomcat/trunk/java/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java
(original)
+++
tomcat/trunk/java/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java
Wed Oct 1 03:47:41 2008
@@ -75,6 +75,9 @@
protected String accessFile = null;
protected boolean useLocalPorts = false;
+ protected JMXConnectorServer csPlatform = null;
+ protected JMXConnectorServer csCatalina = null;
+
/**
* Get the port on which the Platform RMI server is exported. This is the
* port that is normally chosen by the RMI stack.
@@ -247,16 +250,22 @@
// Create the Platform server
- createServer(rmiRegistryPortPlatform, rmiServerPortPlatform, env,
+ csPlatform = createServer("Platform", rmiRegistryPortPlatform,
+ rmiServerPortPlatform, env,
ManagementFactory.getPlatformMBeanServer());
// Create the catalina server
- createServer(rmiRegistryPortCatalina, rmiServerPortCatalina, env,
+ csCatalina = createServer("Catalina", rmiRegistryPortCatalina,
+ rmiServerPortCatalina, env,
MBeanUtils.createServer());
+ } else if (Lifecycle.STOP_EVENT == event.getType()) {
+ destroyServer("Platform", csPlatform);
+ destroyServer("Catalina", csCatalina);
}
}
- private void createServer(int theRmiRegistryPort, int theRmiServerPort,
+ private JMXConnectorServer createServer(String serverName,
+ int theRmiRegistryPort, int theRmiServerPort,
HashMap<String,Object> theEnv, MBeanServer theMBeanServer) {
// Create the RMI registry
@@ -265,8 +274,8 @@
} catch (RemoteException e) {
log.error(sm.getString(
"jmxRemoteLifecycleListener.createRegistryFailed",
- Integer.toString(theRmiRegistryPort)), e);
- return;
+ serverName, Integer.toString(theRmiRegistryPort)), e);
+ return null;
}
// Build the connection string with fixed ports
@@ -282,21 +291,37 @@
} catch (MalformedURLException e) {
log.error(sm.getString(
"jmxRemoteLifecycleListener.invalidURL",
- url.toString()), e);
- return;
+ serverName, url.toString()), e);
+ return null;
}
// Start the JMX server with the connection string
- JMXConnectorServer cs;
+ JMXConnectorServer cs = null;
try {
cs = JMXConnectorServerFactory.newJMXConnectorServer(
serviceUrl, theEnv, theMBeanServer);
cs.start();
log.info(sm.getString("jmxRemoteLifecycleListener.start",
Integer.valueOf(theRmiRegistryPort),
- Integer.valueOf(theRmiServerPort)));
+ Integer.valueOf(theRmiServerPort), serverName));
} catch (IOException e) {
- log.error(sm.getString(""), e);
+ log.error(sm.getString(
+ "jmxRemoteLifecycleListener.createServerFailed",
+ serverName), e);
+ }
+ return cs;
+ }
+
+ private void destroyServer(String serverName,
+ JMXConnectorServer theConnectorServer) {
+ if (theConnectorServer != null) {
+ try {
+ theConnectorServer.stop();
+ } catch (IOException e) {
+ log.error(sm.getString(
+ "jmxRemoteLifecycleListener.destroyServerFailed",
+ serverName),e);
+ }
}
}
Modified: tomcat/trunk/java/org/apache/catalina/mbeans/LocalStrings.properties
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/LocalStrings.properties?rev=700734&r1=700733&r2=700734&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/mbeans/LocalStrings.properties
(original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans/LocalStrings.properties Wed
Oct 1 03:47:41 2008
@@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-jmxRemoteLifecycleListener.createRegistryFailed=Unable to create the RMI
registry using port "{0}"
-jmxRemoteLifecycleListener.invalidURL=The JMX Service URL requested, "{0}",
was invalid
-jmxRemoteLifecycleListener.serverFailed=The JMX connector server could not be
created or failed to start
-jmxRemoteLifecycleListener.start=The JMX Remote Listener has configured the
registry on port {0} and the server on port {1}
\ No newline at end of file
+jmxRemoteLifecycleListener.createRegistryFailed=Unable to create the RMI
registry for the {0} server using port {1}
+jmxRemoteLifecycleListener.createServerFailed=The JMX connector server could
not be created or failed to start for the {0} server
+jmxRemoteLifecycleListener.destroyServerFailed=The JMX connector server could
not be stopped for the {0} server
+jmxRemoteLifecycleListener.invalidURL=The JMX Service URL requested for the
{0} server, "{1}", was invalid
+jmxRemoteLifecycleListener.start=The JMX Remote Listener has configured the
registry on port {0} and the server on port {1} for the {2} server
Modified: tomcat/trunk/webapps/docs/config/listeners.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/listeners.xml?rev=700734&r1=700733&r2=700734&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/config/listeners.xml (original)
+++ tomcat/trunk/webapps/docs/config/listeners.xml Wed Oct 1 03:47:41 2008
@@ -138,6 +138,10 @@
<h3>JMX Remote Lifecycle Listener
(org.apache.catalina.mbeans.JmxRemoteLifecycleListener)</h3>
+ <p>This listener requires <code>catalina-jmx-remote.jar</code> to be placed
+ in <code>$CATALINA_HOME/lib</code>. This jar may be found in the extras
+ directory of the binary download area.</p>
+
<p>The <strong>JMX Remote Lifecycle Listener</strong> fixes the port used
by
the JMX/RMI Server making things much simpler if you need to connect
jconsole or a similar tool to a remote Tomcat instance that is running
@@ -151,7 +155,8 @@
<p>If this listener was configured in server.xml as:
<source>
<Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener"
- rmiRegistryPort="10001" rmiServerPort="10002" />
+ rmiRegistryPortPlatform="10001" rmiServerPortPlatform="10002"
+ rmiRegistryPortCatalina="10003" rmiServerPortCatalina="10004" />
</source>
with the following system properties set (eg in setenv.sh):
<source>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]