From 458f402cf04e09ae322c62fae1bf7f9799b7cc00 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Tue, 16 Oct 2018 12:07:46 +1100 Subject: [PATCH] Issue #2983 JmxConfiguration JPMS ready Signed-off-by: Greg Wilkins --- .../org.eclipse.jetty.webapp.Configuration | 2 -- .../eclipse/jetty/webapp/Configurations.java | 17 ++++++++++++++--- .../eclipse/jetty/webapp/JmxConfiguration.java | 4 +++- .../org.eclipse.jetty.webapp.Configuration | 1 + 4 files changed, 18 insertions(+), 6 deletions(-) delete mode 100644 jetty-jmx/src/main/resources/META-INF/services/org.eclipse.jetty.webapp.Configuration diff --git a/jetty-jmx/src/main/resources/META-INF/services/org.eclipse.jetty.webapp.Configuration b/jetty-jmx/src/main/resources/META-INF/services/org.eclipse.jetty.webapp.Configuration deleted file mode 100644 index abb3a01c8ca..00000000000 --- a/jetty-jmx/src/main/resources/META-INF/services/org.eclipse.jetty.webapp.Configuration +++ /dev/null @@ -1,2 +0,0 @@ -# Declared in the jmx package, but defined in the webapp package (as it depends on the Configuration interface) -org.eclipse.jetty.webapp.JmxConfiguration diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/Configurations.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/Configurations.java index 7eb9b54b291..1c318961a56 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/Configurations.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/Configurations.java @@ -73,11 +73,22 @@ public class Configurations extends AbstractList if (__known.isEmpty()) { ServiceLoader configs = ServiceLoader.load(Configuration.class); - for (Configuration configuration : configs) + for (Iterator i = configs.iterator(); i.hasNext(); ) { - __known.add(configuration); - __knownByClassName.add(configuration.getClass().getName()); + try + { + Configuration configuration = i.next(); + __known.add(configuration); + __knownByClassName.add(configuration.getClass().getName()); + } + catch (Throwable e) + { + LOG.info("Configuration unavailable: "+e.getMessage()); + if (LOG.isDebugEnabled()) + LOG.debug(e); + } } + sort(__known); if (LOG.isDebugEnabled()) { diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/JmxConfiguration.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/JmxConfiguration.java index 760c59d0043..5f32a9b9244 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/JmxConfiguration.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/JmxConfiguration.java @@ -18,6 +18,8 @@ package org.eclipse.jetty.webapp; +import org.eclipse.jetty.jmx.ObjectMBean; + import java.util.ServiceLoader; /** @@ -36,6 +38,6 @@ public class JmxConfiguration extends AbstractConfiguration public JmxConfiguration() { addDependents(WebXmlConfiguration.class, MetaInfConfiguration.class, WebInfConfiguration.class); - protectAndExpose("org.eclipse.jetty.jmx."); + protectAndExpose(ObjectMBean.class.getPackage().getName()+"."); } } diff --git a/jetty-webapp/src/main/resources/META-INF/services/org.eclipse.jetty.webapp.Configuration b/jetty-webapp/src/main/resources/META-INF/services/org.eclipse.jetty.webapp.Configuration index 56de8c4ba24..377ae88c198 100644 --- a/jetty-webapp/src/main/resources/META-INF/services/org.eclipse.jetty.webapp.Configuration +++ b/jetty-webapp/src/main/resources/META-INF/services/org.eclipse.jetty.webapp.Configuration @@ -4,3 +4,4 @@ org.eclipse.jetty.webapp.MetaInfConfiguration org.eclipse.jetty.webapp.WebInfConfiguration org.eclipse.jetty.webapp.WebXmlConfiguration org.eclipse.jetty.webapp.WebAppConfiguration +org.eclipse.jetty.webapp.JmxConfiguration