Search in sources :

Example 11 with ConnectorRuntimeException

use of com.sun.appserv.connectors.internal.api.ConnectorRuntimeException in project Payara by payara.

the class MQAddressList method setup.

/**
 * Sets up the addresslist.
 */
public void setup(boolean isClustered) throws Exception {
    try {
        if (isClustered) {
            // setup for LOCAL/EMBEDDED clusters.
            if (logger.isLoggable(Level.FINE))
                logFine("setting up for cluster " + this.targetName);
            setupClusterViewFromRepository();
            setupForCluster();
        } else {
            if (logger.isLoggable(Level.FINE))
                logFine("setting up for SI/DAS " + this.targetName);
            if (isAConfig(targetName) || isDAS(targetName)) {
                if (logger.isLoggable(Level.FINE))
                    logFine("performing default setup for DAS/remote clusters/PE instance " + targetName);
                defaultSetup();
            } else {
                logFine("configuring for Standalone EE server instance");
                // resolve and add.
                setupClusterViewFromRepository();
                setupForStandaloneServerInstance();
            }
        }
    } catch (ConnectorRuntimeException ce) {
        throw new Exception(ce);
    }
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) IOException(java.io.IOException) PropertyVetoException(java.beans.PropertyVetoException) ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)

Example 12 with ConnectorRuntimeException

use of com.sun.appserv.connectors.internal.api.ConnectorRuntimeException in project Payara by payara.

the class JmsRaUtil method handleException.

private static ConnectorRuntimeException handleException(Exception e) {
    ConnectorRuntimeException cre = new ConnectorRuntimeException(e.getMessage());
    cre.initCause(e);
    return cre;
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)

Example 13 with ConnectorRuntimeException

use of com.sun.appserv.connectors.internal.api.ConnectorRuntimeException in project Payara by payara.

the class ConnectorResourceAdminServiceImpl method createConnectorResource.

/**
 * Creates the connector resource on a given connection pool
 *
 * @param resourceInfo     JNDI name of the resource to be created
 * @param poolInfo     PoolName to which the connector resource belongs.
 * @param resourceType Resource type Unused.
 * @throws ConnectorRuntimeException If the resouce creation fails.
 */
public void createConnectorResource(ResourceInfo resourceInfo, PoolInfo poolInfo, String resourceType) throws ConnectorRuntimeException {
    try {
        ConnectorConnectionPool ccp = null;
        String jndiNameForPool = ConnectorAdminServiceUtils.getReservePrefixedJNDINameForPool(poolInfo);
        try {
            ccp = (ConnectorConnectionPool) namingService.lookup(poolInfo, jndiNameForPool);
        } catch (NamingException ne) {
            // Probably the pool is not yet initialized (lazy-loading), try doing a lookup
            try {
                checkAndLoadPool(poolInfo);
                ccp = (ConnectorConnectionPool) namingService.lookup(poolInfo, jndiNameForPool);
            } catch (NamingException e) {
                Object[] params = new Object[] { poolInfo, e };
                _logger.log(Level.SEVERE, "unable.to.lookup.pool", params);
            }
        }
        if (ccp == null) {
            ccp = (ConnectorConnectionPool) namingService.lookup(poolInfo, jndiNameForPool);
        }
        ConnectorDescriptorInfo cdi = ccp.getConnectorDescriptorInfo();
        javax.naming.Reference ref = new javax.naming.Reference(cdi.getConnectionFactoryClass(), "com.sun.enterprise.resource.naming.ConnectorObjectFactory", null);
        RefAddr addr = new SerializableObjectRefAddr(PoolInfo.class.getName(), poolInfo);
        ref.add(addr);
        addr = new StringRefAddr("rarName", cdi.getRarName());
        ref.add(addr);
        RefAddr resAddr = new SerializableObjectRefAddr(ResourceInfo.class.getName(), resourceInfo);
        ref.add(resAddr);
        try {
            namingService.publishObject(resourceInfo, ref, true);
            _registry.addResourceInfo(resourceInfo);
        } catch (NamingException ne) {
            ConnectorRuntimeException cre = new ConnectorRuntimeException(ne.getMessage());
            cre.initCause(ne);
            Object[] params = new Object[] { resourceInfo, cre };
            _logger.log(Level.SEVERE, "rardeployment.resource_jndi_bind_failure", params);
            throw cre;
        }
        /*

            ConnectorObjectFactory cof = new ConnectorObjectFactory(jndiName, ccp.getConnectorDescriptorInfo().
                    getConnectionFactoryClass(), cdi.getRarName(), poolName);

            _runtime.getNamingManager().publishObject(jndiName, cof, true);
*/
        // To notify that a connector resource rebind has happened.
        ConnectorResourceNamingEventNotifier.getInstance().notifyListeners(new ConnectorNamingEvent(resourceInfo.toString(), ConnectorNamingEvent.EVENT_OBJECT_REBIND));
    } catch (NamingException ne) {
        ConnectorRuntimeException cre = new ConnectorRuntimeException(ne.getMessage());
        cre.initCause(ne);
        Object[] params = new Object[] { resourceInfo, cre };
        _logger.log(Level.SEVERE, "rardeployment.jndi_lookup_failed", params);
        throw cre;
    }
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) ResourceInfo(org.glassfish.resourcebase.resources.api.ResourceInfo) ConnectorConnectionPool(com.sun.enterprise.connectors.ConnectorConnectionPool) SerializableObjectRefAddr(org.glassfish.resources.naming.SerializableObjectRefAddr) ConnectorNamingEvent(com.sun.appserv.connectors.internal.spi.ConnectorNamingEvent) RefAddr(javax.naming.RefAddr) SerializableObjectRefAddr(org.glassfish.resources.naming.SerializableObjectRefAddr) StringRefAddr(javax.naming.StringRefAddr) StringRefAddr(javax.naming.StringRefAddr) ConnectorDescriptorInfo(com.sun.enterprise.connectors.ConnectorDescriptorInfo) NamingException(javax.naming.NamingException) PoolInfo(org.glassfish.resourcebase.resources.api.PoolInfo)

Example 14 with ConnectorRuntimeException

use of com.sun.appserv.connectors.internal.api.ConnectorRuntimeException in project Payara by payara.

the class ConnectorService method loadDeferredResources.

public void loadDeferredResources(Resource[] resourcesToLoad) throws Exception {
    if (resourcesToLoad == null || resourcesToLoad.length == 0) {
        return;
    }
    for (Resource resource : resourcesToLoad) {
        if (resource == null) {
            continue;
        } else if (getResourcesUtil().isEnabled(resource)) {
            try {
                _runtime.getResourceDeployer(resource).deployResource(resource);
            } catch (Exception e) {
                ConnectorRuntimeException cre = new ConnectorRuntimeException(e.getMessage());
                cre.initCause(e);
                throw cre;
            }
        }
    }
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) Resource(com.sun.enterprise.config.serverbeans.Resource) URISyntaxException(java.net.URISyntaxException) ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)

Example 15 with ConnectorRuntimeException

use of com.sun.appserv.connectors.internal.api.ConnectorRuntimeException in project Payara by payara.

the class ConnectorService method createActiveResourceAdapterForEmbeddedRar.

public void createActiveResourceAdapterForEmbeddedRar(String rarModuleName) throws ConnectorRuntimeException {
    ConnectorDescriptor cdesc = loadConnectorDescriptorForEmbeddedRAR(rarModuleName);
    String appName = ConnectorAdminServiceUtils.getApplicationName(rarModuleName);
    String rarFileName = ConnectorAdminServiceUtils.getConnectorModuleName(rarModuleName) + ".rar";
    String loc = getResourcesUtil().getApplicationDeployLocation(appName);
    loc = loc + File.separator + FileUtils.makeFriendlyFilename(rarFileName);
    String path = null;
    try {
        URI uri = new URI(loc);
        path = uri.getPath();
    } catch (URISyntaxException use) {
        ConnectorRuntimeException cre = new ConnectorRuntimeException("Invalid path [ " + use.getMessage() + " ]");
        cre.setStackTrace(use.getStackTrace());
        _logger.log(Level.WARNING, cre.getMessage(), cre);
        throw cre;
    }
    // start RA
    _runtime.createActiveResourceAdapter(cdesc, rarModuleName, path);
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) ConnectorDescriptor(com.sun.enterprise.deployment.ConnectorDescriptor) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI)

Aggregations

ConnectorRuntimeException (com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)71 NamingException (javax.naming.NamingException)16 URISyntaxException (java.net.URISyntaxException)13 PoolInfo (org.glassfish.resourcebase.resources.api.PoolInfo)13 ConnectorDescriptor (com.sun.enterprise.deployment.ConnectorDescriptor)10 PrivilegedActionException (java.security.PrivilegedActionException)9 ExecutionException (java.util.concurrent.ExecutionException)8 ResourceAdapterInternalException (javax.resource.spi.ResourceAdapterInternalException)8 MultiException (org.glassfish.hk2.api.MultiException)8 JmsService (com.sun.enterprise.connectors.jms.config.JmsService)7 ConnectorConfigProperty (com.sun.enterprise.deployment.ConnectorConfigProperty)7 ManagedConnectionFactory (javax.resource.spi.ManagedConnectionFactory)7 ActiveResourceAdapter (com.sun.enterprise.connectors.ActiveResourceAdapter)5 ConnectorRuntime (com.sun.enterprise.connectors.ConnectorRuntime)5 IOException (java.io.IOException)5 ConnectorConnectionPool (com.sun.enterprise.connectors.ConnectorConnectionPool)4 JdbcConnectionPool (org.glassfish.jdbc.config.JdbcConnectionPool)4 ResourceInfo (org.glassfish.resourcebase.resources.api.ResourceInfo)4 Resource (com.sun.enterprise.config.serverbeans.Resource)3 ResourcePool (com.sun.enterprise.config.serverbeans.ResourcePool)3