Java Code Examples for org.springframework.beans.factory.BeanDefinitionStoreException#getCause()

The following examples show how to use org.springframework.beans.factory.BeanDefinitionStoreException#getCause() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpringServiceBuilderFactory.java    From cxf with Apache License 2.0 6 votes vote down vote up
/**
 * This is factored out to permit use in a unit test.
 *
 * @param additionalFilePathnames
 * @return
 */
public static ApplicationContext getApplicationContext(List<String> additionalFilePathnames) {
    BusApplicationContext busApplicationContext = BusFactory.getDefaultBus()
        .getExtension(BusApplicationContext.class);
    GenericApplicationContext appContext = new GenericApplicationContext(busApplicationContext);
    XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(appContext);
    List<URL> urls = ClassLoaderUtils.getResources("META-INF/cxf/java2wsbeans.xml",
                                                   SpringServiceBuilderFactory.class);
    for (URL url : urls) {
        reader.loadBeanDefinitions(new UrlResource(url));
    }

    for (String pathname : additionalFilePathnames) {
        try {
            reader.loadBeanDefinitions(new FileSystemResource(pathname));
        } catch (BeanDefinitionStoreException bdse) {
            throw new ToolException("Unable to open bean definition file " + pathname, bdse.getCause());
        }
    }
    appContext.refresh();
    return appContext;
}
 
Example 2
Source File: BeanDefinitionTest.java    From breeze with Apache License 2.0 6 votes vote down vote up
@Test
public void unknownExceptionClass() throws Exception {
	beansXml = "<breeze:topology id='t1'>" +
			"<breeze:spout id='s1' beanType='eu.icolumbo.breeze.TestBean' signature='ping()' outputFields='feed'>" +
			"  <breeze:exception type='com.example.DoesNotExist' delay='2000'/>" +
			"</breeze:spout>" +
			"</breeze:topology>";

	try {
		refresh();
		fail("no exception");
	} catch (BeanDefinitionStoreException e) {
		Throwable cause = e.getCause();
		assertNotNull("cause", cause);
		assertEquals("No such class: com.example.DoesNotExist", cause.getMessage());
	}
}