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();
}
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));
}
}
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);
}
}
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);
}
}
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();
}
Aggregations