List of usage examples for org.springframework.beans BeansException getLocalizedMessage
public String getLocalizedMessage()
From source file:org.metis.cassandra.SimpleContextTest.java
@BeforeClass public static void initialize() throws Exception { try {/* w w w . java2 s . co m*/ cc = CqlComponent.cqlComponent("cassandra.xml"); } catch (BeansException be) { System.out.println( "ERROR: unable to load spring context, got " + "this exception: \n" + be.getLocalizedMessage()); be.printStackTrace(); } }
From source file:org.metis.cassandra.CqlStmntTest.java
/** * To run these tests, Cassandra needs to be running and the videodb * keyspace must be installed. See ${project-home}/src/main/cql for videodb * CQL scripts//from w w w . j av a2 s . c om * * @throws Exception */ @BeforeClass public static void initialize() throws Exception { // Grab the cluster bean defined in the test cassandra.xml file. try { context = new ClassPathXmlApplicationContext("cassandra.xml"); } catch (BeansException be) { System.out.println( "ERROR: unable to load spring context, got this exception: \n" + be.getLocalizedMessage()); be.printStackTrace(); } clusterBean = context.getBean(ClusterBean.class); }
From source file:cross.ObjectFactory.java
@Override public <T> T instantiate(final Class<T> c) { if (context != null) { try {/* w w w.ja v a 2s. c om*/ T t = context.getBean(c); log.info("Retrieved bean {} from context!", t.getClass().getName()); return t; } catch (NoSuchBeanDefinitionException nsbde) { log.debug("Could not create bean {} from context! Reason:\n {}", c.getName(), nsbde.getLocalizedMessage()); } catch (BeansException be) { log.debug("Could not create bean {} from context! Reason:\n {}", c.getName(), be.getLocalizedMessage()); } } log.info("Using regular configuration mechanism on instance of type " + c.getName()); return configureType(instantiateType(c), this.cfg); }
From source file:com.qut.middleware.esoe.authn.servlet.AuthnServlet.java
@Override public void init() throws ServletException { FileInputStream configFile;//from w w w.j ava2s. c o m Properties props; WebApplicationContext webAppContext; try { configFile = new FileInputStream(System.getProperty("esoe.data") + ConfigurationConstants.ESOE_CONFIG); props = new java.util.Properties(); props.load(configFile); /* Spring integration to make our servlet aware of IoC */ webAppContext = WebApplicationContextUtils.getRequiredWebApplicationContext(this.getServletContext()); this.authnProcessor = (AuthnProcessor) webAppContext.getBean(ConfigurationConstants.AUTHN_PROCESSOR, com.qut.middleware.esoe.authn.AuthnProcessor.class); if (this.authnProcessor == null) { this.logger.error(MessageFormat.format(Messages.getString("AuthnServlet.1"), //$NON-NLS-1$ ConfigurationConstants.AUTHN_PROCESSOR)); throw new IllegalArgumentException( Messages.getString("AuthnServlet.1") + ConfigurationConstants.AUTHN_PROCESSOR); //$NON-NLS-1$ } this.authnDynamicURLParam = props.getProperty(ConfigurationConstants.AUTHN_DYNAMIC_URL_PARAM); this.sessionTokenName = props.getProperty(ConfigurationConstants.ESOE_SESSION_TOKEN_NAME); this.sessionDomain = props.getProperty(ConfigurationConstants.ESOE_SESSION_DOMAIN); this.disableSSOTokenName = props.getProperty(ConfigurationConstants.DISABLE_SSO_TOKEN_NAME); if (this.authnDynamicURLParam == null) { this.logger.error(Messages.getString("AuthnServlet.10") //$NON-NLS-1$ + ConfigurationConstants.AUTHN_DYNAMIC_URL_PARAM + Messages.getString("AuthnServlet.11")); //$NON-NLS-1$ throw new IllegalArgumentException(Messages.getString("AuthnServlet.10") //$NON-NLS-1$ + ConfigurationConstants.AUTHN_DYNAMIC_URL_PARAM + Messages.getString("AuthnServlet.11")); //$NON-NLS-1$ } if (this.sessionTokenName == null) { this.logger.error(Messages.getString("AuthnServlet.10") //$NON-NLS-1$ + ConfigurationConstants.ESOE_SESSION_TOKEN_NAME + Messages.getString("AuthnServlet.11")); //$NON-NLS-1$ throw new IllegalArgumentException(Messages.getString("AuthnServlet.10") //$NON-NLS-1$ + ConfigurationConstants.ESOE_SESSION_TOKEN_NAME + Messages.getString("AuthnServlet.11")); //$NON-NLS-1$ } if (this.sessionDomain == null) { this.logger.error(Messages.getString("AuthnServlet.10") //$NON-NLS-1$ + ConfigurationConstants.ESOE_SESSION_DOMAIN + Messages.getString("AuthnServlet.11")); //$NON-NLS-1$ throw new IllegalArgumentException(Messages.getString("AuthnServlet.10") //$NON-NLS-1$ + ConfigurationConstants.ESOE_SESSION_DOMAIN + Messages.getString("AuthnServlet.11")); //$NON-NLS-1$ } if (this.disableSSOTokenName == null) { this.logger.error(Messages.getString("AuthnServlet.10") //$NON-NLS-1$ + ConfigurationConstants.DISABLE_SSO_TOKEN_NAME + Messages.getString("AuthnServlet.11")); //$NON-NLS-1$ throw new IllegalArgumentException(Messages.getString("AuthnServlet.10") //$NON-NLS-1$ + ConfigurationConstants.DISABLE_SSO_TOKEN_NAME + Messages.getString("AuthnServlet.11")); //$NON-NLS-1$ } this.logger.info(Messages.getString("AuthnServlet.33")); //$NON-NLS-1$ } catch (BeansException e) { this.logger.error(MessageFormat.format(Messages.getString("AuthnServlet.12"), //$NON-NLS-1$ ConfigurationConstants.AUTHN_PROCESSOR, e.getLocalizedMessage())); throw new ServletException(MessageFormat.format(Messages.getString("AuthnServlet.12"), //$NON-NLS-1$ ConfigurationConstants.AUTHN_PROCESSOR, e.getLocalizedMessage())); } catch (MalformedURLException e) { this.logger.error(Messages.getString("AuthnServlet.14") //$NON-NLS-1$ + ConfigurationConstants.ESOE_CONFIG + Messages.getString("AuthnServlet.15") //$NON-NLS-1$ + e.getLocalizedMessage()); throw new ServletException(Messages.getString("AuthnServlet.14") //$NON-NLS-1$ + ConfigurationConstants.ESOE_CONFIG + Messages.getString("AuthnServlet.15")); //$NON-NLS-1$ } catch (IllegalStateException e) { this.logger.error(Messages.getString("AuthnServlet.16") + e.getLocalizedMessage()); //$NON-NLS-1$ throw new ServletException(Messages.getString("AuthnServlet.16")); //$NON-NLS-1$ } catch (IOException e) { this.logger.error(Messages.getString("AuthnServlet.17") //$NON-NLS-1$ + ConfigurationConstants.ESOE_CONFIG + Messages.getString("AuthnServlet.18") //$NON-NLS-1$ + e.getLocalizedMessage()); throw new ServletException(Messages.getString("AuthnServlet.17") //$NON-NLS-1$ + ConfigurationConstants.ESOE_CONFIG + Messages.getString("AuthnServlet.18")); //$NON-NLS-1$ } }
From source file:com.qut.middleware.esoe.sso.servlet.SSOServlet.java
@Override public void init() throws ServletException { try {//from ww w .j a v a 2s. c o m /* Spring integration to make our servlet aware of IoC */ WebApplicationContext webAppContext = WebApplicationContextUtils .getRequiredWebApplicationContext(this.getServletContext()); this.ssoProcessor = (SSOProcessor) webAppContext.getBean(ConfigurationConstants.SSO_PROCESSOR, com.qut.middleware.esoe.sso.SSOProcessor.class); if (this.ssoProcessor == null) throw new IllegalArgumentException( "Unable to acquire SSO Processor bean from web application context. Missing bean for name: " + ConfigurationConstants.SSO_PROCESSOR); } catch (BeansException e) { this.logger.error( "Unable to acquire SSO Processor bean from web application context. Error retrieving bean for name: " + e.getLocalizedMessage()); throw new ServletException( "Unable to acquire SSO Processor bean from web application context. Error retrieving bean for name: " + ConfigurationConstants.SSO_PROCESSOR, e); } catch (IllegalStateException e) { this.logger.error( "Unable to acquire SSO Processor bean from web application context. Currently in an illegal state for retrieving beans.", e); throw new ServletException( "Unable to acquire SSO Processor bean from web application context. Currently in an illegal state for retrieving beans.", e); } }