Author: markt
Date: Sun Dec 14 17:04:50 2014
New Revision: 1645469
URL: http://svn.apache.org/r1645469
Log:
Consistently handle missing StoreConfig MBean for Server and Context case.
Modified:
tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties
tomcat/trunk/java/org/apache/catalina/core/StandardServer.java
Modified: tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties?rev=1645469&r1=1645468&r2=1645469&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties
(original)
+++ tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties Sun Dec
14 17:04:50 2014
@@ -166,8 +166,9 @@ standardHost.invalidErrorReportValveClas
standardHost.noContext=No Context configured to process this request
standardHost.notContext=Child of a Host must be a Context
standardHost.nullName=Host name is required
-standardServer.shutdownViaPort=A valid shutdown command was received via the
shutdown port. Stopping the Server instance.
standardServer.accept.timeout=The socket listening for the shutdown command
experienced an unexpected timeout [{0}] milliseconds after the call to
accept(). Is this an instance of bug 56684?
+standardServer.shutdownViaPort=A valid shutdown command was received via the
shutdown port. Stopping the Server instance.
+standardServer.storeConfig.notAvailable=No StoreConfig implementation was
registered as an MBean named [{0}] so no configuration could be saved. A
suitable MBean is normally registered via the StoreConfigLifecyleListener.
standardService.connector.initFailed=Failed to initialize connector [{0}]
standardService.connector.pauseFailed=Failed to pause connector [{0}]
standardService.connector.startFailed=Failed to start connector [{0}]
Modified: tomcat/trunk/java/org/apache/catalina/core/StandardServer.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardServer.java?rev=1645469&r1=1645468&r2=1645469&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardServer.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardServer.java Sun Dec 14
17:04:50 2014
@@ -689,8 +689,17 @@ public final class StandardServer extend
* if an exception is reported by the persistence mechanism
*/
public synchronized void storeConfig() throws Exception {
- ObjectName sname = new ObjectName(getDomain() + ":type=StoreConfig");
- mserver.invoke(sname, "storeConfig", null, null);
+ try {
+ ObjectName sname = new ObjectName(getDomain() +
":type=StoreConfig");
+ if (mserver.isRegistered(sname)) {
+ mserver.invoke(sname, "storeConfig", null, null);
+ } else {
+
log.error(sm.getString("standardServer.storeConfig.notAvailable", sname));
+ }
+ } catch (Throwable t) {
+ ExceptionUtils.handleThrowable(t);
+ log.error(t);
+ }
}
@@ -706,21 +715,19 @@ public final class StandardServer extend
* by the persistence mechanism
*/
public synchronized void storeContext(Context context) throws Exception {
-
- ObjectName sname = null;
try {
- sname = new ObjectName(getDomain() + ":type=StoreConfig");
- if(mserver.isRegistered(sname)) {
- mserver.invoke(sname, "store",
- new Object[] {context},
- new String [] { "java.lang.String"});
- } else
- log.error("StoreConfig mbean not registered" + sname);
+ ObjectName sname = new ObjectName(getDomain() +
":type=StoreConfig");
+ if (mserver.isRegistered(sname)) {
+ mserver.invoke(sname, "store",
+ new Object[] {context},
+ new String [] { "java.lang.String"});
+ } else {
+
log.error(sm.getString("standardServer.storeConfig.notAvailable", sname));
+ }
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
log.error(t);
}
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]