List of usage examples for org.springframework.beans.factory BeanDefinitionStoreException getMessage
@Override
@Nullable
public String getMessage()
From source file:com.pactera.edg.am.metamanager.extractor.util.AdapterContextLoader.java
/** * // w ww . ja va2 s . c o m * SpringClassPathXMLApplicationContext,????${var} * prop??? ??.properties??,??${var} * * @param configLocations * application context? * @param props * ??application context????key/value * @return ApplicationContext Application * Context,?,??,bean,null * @exception */ public static ApplicationContext createApplicationContext(String[] configLocations, Properties props) { // :spring?system properties??. Properties bakProps = null; String logMsg = null; try { if (props != null && props.size() > 0) { // system properties bakProps = System.getProperties(); for (Object key : props.keySet()) { System.setProperty((String) key, props.getProperty((String) key)); } if (log.isDebugEnabled()) { StringBuffer sb = new StringBuffer(); sb.append("??springxml?${var}prop:\n"); for (Object key : props.keySet()) { sb.append(key + "=" + System.getProperty((String) key)); sb.append("\n"); } log.debug(sb.toString()); } } return new ClassPathXmlApplicationContext(configLocations); } catch (BeanDefinitionStoreException bse) { // logMsg = new StringBuilder("?spring,?") .append(Arrays.toString(configLocations)).append(bse.getMessage()).toString(); log.error(logMsg, bse); AdapterExtractorContext.addExtractorLog(ExtractorLogLevel.ERROR, logMsg); throw bse; } catch (BeanCreationException ce) { // BEAN,?RMI?? logMsg = new StringBuilder("?spring,?BEAN,") .append(Arrays.toString(configLocations)).append(ce.getMessage()).toString(); log.error(logMsg, ce); if (logMsg.indexOf("ORA-01017") > -1 || logMsg.indexOf("Invalid password") > -1) { // ORACLE???? AdapterExtractorContext.addExtractorLog(ExtractorLogLevel.ERROR, "??/?,?,???????!"); } else { AdapterExtractorContext.addExtractorLog(ExtractorLogLevel.ERROR, logMsg); } throw ce; } finally { // system properties,???,?? if (bakProps != null) { System.setProperties(bakProps); } } }
From source file:com.pactera.edg.am.metamanager.extractor.util.ExtractorContextLoader.java
/** * ??SPRING,,???//from w w w .j av a 2 s . c o m * * @return * @throws SpringContextLoadException */ public static boolean initContext() throws SpringContextLoadException { try { if (aContext == null) { aContext = new ClassPathXmlApplicationContext( new String[] { Constants.EXTRACTOR_CONF_PATH, Constants.EXTRACTOR_RMI_CONF_PATH }); // JVM??,JVM,? aContext.registerShutdownHook(); // ? registerExtractorLogObservable(); } return true; } catch (BeanDefinitionStoreException bse) { // log.error(new StringBuilder("?spring,?") .append(Constants.EXTRACTOR_CONF_PATH).append(",").append(Constants.EXTRACTOR_RMI_CONF_PATH) .append(",").append(bse.getMessage()).toString()); if (log.isDebugEnabled()) { log.error(new StringBuilder("?spring,?") .append(Constants.EXTRACTOR_CONF_PATH).append(",").append(Constants.EXTRACTOR_RMI_CONF_PATH) .toString(), bse); } throw new SpringContextLoadException( new StringBuilder("?spring,?") .append(Constants.EXTRACTOR_CONF_PATH).append(",") .append(Constants.EXTRACTOR_RMI_CONF_PATH).toString(), bse); } catch (BeanCreationException ce) { // BEAN,?RMI?? log.error(new StringBuilder("?spring,?BEAN,") .append(Constants.EXTRACTOR_CONF_PATH).append(",").append(Constants.EXTRACTOR_RMI_CONF_PATH) .append(",").append(ce.getMessage()).toString()); if (log.isDebugEnabled()) { log.error(new StringBuilder("?spring,?BEAN") .append(Constants.EXTRACTOR_CONF_PATH).append(",").append(Constants.EXTRACTOR_RMI_CONF_PATH) .toString(), ce); } throw new SpringContextLoadException( new StringBuilder("?spring,?BEAN,") .append(Constants.EXTRACTOR_CONF_PATH).append(",") .append(Constants.EXTRACTOR_RMI_CONF_PATH).toString(), ce); } }
From source file:net.phoenix.thrift.xml.ArgBeanDefinitionParser.java
/** * register to the bean factory;/*from ww w . ja v a 2 s. c om*/ * * @param element * @param parserContext * @param current */ private void registerBeanDefinition(Element element, ParserContext parserContext, AbstractBeanDefinition current) { try { Element parent = (Element) element.getParentNode(); String argsBeanDefinitionName = parent.getAttribute("id"); String name = argsBeanDefinitionName + "-" + element.getAttribute("name"); String[] alias = null; if (StringUtils.hasLength(name)) { alias = StringUtils.trimArrayElements(StringUtils.commaDelimitedListToStringArray(name)); } BeanDefinitionHolder holder = new BeanDefinitionHolder(current, name, alias); registerBeanDefinition(holder, parserContext.getRegistry()); } catch (BeanDefinitionStoreException ex) { parserContext.getReaderContext().error(ex.getMessage(), element); } }
From source file:org.opencredo.cloud.storage.si.adapter.config.OutboundChannelAdapterParserTest.java
@Test(expected = BeanDefinitionStoreException.class) public void testOutboundAdapterLoadNoTemplate() { try {//from w w w . jav a 2 s . c o m new ClassPathXmlApplicationContext("OutboundChannelAdapterParserTest-noTemplate-context.xml", this.getClass()); fail("Context load should fail"); } catch (BeanDefinitionStoreException e) { System.err.println(e.getMessage()); throw e; } }
From source file:org.opencredo.cloud.storage.si.adapter.config.OutboundChannelAdapterParserTest.java
@Test(expected = BeanDefinitionStoreException.class) public void testOutboundAdapterLoadNoContainer() { try {// w w w . j a v a2s . c o m new ClassPathXmlApplicationContext("OutboundChannelAdapterParserTest-noContainer-context.xml", this.getClass()); fail("Context load should fail"); } catch (BeanDefinitionStoreException e) { System.err.println(e.getMessage()); throw e; } }
From source file:fr.paris.lutece.plugins.workflow.modules.createpdf.utils.DoDownloadPDF.java
/** * Do download pdf to Front User//from ww w . jav a 2 s . c om * @param request request * @param response response */ public void doDownloadFile(HttpServletRequest request, HttpServletResponse response) { ITaskConfigService taskCreatePDFConfigService = SpringContextService .getBean(CreatePDFConstants.BEAN_CREATE_PDF_CONFIG_SERVICE); TaskCreatePDFConfig taskCreatePDFConfig = taskCreatePDFConfigService.findByPrimaryKey( DirectoryUtils.convertStringToInt(request.getParameter(CreatePDFConstants.PARAMETER_ID_TASK))); String strIdConfig = Integer.toString(taskCreatePDFConfig.getIdConfig()); int nIdRecord = DirectoryUtils .convertStringToInt(request.getParameter(CreatePDFConstants.PARAMETER_ID_DIRECTORY_RECORD)); if (RequestAuthenticatorService.getRequestAuthenticatorForUrl().isRequestAuthenticated(request) && StringUtils.isNotBlank(strIdConfig)) { ConfigProducerService manageConfigProducerService = null; try { manageConfigProducerService = SpringContextService .getBean("directory-pdfproducer.manageConfigProducer"); } catch (BeanDefinitionStoreException e) { AppLogService.error(e.getMessage(), e); } catch (NoSuchBeanDefinitionException e) { AppLogService.error(e.getMessage(), e); } catch (CannotLoadBeanClassException e) { AppLogService.error(e.getMessage(), e); } if (manageConfigProducerService != null) { Plugin plugin = PluginService.getPlugin(DirectoryPDFProducerPlugin.PLUGIN_NAME); int nIdConfig = DirectoryUtils.convertStringToInt(strIdConfig); IConfigProducer config; if ((nIdConfig == -1) || (nIdConfig == 0)) { config = new DefaultConfigProducer(); } else { config = manageConfigProducerService.loadConfig(plugin, nIdConfig); } if (config == null) { config = new DefaultConfigProducer(); } PDFUtils.doDownloadPDF(request, response, plugin, config, manageConfigProducerService .loadListConfigEntry(plugin, DirectoryUtils.convertStringToInt(strIdConfig)), request.getLocale(), nIdRecord); } } }
From source file:org.opencredo.cloud.storage.si.adapter.config.InboundChannelAdapterParserTest.java
@Test(expected = BeanDefinitionStoreException.class) public void testInboundAdapterLoadWithoutContainer() { try {// w w w. j ava2 s . co m new ClassPathXmlApplicationContext("InboundChannelAdapterParserTest-noContainer-context.xml", this.getClass()); fail("Context load should fail"); } catch (BeanDefinitionStoreException e) { System.err.println(e.getMessage()); throw e; } }
From source file:org.opencredo.cloud.storage.si.adapter.config.InboundChannelAdapterParserTest.java
@Test(expected = BeanDefinitionStoreException.class) public void testInboundAdapterLoadWithoutTemplate() { try {/* w ww . ja va2 s .com*/ new ClassPathXmlApplicationContext("InboundChannelAdapterParserTest-noTemplate-context.xml", this.getClass()); fail("Context load should fail"); } catch (BeanDefinitionStoreException e) { System.err.println(e.getMessage()); throw e; } }
From source file:fr.paris.lutece.plugins.crmclient.business.CRMItemFactory.java
/** * {@inheritDoc}//w w w .ja va2 s . c o m */ @Override public ICRMItem newCRMItem(String strBeanName) { if (StringUtils.isBlank(strBeanName)) { AppLogService.error("CRMItemFactory ERROR : The bean name is empty."); return null; } try { ICRMItem crmItem = SpringContextService.getBean(strBeanName); return crmItem; } catch (BeanDefinitionStoreException e) { AppLogService.error("CRMItemFactory ERROR : could not load bean '" + e.getBeanName() + "' - CAUSE : " + e.getMessage(), e); } catch (NoSuchBeanDefinitionException e) { AppLogService.error("CRMItemFactory ERROR : could not load bean '" + e.getBeanName() + "' - CAUSE : " + e.getMessage(), e); } catch (CannotLoadBeanClassException e) { AppLogService.error("CRMItemFactory ERROR : could not load bean '" + e.getBeanName() + "' - CAUSE : " + e.getMessage(), e); } return null; }
From source file:org.apache.servicemix.document.factory.DocumentFactory.java
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactoryToProcess) throws BeansException { BeanDefinitionVisitor visitor = new BundleExtUrlBeanDefinitionVisitor(); String[] beanNames = beanFactoryToProcess.getBeanDefinitionNames(); for (int i = 0; i < beanNames.length; i++) { // Check that we're not parsing our own bean definition, // to avoid failing on unresolvable placeholders in properties file locations. if (!(beanNames[i].equals(this.beanName) && beanFactoryToProcess.equals(this.beanFactory))) { BeanDefinition bd = beanFactoryToProcess.getBeanDefinition(beanNames[i]); try { visitor.visitBeanDefinition(bd); } catch (BeanDefinitionStoreException ex) { throw new BeanDefinitionStoreException(bd.getResourceDescription(), beanNames[i], ex.getMessage()); }// ww w .ja v a 2 s . c o m } } }