protected void startService() throws Exception
{
if (mcf != null)
throw new DeploymentException("Stop the RARDeployment before restarting it");
ConnectorMetaData cmd = null;
ConnectionDefinitionMetaData cdmd = null;
ResourceAdapter resourceAdapter = null;
if (oldRarDeployment != null)
{
try
{
resourceAdapter = (ResourceAdapter) getServer().getAttribute(oldRarDeployment, "ResourceAdapter");
cmd = (ConnectorMetaData) getServer().getAttribute(oldRarDeployment, "MetaData");
cdmd = cmd.getConnectionDefinition(connectionDefinition);
if (cdmd == null)
throw new DeploymentException("ConnectionDefinition '" + connectionDefinition + "' not found in rar '" + rarName + "'");
setManagedConnectionFactoryClass(cdmd.getManagedConnectionFactoryClass());
setReauthenticationSupport(cmd.getReauthenticationSupport());
}
catch (Exception e)
{
throw new DeploymentException("couldn't get oldRarDeployment! " + oldRarDeployment, e);
}
}
try
{
mcfClass = Thread.currentThread().getContextClassLoader().loadClass(managedConnectionFactoryClass);
}
catch (ClassNotFoundException cnfe)
{
log.error("Could not find ManagedConnectionFactory class: " + managedConnectionFactoryClass, cnfe);
throw new DeploymentException("Could not find ManagedConnectionFactory class: "
+ managedConnectionFactoryClass);
}
try
{
mcf = (ManagedConnectionFactory) mcfClass.newInstance();
}
catch (Exception e)
{
log.error("Could not instantiate ManagedConnectionFactory: " + managedConnectionFactoryClass, e);
throw new DeploymentException("Could not instantiate ManagedConnectionFactory: "
+ managedConnectionFactoryClass);
}
if (cmd != null)
{
// Set the resource adapter properties
setMcfProperties(cmd.getProperties(), false);
// Set the connection definition properties
setMcfProperties(cdmd.getProperties(), true);
}
//set overridden properties;
setMcfProperties(managedConnectionFactoryProperties);