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:org.minig.identity.ldap.IdentitySourceFactory.java

@Override
public IIdentitySource getIdentitySource(String userEmail) {
    try {/*from w  w w.  j av a  2s. c om*/
        return new IdentitySource(configuration.getConnection(), configuration.getBaseDn(),
                configuration.getFilter().replace("%u", userEmail));
    } catch (NamingException e) {
        logger.error(e.getMessage(), e);
        return null;
    }
}

From source file:org.nuxeo.ecm.core.storage.sql.NuxeoEhcacheTransactionManagerLookup.java

@Override
public TransactionManager getTransactionManager() {
    try {/*from  w  w  w .  ja v  a 2s .com*/
        return TransactionHelper.lookupTransactionManager();
    } catch (NamingException e) {
        log.error(e.getMessage(), e);
        return null;
    }
}

From source file:org.eclipse.ecr.runtime.transaction.TransactionHelper.java

/**
 * Commits or rolls back the User Transaction depending on the transaction
 * status.//  w w  w  .j  a  va 2  s  . c  o m
 *
 * @throws SystemException
 * @throws HeuristicRollbackException
 * @throws HeuristicMixedException
 * @throws RollbackException
 * @throws IllegalStateException
 * @throws SecurityException
 */
public static void commitOrRollbackTransaction() {
    UserTransaction ut;
    try {
        ut = lookupUserTransaction();
    } catch (NamingException e) {
        log.warn("No user transaction", e);
        return;
    }
    try {
        int status = ut.getStatus();
        if (status == Status.STATUS_ACTIVE) {
            if (log.isDebugEnabled()) {
                log.debug("Commiting transaction");
            }
            ut.commit();
        } else if (status == Status.STATUS_MARKED_ROLLBACK) {
            if (log.isDebugEnabled()) {
                log.debug("Cannot commit transaction because it is marked rollback only");
            }
            ut.rollback();
        }
    } catch (Exception e) {
        String msg = "Unable to commit/rollback  " + ut;
        if (e instanceof RollbackException
                && "Unable to commit: transaction marked for rollback".equals(e.getMessage())) {
            // don't log as error, this happens if there's a
            // ConcurrentModificationException at transaction end inside VCS
            log.debug(msg, e);
        } else {
            log.error(msg, e);
        }
        throw new TransactionRuntimeException(msg, e);
    }
}

From source file:de.highbyte_le.weberknecht.conf.ContextConfig.java

public String getValue(String key, String defaultValue) {
    try {/*w w  w  .  j  a va  2s. c o m*/
        return getValue(key);
    } catch (NamingException e) {
        logger.error("getValue() - NamingException: " + e.getMessage(), e); //$NON-NLS-1$
    }
    return defaultValue;
}

From source file:fr.aliasource.webmail.ldap.Configuration.java

DirContext getConnection() throws NamingException {
    try {//from   w  w  w  .  j  a  v  a2 s  .c om
        return new InitialDirContext(env);
    } catch (NamingException e) {
        logger.error(e.getMessage(), e);
        throw e;
    }
}

From source file:com.appeligo.config.EnvironmentLookup.java

/**
 * //from w  ww .j  av  a2  s  .  c o m
 * @return
 */
public String getEnvironmentName() {
    String envName = null;
    try {
        envName = (String) new InitialContext().lookup("java:comp/env/deploymentEnvironment");
    } catch (NamingException e) {
        log.warn("deploymentEnvironment JNDI lookup failed: " + e.getMessage(), e);
    }
    return envName;
}

From source file:de.highbyte_le.weberknecht.db.DefaultWebDbConnectionProvider.java

public Connection getConnection() throws DBConnectionException {
    try {/*from   w  ww.j a  v a 2 s .c om*/

        //JNDI-Context
        Context ctx = new InitialContext();
        Context envCtx = (Context) ctx.lookup("java:comp/env");

        //JNDI-Lookup for jdbc connection
        DataSource ds = (DataSource) envCtx.lookup("jdbc/mydb");
        Connection con = ds.getConnection();

        return con;

    } catch (NamingException e) {
        logger.error("NamingException: " + e.getMessage(), e);
        throw new DBConnectionException("database connection is not yet configured (naming exception)", e);
    } catch (SQLException e) {
        logger.error("SQLException: " + e.getMessage(), e);
        throw new DBConnectionException("cannot connect to database (sql exception)", e);
    }

}

From source file:org.teiid.rhq.admin.DQPManagementView.java

public static String getVDBStatus(ProfileServiceConnection connection, String vdbName) {

    ManagedComponent mcVdb = null;//w  w w  . j  av  a 2  s .  c o  m
    try {
        mcVdb = ProfileServiceUtil.getManagedComponent(connection, new org.jboss.managed.api.ComponentType(
                PluginConstants.ComponentType.VDB.TYPE, PluginConstants.ComponentType.VDB.SUBTYPE), vdbName);
    } catch (NamingException e) {
        final String msg = "NamingException in getVDBStatus(): " + e.getExplanation(); //$NON-NLS-1$
        LOG.error(msg, e);
    } catch (Exception e) {
        final String msg = "Exception in getVDBStatus(): " + e.getMessage(); //$NON-NLS-1$
        LOG.error(msg, e);
    }

    if (mcVdb == null) {
        return Status.INACTIVE.toString();
    }

    return ProfileServiceUtil.getSimpleValue(mcVdb, "status", String.class); //$NON-NLS-1$
}

From source file:org.minig.identity.ldap.IdentitySource.java

@Override
public List<Identity> getIdentities() {
    LinkedList<Identity> ret = new LinkedList<Identity>();
    LdapUtils u = new LdapUtils(ctx, baseDn);
    try {//  ww w  . jav  a 2  s  .c  om
        List<Map<String, List<String>>> attrs = u.getAttributes(filter, "",
                new String[] { "sn", "givenName", "mail" });
        for (Map<String, List<String>> m : attrs) {
            String sn = m.get("sn").get(0);
            String givenName = "";
            if (m.get("givenName") != null) {
                givenName = m.get("givenName").get(0);
            }

            StringBuilder sb = new StringBuilder();
            if (sn != null) {
                sb.append(sn);
                if (givenName != null) {
                    sb.append(' ');
                    sb.append(givenName);
                }
            } else if (givenName != null) {
                sb.append(givenName);
            }
            String display = sb.toString();
            List<String> mails = m.get("mail");
            for (String mail : mails) {
                ret.add(new Identity(display, mail));
            }
        }
    } catch (NamingException e) {
        logger.error(e.getMessage(), e);
    }
    return ret;
}

From source file:org.mule.ibeans.internal.JndiRegistry.java

protected void doDispose() {
    try {//www .  ja v  a 2 s .  c  o  m
        context.close();
    } catch (NamingException e) {
        logger.error(e.getMessage());
    }
}