Example usage for org.springframework.beans BeansException getMessage

List of usage examples for org.springframework.beans BeansException getMessage

Introduction

In this page you can find the example usage for org.springframework.beans BeansException getMessage.

Prototype

@Override
@Nullable
public String getMessage() 

Source Link

Document

Return the detail message, including the message from the nested exception if there is one.

Usage

From source file:org.dcache.xdr.SpringRunner.java

public static void main(String[] args) throws IOException {
    if (args.length != 1) {
        System.err.println("Usage: SpringRunner <config>");
        System.exit(1);//  ww w .  j a  v a  2  s.c o m
    }

    try {
        ApplicationContext context = new FileSystemXmlApplicationContext(args[0]);
        OncRpcSvc service = (OncRpcSvc) context.getBean("oncrpcsvc");
        service.start();

        System.in.read();
    } catch (BeansException e) {
        System.err.println("Spring: " + e.getMessage());
        System.exit(1);
    }
}

From source file:nl.tranquilizedquality.itest.AbstractDefaultNoDbDeploymentTest.java

/**
 * Starts up the container utility. This needs to be called in a static
 * method that is annotated with @BeforeClass so the container will be
 * started only once./*from  w ww  .j a va 2s . c  o  m*/
 */
public static void startupContainer() {

    // The application server need to be locally started only if the
    // host is localhost
    if (isRunningOnLocalHost()) {

        if (LOGGER.isInfoEnabled()) {
            LOGGER.info("Starting up the container utility...");
        }

        try {
            CONTEXT = new AnnotationConfigApplicationContext(CONFIGURATION_CLASSES);

            CONTAINER_UTIL = (ContainerUtil) CONTEXT.getBean("containerUtil");
            CONTAINER_UTIL.start();
        } catch (final BeansException e) {

            final String msg = "Failed to start up the container utility! - " + e.getMessage();
            if (LOGGER.isErrorEnabled()) {
                LOGGER.error(msg, e);
            }
            fail(msg);
        }
    }
}

From source file:com.cisco.dvbu.ps.deploytool.DeployManagerUtil.java

private static void initSpring() {
    try {// ww  w  .j av a  2s  .c  om
        String configDirRoot = System.getProperty(configRootProperty);
        if (configDirRoot != null && configDirRoot.length() > 0) {
            File dir = new File(configDirRoot);

            // Set the file system separator type
            @SuppressWarnings("static-access")
            String sep = dir.separator;
            System.setProperty("FILE_SYSTEM_SEPARATOR", sep);

            if (dir.exists() && dir.isDirectory()) {
                File file = new File(dir, springConfigFile);

                if (logger.isDebugEnabled()) {
                    logger.debug("Config root " + dir.getPath());
                    logger.debug("Loading Spring Config File " + file.getPath());
                }
                String[] contextFiles = { "file:" + file.getPath() };
                context = new FileSystemXmlApplicationContext(contextFiles);
            }
        }
    } catch (BeansException e) {
        logger.warn("spring initialization failed due to " + e.getMessage());
    }
}

From source file:org.zilverline.web.TestZilverController.java

public void testFlushCacheHandler() {
    try {//from w  w w . j ava2s .  c  o m
        ZilverController zilverC = (ZilverController) applicationContext.getBean("zilverController");
        assertNotNull(zilverC);
        CollectionManager colMan = (CollectionManager) applicationContext.getBean("collectionMan");
        // get testdate collection
        DocumentCollection testdata = colMan.getCollectionByName("testdata");
        assertNotNull(testdata);
        MockHttpServletRequest request = new MockHttpServletRequest();
        request.addParameter("collection", "testdata");
        HttpServletResponse response = new MockHttpServletResponse();
        ModelAndView mv = zilverC.flushCacheHandler(request, response);
        assertNotNull(mv);
    } catch (BeansException e) {
        fail(e.getMessage());
    } catch (ServletException e) {
        fail(e.getMessage());
    }
}

From source file:org.zilverline.web.TestZilverController.java

public void testFailFlushCacheHandler() {
    try {/*from www.j  a va2s  .c o m*/
        ZilverController zilverC = (ZilverController) applicationContext.getBean("zilverController");
        assertNotNull(zilverC);
        CollectionManager colMan = (CollectionManager) applicationContext.getBean("collectionMan");
        // get testdate collection
        DocumentCollection testdata = colMan.getCollectionByName("testdata3");
        assertNull(testdata);
        MockHttpServletRequest request = new MockHttpServletRequest();
        request.addParameter("collection", "testdata3");
        HttpServletResponse response = new MockHttpServletResponse();
        ModelAndView mv = zilverC.flushCacheHandler(request, response);
        assertNotNull(mv);
        fail("Should throw ServletException");
    } catch (BeansException e) {
        fail(e.getMessage());
    } catch (ServletException e) {
        assertNotNull(e.getMessage());
    }
}

From source file:org.zilverline.web.TestCustomCollectionEditor.java

public void testCustomCollectionEditorWithString() {
    CollectionManager colMan = (CollectionManager) applicationContext.getBean("collectionMan");
    assertNotNull(colMan);//w w w  .j  a  va2s  .  c om
    assertTrue("collections must exist", colMan.getCollections().size() > 0);

    SearchForm sf = new SearchForm();
    BeanWrapper bw = new BeanWrapperImpl(sf);
    bw.registerCustomEditor(CollectionTriple[].class, "collections", new CustomCollectionEditor(colMan));
    try {
        bw.setPropertyValue("collections", "problems");
    } catch (BeansException ex) {
        fail("Should not throw BeansException: " + ex.getMessage());
    }
    CollectionTriple[] col3s = (CollectionTriple[]) bw.getPropertyValue("collections");
    assertEquals(colMan.getCollections().size(), col3s.length);
    assertEquals("testdata", col3s[0].getName());
}

From source file:org.zilverline.web.TestCustomCollectionEditor.java

public void testCustomCollectionEditorWithStringArrayOfOne() {
    CollectionManager colMan = (CollectionManager) applicationContext.getBean("collectionMan");
    assertNotNull(colMan);/*from   w  w  w.  j  a v  a2s  . com*/
    assertTrue("collections must exist", colMan.getCollections().size() > 0);

    SearchForm sf = new SearchForm();
    BeanWrapper bw = new BeanWrapperImpl(sf);
    bw.registerCustomEditor(CollectionTriple[].class, "collections", new CustomCollectionEditor(colMan));
    try {
        bw.setPropertyValue("collections", new String[] { "problems" });
    } catch (BeansException ex) {
        fail("Should not throw BeansException: " + ex.getMessage());
    }
    CollectionTriple[] col3s = (CollectionTriple[]) bw.getPropertyValue("collections");
    assertEquals(colMan.getCollections().size(), col3s.length);
    assertEquals("testdata", col3s[0].getName());
}

From source file:org.zilverline.web.TestCustomCollectionEditor.java

public void testCustomCollectionEditorWithStringArrayOfTwo() {
    CollectionManager colMan = (CollectionManager) applicationContext.getBean("collectionMan");
    assertNotNull(colMan);/* w ww . j  av  a2 s.co m*/
    assertTrue("collections must exist", colMan.getCollections().size() > 0);

    SearchForm sf = new SearchForm();
    BeanWrapper bw = new BeanWrapperImpl(sf);
    bw.registerCustomEditor(CollectionTriple[].class, "collections", new CustomCollectionEditor(colMan));
    try {
        bw.setPropertyValue("collections", new String[] { "problems", "testdata" });
    } catch (BeansException ex) {
        fail("Should not throw BeansException: " + ex.getMessage());
    }
    CollectionTriple[] col3s = (CollectionTriple[]) bw.getPropertyValue("collections");
    assertEquals(colMan.getCollections().size(), col3s.length);
    assertEquals("testdata", col3s[0].getName());
}

From source file:org.zilverline.web.TestCustomCollectionEditor.java

public void testCustomCollectionEditorWithStrings() {
    CollectionManager colMan = (CollectionManager) applicationContext.getBean("collectionMan");
    assertNotNull(colMan);/*from w  w w  .j av  a  2 s.  com*/
    assertTrue("collections must exist", colMan.getCollections().size() > 0);
    log.debug("test");

    SearchForm sf = new SearchForm();
    BeanWrapper bw = new BeanWrapperImpl(sf);
    bw.registerCustomEditor(CollectionTriple[].class, "collections", new CustomCollectionEditor(colMan));
    try {
        bw.setPropertyValue("collections", "problems, testdata");
    } catch (BeansException ex) {
        fail("Should not throw BeansException: " + ex.getMessage());
    }
    CollectionTriple[] col3s = (CollectionTriple[]) bw.getPropertyValue("collections");
    log.debug(col3s);
    assertEquals(colMan.getCollections().size(), col3s.length);
    for (int i = 0; i < colMan.getCollections().size(); i++) {
        assertTrue(col3s[0].isSelected());
    }
}

From source file:nz.co.senanque.workflowui.conf.BundleListenerImpl.java

public void add(BundleVersion bv) {
    super.add(bv);
    // Find the queues defined in this workflow bundle and add them to our global list.
    // This allows us to present all the queues to the user.
    try {//from  w w  w  .j  av a 2  s. c o  m
        WorkflowManager workflowManager = bv.getRoot().getApplicationContext().getBean("workflowManager",
                WorkflowManager.class);
        //           m_queueProcessManager.extractQueues(workflowManager.getQueues(),bundleName);           
        //           m_queueProcessManager.extractProcesses(workflowManager.getMainProcesses(),bundleName);
        m_queueProcessManager.extract(bv.getName(), workflowManager.getQueues(),
                workflowManager.getMainProcesses());
    } catch (BeansException e) {
        // ignore bundles with missing bean, assume they do something else.
        m_logger.debug(e.getMessage());
    }
}