Search in sources :

Example 61 with ConnectorRuntimeException

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

the class JmsProviderLifecycle method postConstruct.

public void postConstruct() {
    final JmsService jmsService = config.getExtensionByType(JmsService.class);
    brokerType = BROKER_TYPE.valueOf(jmsService.getType());
    configureConfigListener();
    if (brokerType == BROKER_TYPE.DISABLED) {
        return;
    }
    if (eagerStartupRequired()) {
        try {
            initializeBroker();
        } catch (ConnectorRuntimeException e) {
            e.printStackTrace();
            // _logger.log(Level.WARNING, "Failed to start JMS RA");
            e.printStackTrace();
        }
    }
    try {
        activeJmsResourceAdapter.initializeLazyListener(jmsService);
    } catch (JmsInitialisationException ex) {
        Logger.getLogger(JmsProviderLifecycle.class.getName()).log(Level.SEVERE, null, ex);
        throw new IllegalStateException(ex);
    }
// createMonitoringConfig();
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) JmsService(com.sun.enterprise.connectors.jms.config.JmsService)

Example 62 with ConnectorRuntimeException

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

the class ActiveJmsResourceAdapter method setValuesFromConfiguration.

private void setValuesFromConfiguration(String cfName, EjbMessageBeanDescriptor descriptor_) throws ConnectorRuntimeException {
    // todo: need to enable
    List<Property> ep = null;
    try {
        /*Resources rbeans = getAllResources();//ServerBeansFactory.getDomainBean(ctx).getResources();
            ConnectorResource res = (ConnectorResource)
                             rbeans.getResourceByName(ConnectorResource.class, cfName);*/
        String appName = descriptor_.getApplication().getAppName();
        String moduleName = ConnectorsUtil.getModuleName(descriptor_);
        ConnectorResource res = (ConnectorResource) ResourcesUtil.createInstance().getResource(cfName, appName, moduleName, ConnectorResource.class);
        if (res == null) {
            String msg = sm.getString("ajra.mdb_cf_not_created", cfName);
            throw new ConnectorRuntimeException(msg);
        }
        ConnectorConnectionPool ccp = (ConnectorConnectionPool) ResourcesUtil.createInstance().getResource(res.getPoolName(), appName, moduleName, ConnectorConnectionPool.class);
        // rbeans.getResourceByName(ConnectorConnectionPool.class, res.getPoolName());
        ep = ccp.getProperty();
    } catch (Exception ce) {
        String msg = sm.getString("ajra.mdb_cf_not_created", cfName);
        ConnectorRuntimeException cre = new ConnectorRuntimeException(msg);
        cre.initCause(ce);
        throw cre;
    }
    if (ep == null) {
        String msg = sm.getString("ajra.cannot_find_phy_dest");
        throw new ConnectorRuntimeException(msg);
    }
    for (int i = 0; i < ep.size(); i++) {
        Property prop = ep.get(i);
        String name = prop.getName();
        if (name.equals(MCFADDRESSLIST)) {
            name = ADDRESSLIST;
        }
        String val = prop.getValue();
        if (val == null || val.equals("")) {
            continue;
        }
        descriptor_.putRuntimeActivationConfigProperty(new EnvironmentProperty(name, val, null));
    }
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) ConnectorConnectionPool(org.glassfish.connectors.config.ConnectorConnectionPool) EnvironmentProperty(com.sun.enterprise.deployment.EnvironmentProperty) Property(org.jvnet.hk2.config.types.Property) EnvironmentProperty(com.sun.enterprise.deployment.EnvironmentProperty) ConnectorConfigProperty(com.sun.enterprise.deployment.ConnectorConfigProperty) ConnectorResource(org.glassfish.connectors.config.ConnectorResource) MultiException(org.glassfish.hk2.api.MultiException) PrivilegedActionException(java.security.PrivilegedActionException) ExecutionException(java.util.concurrent.ExecutionException) ResourceAdapterInternalException(javax.resource.spi.ResourceAdapterInternalException) URISyntaxException(java.net.URISyntaxException) ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)

Example 63 with ConnectorRuntimeException

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

the class ActiveJmsResourceAdapter method setClusterRABeanProperties.

// //@Siva: provide an API to read JMX information from RA and return it.
// private
/**
 * Sets the SE/EE specific MQ-RA bean properties
 * @throws ConnectorRuntimeException
 */
private void setClusterRABeanProperties() throws ConnectorRuntimeException {
    ConnectorDescriptor cd = super.getDescriptor();
    try {
        if (isClustered()) {
            JmsService jmsService = (JmsService) Globals.get(JmsService.class);
            /* ConfigContext ctx = ApplicationServer.getServerContext().
                    getConfigContext();
            JmsService jmsService = ServerBeansFactory.
                getConfigBean(ctx).getJmsService();    */
            String val = getGroupName();
            ConnectorConfigProperty envProp = new ConnectorConfigProperty(GROUPNAME, val, "Group Name", "java.lang.String");
            setProperty(cd, envProp);
            if (_logger.isLoggable(Level.FINE))
                logFine("CLUSTERED instance - setting groupname as" + val);
            boolean inClusteredContainer = false;
            if (jmsService.getType().equals(EMBEDDED) || jmsService.getType().equals(LOCAL))
                inClusteredContainer = true;
            ConnectorConfigProperty envProp1 = new ConnectorConfigProperty(CLUSTERCONTAINER, Boolean.toString(inClusteredContainer), "Cluster container flag", "java.lang.Boolean");
            setProperty(cd, envProp1);
            if (_logger.isLoggable(Level.FINE))
                logFine("CLUSTERED instance - setting inclusteredcontainer as" + inClusteredContainer);
            if (jmsService.getType().equals(REMOTE)) {
                /*
                * Do not set master broker for remote broker.
                * The RA might ignore it if we set, but we have to
                        * be certain from our end.
                */
                return;
            } else {
                if (!isDBEnabled()) {
                    String masterbrkr = getMasterBroker();
                    ConnectorConfigProperty envProp2 = new ConnectorConfigProperty(MASTERBROKER, masterbrkr, "Master  Broker", "java.lang.String");
                    setProperty(cd, envProp2);
                    if (_logger.isLoggable(Level.FINE))
                        logFine("MASTERBROKER - setting master broker val" + masterbrkr);
                }
            }
        } else {
            if (_logger.isLoggable(Level.FINE))
                logFine("Instance not Clustered and hence not setting " + "groupname");
        }
    } catch (Exception e) {
        ConnectorRuntimeException crex = new ConnectorRuntimeException(e.getMessage());
        throw (ConnectorRuntimeException) crex.initCause(e);
    }
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) ConnectorDescriptor(com.sun.enterprise.deployment.ConnectorDescriptor) JmsService(com.sun.enterprise.connectors.jms.config.JmsService) ConnectorConfigProperty(com.sun.enterprise.deployment.ConnectorConfigProperty) MultiException(org.glassfish.hk2.api.MultiException) PrivilegedActionException(java.security.PrivilegedActionException) ExecutionException(java.util.concurrent.ExecutionException) ResourceAdapterInternalException(javax.resource.spi.ResourceAdapterInternalException) URISyntaxException(java.net.URISyntaxException) ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)

Example 64 with ConnectorRuntimeException

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

the class ActiveJmsResourceAdapter method postRAConfiguration.

/*
     * Gets all the other [apart from serverlist] DataSource properties from
     * the HADB JDBC connection pool.
     *
    private Properties getDSPropertiesFromThePool(JdbcConnectionPool jdbcConPool) {
        Properties p = new Properties();
        List elemProp = jdbcConPool.getProperty();
        Set<String> excludeList = new HashSet<String>();
        excludeList.add(DUSERNAME);
        excludeList.add(DPASSWORD);
        excludeList.add(DSERVERLIST);

        for(Property e: elemProp) {
            String propName = e.getAttributeValue("name");
            if (!excludeList.contains(propName)) {
                p.setProperty(propName, e.getAttributeValue("value"));
            }
        }
        logFine("Additional DataSource properties from pool "
                        + jdbcConPool.getName() + " are " + p);
        return p;
    }*/
/**
 * Method to perform any post RA configuration action by derivative subclasses.
 * For example, this method is used by <code>ActiveJMSResourceAdapter</code>
 * to set unsupported javabean property types on its RA JavaBean runtime
 * instance.
 * @throws ConnectorRuntimeException
 */
protected void postRAConfiguration() throws ConnectorRuntimeException {
    // Set all non-supported javabean property types in the JavaBean
    try {
        if (dbProps == null)
            dbProps = new Properties();
        dbProps.setProperty("imq.cluster.dynamicChangeMasterBrokerEnabled", "true");
        Method mthds = this.resourceadapter_.getClass().getMethod("setBrokerProps", Properties.class);
        if (_logger.isLoggable(Level.FINE))
            logFine("Setting property:" + DB_HADB_PROPS + "=" + dbProps.toString());
        mthds.invoke(this.resourceadapter_, new Object[] { dbProps });
    } catch (Exception e) {
        ConnectorRuntimeException crex = new ConnectorRuntimeException(e.getMessage());
        throw (ConnectorRuntimeException) crex.initCause(e);
    }
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) Method(java.lang.reflect.Method) Properties(java.util.Properties) MultiException(org.glassfish.hk2.api.MultiException) PrivilegedActionException(java.security.PrivilegedActionException) ExecutionException(java.util.concurrent.ExecutionException) ResourceAdapterInternalException(javax.resource.spi.ResourceAdapterInternalException) URISyntaxException(java.net.URISyntaxException) ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)

Example 65 with ConnectorRuntimeException

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

the class ActiveJmsResourceAdapter method setAddressList.

private void setAddressList() throws ConnectorRuntimeException {
    // constructing addresslist]
    try {
        // ConfigContext ctx = ApplicationServer.getServerContext().getConfigContext();
        JmsService jmsService = (JmsService) Globals.get(JmsService.class);
        // ServerBeansFactory.getJmsServiceBean(ctx);
        setConnectionURL(jmsService, urlList);
    } catch (Exception e) {
        e.printStackTrace();
    }
    super.loadRAConfiguration();
}
Also used : JmsService(com.sun.enterprise.connectors.jms.config.JmsService) MultiException(org.glassfish.hk2.api.MultiException) PrivilegedActionException(java.security.PrivilegedActionException) ExecutionException(java.util.concurrent.ExecutionException) ResourceAdapterInternalException(javax.resource.spi.ResourceAdapterInternalException) URISyntaxException(java.net.URISyntaxException) ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)

Aggregations

ConnectorRuntimeException (com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)69 NamingException (javax.naming.NamingException)16 URISyntaxException (java.net.URISyntaxException)13 PoolInfo (org.glassfish.resourcebase.resources.api.PoolInfo)12 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 ConnectorConnectionPool (com.sun.enterprise.connectors.ConnectorConnectionPool)4 IOException (java.io.IOException)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 File (java.io.File)3