Example usage for javax.naming NamingException getMessage

List of usage examples for javax.naming NamingException getMessage

Introduction

In this page you can find the example usage for javax.naming NamingException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:com.espertech.esperio.db.core.ExecutorServices.java

public ExecutorServices(EPServiceProviderSPI spi, Map<String, Executor> workQueue) {
    this.services = new HashMap<String, ExecutorService>();

    for (Map.Entry<String, Executor> entry : workQueue.entrySet()) {
        Executor queue = entry.getValue();

        if (queue.getNumThreads() <= 0) {
            continue;
        }/*  w w w  .j  a  va2  s . co m*/

        LinkedBlockingQueue<Runnable> runnableQueue = new LinkedBlockingQueue<Runnable>();
        ExecutorService service = new ThreadPoolExecutor(queue.getNumThreads(), queue.getNumThreads(), 1000,
                TimeUnit.SECONDS, runnableQueue);
        services.put(entry.getKey(), service);
    }

    try {
        spi.getContext().bind("EsperIODBAdapter/ExecutorServices", this);
    } catch (NamingException e) {
        log.error("Error binding executor service: " + e.getMessage(), e);
    }
}

From source file:org.pepstock.jem.jbpm.tasks.workitems.MapManager.java

/**
 * Loads a map into another map, putting the instance of data description and data sources
 * @param parameters map of parameters prepared by JBPM
 * @return copy of the map but with the instances of data description and data sources
 *///from w  w w. j  a  v a2 s  .  com
final Map<String, Object> loadParameters(Map<String, Object> parameters) {
    // gets JNDI context
    InitialContext ic = null;
    try {
        ic = ContextUtils.getContext();
    } catch (NamingException e) {
        LogAppl.getInstance().ignore(e.getMessage(), e);
    }

    // creates new map
    Map<String, Object> result = new HashMap<String, Object>();
    // scans all parameters
    for (Entry<String, Object> entry : parameters.entrySet()) {
        try {
            // gets key
            String name = entry.getKey();
            // is DD?
            if (name.startsWith(JBpmKeys.JBPM_DATA_DESCRIPTION_PREFIX)) {
                // gets data description name
                String ddn = StringUtils.substringAfter(name, JBpmKeys.JBPM_DATA_DESCRIPTION_PREFIX);
                // if context is not null, lookup and stores on the map
                if (ic != null) {
                    result.put(name, ic.lookup(ddn));
                }
            } else if (name.startsWith(JBpmKeys.JBPM_DATA_SOURCE_PREFIX)) {
                // is Data source?
                // gets datasource name
                String dds = StringUtils.substringAfter(name, JBpmKeys.JBPM_DATA_SOURCE_PREFIX);
                // if context is not null, lookup and stores on the map
                if (ic != null) {
                    result.put(name, ic.lookup(dds));
                }
            } else if (!name.equalsIgnoreCase(JBpmKeys.JBPM_LOCK_KEY)) {
                // is Lock? IGNORE
                result.put(name, entry.getValue());
            }
        } catch (NamingException e) {
            // ignore every naming exception
            LogAppl.getInstance().ignore(e.getMessage(), e);
        }
    }
    return result;
}

From source file:eu.agilejava.spring4.config.ApplicationConfig.java

/**
 * Get the CDI Manager from initial context.
 * @return the cdi manager/*w w  w . j  a  v  a 2 s .  c  o m*/
 */
private BeanManager getCDIBeanManager() {
    try {
        InitialContext initialContext = new InitialContext();
        return (BeanManager) initialContext.lookup("java:comp/BeanManager");
    } catch (NamingException e) {
        LOGGER.severe(() -> "Could not look up initialcontext: " + e.getMessage());
        return null;
    }
}

From source file:com.dattack.naming.StandaloneJndiTest.java

@Test
public void testCreateContext() {
    try {/*from   w w w . java 2  s .  co  m*/
        final InitialContext context = new InitialContext();
        final String name = "testCreateContext";
        final Context subcontext = context.createSubcontext(name);
        assertNotNull(subcontext);
    } catch (final NamingException e) {
        fail(e.getMessage());
    }
}

From source file:com.dattack.naming.StandaloneJndiTest.java

@Test
public void testCreateMultiContext() {
    try {/*from  w w w .jav a  2  s  .co  m*/
        final InitialContext context = new InitialContext();
        final String name = getCompositeName(VALID_CONTEXT, "testCreateMultiContext");
        final Context subcontext = context.createSubcontext(name);
        assertNotNull(subcontext);
    } catch (final NamingException e) {
        fail(e.getMessage());
    }
}

From source file:com.dattack.naming.StandaloneJndiTest.java

@Test
public void testBind() {
    try {// ww w  .ja v a 2  s .co m
        final InitialContext context = new InitialContext();
        final String name = getCompositeName("jdbc", "testBind");
        final Object obj = new Integer(10);
        context.bind(name, obj);
        assertEquals(obj, context.lookup(name));
    } catch (final NamingException e) {
        fail(e.getMessage());
    }
}

From source file:com.dattack.naming.StandaloneJndiTest.java

@Test
public void testLookupValidDataSource() {

    try {/*from w  w  w .  j  a  v a 2  s  . c  om*/
        final InitialContext context = new InitialContext();
        final String name = getCompositeName(VALID_CONTEXT, VALID_OBJECT_NAME);
        final DataSource dataSource = (DataSource) context.lookup(name);
        assertNotNull(dataSource);
    } catch (final NamingException e) {
        fail(e.getMessage());
    }
}

From source file:com.constellio.model.services.users.sync.FastBindConnectionControl.java

public void close() {
    try {/* ww  w . ja  va2s. c  om*/
        ctx.close();
    } catch (NamingException e) {
        throw new RuntimeNamingException(e.getMessage());
    }
}

From source file:org.wso2.carbon.identity.application.common.persistence.JDBCPersistenceManager.java

private void initDataSource() throws IdentityApplicationManagementException {

    try {//w  w w .  j av a  2 s  .com
        String dataSourceName = IdentityApplicationConfig.getInstance()
                .getConfigElement("JDBCPersistenceManager")
                .getFirstChildWithName(
                        new QName(IdentityApplicationConstants.APPLICATION_AUTHENTICATION_DEFAULT_NAMESPACE,
                                "DataSource"))
                .getFirstChildWithName(new QName(
                        IdentityApplicationConstants.APPLICATION_AUTHENTICATION_DEFAULT_NAMESPACE, "Name"))
                .getText();
        Context ctx = new InitialContext();
        dataSource = (DataSource) ctx.lookup(dataSourceName);
    } catch (NamingException e) {
        log.error(e.getMessage(), e);
        String errorMsg = "Error occurred while looking up the Identity Application Management data source";
        throw new IdentityApplicationManagementException(errorMsg);
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        String errorMsg = "Error occurred while reading "
                + IdentityApplicationConstants.APPLICATION_AUTHENTICATION_CONGIG;
        throw new IdentityApplicationManagementException(errorMsg);
    }
}

From source file:org.openiam.idm.srvc.synch.service.generic.LdapAdapterForGenericObject.java

private void closeConnection() {
    try {//  w  w w .ja v a  2 s  .c  o  m
        if (ctx != null) {
            ctx.close();
        }

    } catch (NamingException ne) {
        log.error(ne.getMessage(), ne);
        ne.printStackTrace();
    }

}