import java.util.Stack;
import java.util.TreeMap;
+import javax.management.AttributeNotFoundException;
import javax.management.ListenerNotFoundException;
import javax.management.MBeanNotificationInfo;
import javax.management.MBeanRegistrationException;
}
// 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())
// 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();
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;