https://issues.apache.org/jira/browse/AMQ-3747 - Syntax errors are not showing up in the log when the broker is started in the background. fix by logging a fatalbeanexception on context creation before rethrow

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1295138 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2012-02-29 14:45:32 +00:00
parent 0d8ce9f87c
commit 503e1dc15e
1 changed files with 12 additions and 6 deletions

View File

@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory;
import org.apache.xbean.spring.context.ResourceXmlApplicationContext;
import org.apache.xbean.spring.context.impl.URIEditor;
import org.springframework.beans.BeansException;
import org.springframework.beans.FatalBeanException;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
@ -103,11 +104,16 @@ public class XBeanBrokerFactory implements BrokerFactoryHandler {
protected ApplicationContext createApplicationContext(String uri) throws MalformedURLException {
Resource resource = Utils.resourceFromString(uri);
LOG.debug("Using " + resource + " from " + uri);
return new ResourceXmlApplicationContext(resource) {
@Override
protected void initBeanDefinitionReader(XmlBeanDefinitionReader reader) {
reader.setValidating(isValidate());
}
};
try {
return new ResourceXmlApplicationContext(resource) {
@Override
protected void initBeanDefinitionReader(XmlBeanDefinitionReader reader) {
reader.setValidating(isValidate());
}
};
} catch (FatalBeanException errorToLog) {
LOG.error("Failed to load: " + resource + ", reason: " + errorToLog.getLocalizedMessage(), errorToLog);
throw errorToLog;
}
}
}