Author: remm
Date: Thu Aug  3 01:34:21 2006
New Revision: 428282

URL: http://svn.apache.org/viewvc?rev=428282&view=rev
Log:
- Unfortunately, the JMX removal does not work (parent is null if used from 
JMX), so I'm reverting to using JMX for now.

Modified:
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardContext.java

Modified: 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardContext.java?rev=428282&r1=428281&r2=428282&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardContext.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardContext.java Thu 
Aug  3 01:34:21 2006
@@ -33,6 +33,7 @@
 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 @@
         }
         
         // 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 @@
             // 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 @@
                 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;



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to