From: remm Date: Thu, 3 Aug 2006 08:34:21 +0000 (+0000) Subject: - Unfortunately, the JMX removal does not work (parent is null if used from JMX)... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=c72e532388160674e71de636b519ffe728847e3b;p=tomcat7.0 - Unfortunately, the JMX removal does not work (parent is null if used from JMX), so I'm reverting to using JMX for now. git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@428282 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/core/StandardContext.java b/java/org/apache/catalina/core/StandardContext.java index c93e0fdff..0fb2d4b3b 100644 --- a/java/org/apache/catalina/core/StandardContext.java +++ b/java/org/apache/catalina/core/StandardContext.java @@ -33,6 +33,7 @@ import java.util.Iterator; import java.util.Stack; import java.util.TreeMap; +import javax.management.AttributeNotFoundException; import javax.management.ListenerNotFoundException; import javax.management.MBeanNotificationInfo; import javax.management.MBeanRegistrationException; @@ -4168,16 +4169,18 @@ public class StandardContext } // Initialize annotation processor - if (ok && !getIgnoreAnnotations() && annotationProcessor == null) { - if (isUseNaming() && namingContextListener != null) { - annotationProcessor = - new DefaultAnnotationProcessor(namingContextListener.getEnvContext()); - } else { - annotationProcessor = new DefaultAnnotationProcessor(null); + if (ok && !getIgnoreAnnotations()) { + if (annotationProcessor == null) { + if (isUseNaming() && namingContextListener != null) { + annotationProcessor = + new DefaultAnnotationProcessor(namingContextListener.getEnvContext()); + } else { + annotationProcessor = new DefaultAnnotationProcessor(null); + } } + getServletContext().setAttribute + (Globals.ANNOTATION_PROCESSOR_ATTR, annotationProcessor); } - getServletContext().setAttribute - (Globals.ANNOTATION_PROCESSOR_ATTR, annotationProcessor); // Standard container startup if (log.isDebugEnabled()) @@ -5246,7 +5249,12 @@ public class StandardContext // Add the main configuration listener LifecycleListener config = null; try { - String configClassName = ((Host)getParent()).getConfigClass(); + String configClassName = null; + try { + configClassName = String.valueOf(mserver.getAttribute(parentName, "configClass")); + } catch (AttributeNotFoundException e) { + // Ignore, it's normal a host may not have this optional attribute + } if (configClassName != null) { Class clazz = Class.forName(configClassName); config = (LifecycleListener) clazz.newInstance(); @@ -5263,7 +5271,8 @@ public class StandardContext log.debug("AddChild " + parentName + " " + this); } try { - ((Host)getParent()).addChild(this); + mserver.invoke(parentName, "addChild", new Object[] { this }, + new String[] {"org.apache.catalina.Container"}); } catch (Exception e) { destroy(); throw e;