Search in sources :

Example 41 with ConnectorRuntimeException

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

the class ConnectorService method switchOnMatching.

/**
 * Matching will be switched off in the pool, by default. This will be
 * switched on if the connections with different resource principals reach the pool.
 *
 * @param poolInfo Name of the pool to switchOn matching.
 * @param rarName  Name of the resource adater.
 */
public void switchOnMatching(String rarName, PoolInfo poolInfo) {
    // Later other resource adapters also become applicable.
    if (rarName.equals(ConnectorConstants.JDBCDATASOURCE_RA_NAME) || rarName.equals(ConnectorConstants.JDBCCONNECTIONPOOLDATASOURCE_RA_NAME) || rarName.equals(ConnectorConstants.JDBCXA_RA_NAME)) {
        PoolManager poolMgr = _runtime.getPoolManager();
        boolean result = poolMgr.switchOnMatching(poolInfo);
        if (!result) {
            try {
                _runtime.switchOnMatchingInJndi(poolInfo);
            } catch (ConnectorRuntimeException cre) {
            // This will never happen.
            }
        }
    }
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) PoolManager(com.sun.enterprise.resource.pool.PoolManager)

Example 42 with ConnectorRuntimeException

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

the class ConnectorService method checkAndLoadPool.

public boolean checkAndLoadPool(PoolInfo poolInfo) {
    boolean status = false;
    try {
        ResourcePool pool = _runtime.getConnectionPoolConfig(poolInfo);
        // DeferredResourceConfig defResConfig = resutil.getDeferredPoolConfig(poolName);
        DeferredResourceConfig defResConfig = getResourcesUtil().getDeferredResourceConfig(null, pool, null, null);
        status = loadResourcesAndItsRar(defResConfig);
    } catch (ConnectorRuntimeException cre) {
        Object[] params = new Object[] { poolInfo, cre };
        _logger.log(Level.WARNING, "unable.to.load.connection.pool", params);
    }
    return status;
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) DeferredResourceConfig(com.sun.enterprise.connectors.DeferredResourceConfig) ResourcePool(com.sun.enterprise.config.serverbeans.ResourcePool)

Example 43 with ConnectorRuntimeException

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

the class ConnectorService method loadDeferredResourceAdapter.

public void loadDeferredResourceAdapter(String rarModuleName) throws ConnectorRuntimeException {
    // load the RA if its not already loaded
    if (_registry.getActiveResourceAdapter(rarModuleName) == null) {
        try {
            // Do this only for System RA
            if (ConnectorsUtil.belongsToSystemRA(rarModuleName)) {
                String systemModuleLocation = ConnectorsUtil.getSystemModuleLocation(rarModuleName);
                if (_runtime.isServer()) {
                    _runtime.getMonitoringBootstrap().registerProbes(rarModuleName, new File(systemModuleLocation), _runtime.getSystemRARClassLoader(rarModuleName));
                }
                _runtime.createActiveResourceAdapter(systemModuleLocation, rarModuleName, null);
            }
        /* not needed as long as standalone + embedded rars are loaded before recovery
                else if (rarModuleName.indexOf(ConnectorConstants.EMBEDDEDRAR_NAME_DELIMITER) != -1) {
                    createActiveResourceAdapterForEmbeddedRar(rarModuleName);
                } else{
                    _runtime.createActiveResourceAdapter(ConnectorsUtil.getLocation(rarModuleName), rarModuleName, null);
                }*/
        } catch (Exception e) {
            ConnectorRuntimeException ce = new ConnectorRuntimeException(e.getMessage());
            ce.initCause(e);
            throw ce;
        }
    }
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) File(java.io.File) URISyntaxException(java.net.URISyntaxException) ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)

Example 44 with ConnectorRuntimeException

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

the class RarHandler method getClassLoader.

/**
 * {@inheritDoc}
 */
public ClassLoader getClassLoader(ClassLoader parent, DeploymentContext context) {
    try {
        String moduleDir = context.getSource().getURI().getPath();
        String moduleName = context.getSource().getName();
        List<URI> appLibs = null;
        try {
            appLibs = context.getAppLibs();
            if (_logger.isLoggable(Level.FINEST)) {
                _logger.log(Level.FINEST, "installed libraries (--applibs and EXTENSTION_LIST) for rar " + "[ " + moduleName + " ] :  " + appLibs);
            }
        } catch (URISyntaxException e) {
            throw new RuntimeException(e);
        }
        ClassLoader carCL;
        if (isEmbedded(context)) {
            String applicationName = ConnectorsUtil.getApplicationName(context);
            String embeddedRarName = ConnectorsUtil.getEmbeddedRarModuleName(applicationName, moduleName);
            // ear's classloader hierarchy is : module-CL -> ear-CL (contains all ejb module classpath)
            // -> embedded-RAR-CL -> ear-lib-CL.
            // parent provided here is ear-CL, we need to use
            // ear-lib-CL as parent for embedded-RAR module-CL
            carCL = loader.createRARClassLoader(moduleDir, parent.getParent().getParent(), embeddedRarName, appLibs);
        } else {
            carCL = loader.createRARClassLoader(moduleDir, null, moduleName, appLibs);
        }
        try {
            doPrivileged(new SetPermissionsAction(CommponentType.rar, context, carCL));
        } catch (PrivilegedActionException e) {
            throw new SecurityException(e.getException());
        }
        return carCL;
    } catch (ConnectorRuntimeException e) {
        throw new RuntimeException(e);
    }
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) PrivilegedActionException(java.security.PrivilegedActionException) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI) SetPermissionsAction(com.sun.enterprise.security.permissionsxml.SetPermissionsAction)

Example 45 with ConnectorRuntimeException

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

the class ActiveOutboundResourceAdapter method loadRAConfiguration.

/**
 * Loads RA javabean. This method is protected, so that any system
 * resource adapter can have specific configuration done during the
 * loading.
 *
 * @throws ConnectorRuntimeException if there is a failure.
 */
protected void loadRAConfiguration() throws ConnectorRuntimeException {
    try {
        Set mergedProps;
        ConnectorRegistry registry = ConnectorRegistry.getInstance();
        ResourceAdapterConfig raConfig = registry.getResourceAdapterConfig(moduleName_);
        List<Property> raConfigProps = new ArrayList<Property>();
        mergedProps = mergeRAConfiguration(raConfig, raConfigProps);
        logMergedProperties(mergedProps);
        SetMethodAction setMethodAction = new SetMethodAction(this.resourceadapter_, mergedProps);
        setMethodAction.run();
    } catch (Exception e) {
        String i18nMsg = localStrings.getString("ccp_adm.wrong_params_for_create", e.getMessage());
        ConnectorRuntimeException cre = new ConnectorRuntimeException(i18nMsg);
        cre.initCause(e);
        throw cre;
    }
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) ResourceAdapterConfig(org.glassfish.connectors.config.ResourceAdapterConfig) ConnectorConfigProperty(com.sun.enterprise.deployment.ConnectorConfigProperty) Property(org.jvnet.hk2.config.types.Property) ResourceException(javax.resource.ResourceException) NamingException(javax.naming.NamingException) ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) SetMethodAction(com.sun.enterprise.connectors.util.SetMethodAction)

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