use of com.ibm.jbatch.container.exception.BatchContainerServiceException in project Payara by payara.
the class PostgresPersistenceManager method init.
@Override
public void init(IBatchConfig batchConfig) throws BatchContainerServiceException {
logger.config("Entering CLASSNAME.init(), batchConfig =" + batchConfig);
this.batchConfig = batchConfig;
schema = batchConfig.getDatabaseConfigurationBean().getSchema();
jndiName = batchConfig.getDatabaseConfigurationBean().getJndiName();
try {
Context ctx = new InitialContext();
dataSource = (DataSource) ctx.lookup(jndiName);
} catch (NamingException e) {
logger.severe("Lookup failed for JNDI name: " + jndiName + ". One cause of this could be that the batch runtime is incorrectly configured to EE mode when it should be in SE mode.");
throw new BatchContainerServiceException(e);
}
// Load the table names and queries shared between different database
// types
tableNames = getSharedTableMap(batchConfig);
try {
queryStrings = getSharedQueryMap(batchConfig);
} catch (SQLException e1) {
// TODO Auto-generated catch block
throw new BatchContainerServiceException(e1);
}
// put the create table strings into a hashmap
// createTableStrings = setCreateTableMap(batchConfig);
createPostgresStrings = setCreatePostgresStringsMap(batchConfig);
logger.config("JNDI name = " + jndiName);
if (jndiName == null || jndiName.equals("")) {
throw new BatchContainerServiceException("JNDI name is not defined.");
}
try {
if (!isPostgresSchemaValid()) {
setDefaultSchema();
}
checkPostgresTables();
} catch (SQLException e) {
logger.severe(e.getLocalizedMessage());
throw new BatchContainerServiceException(e);
}
logger.config("Exiting CLASSNAME.init()");
}
use of com.ibm.jbatch.container.exception.BatchContainerServiceException in project Payara by payara.
the class SQLServerPersistenceManager method init.
@Override
public void init(IBatchConfig batchConfig) throws BatchContainerServiceException {
LOGGER.entering(CLASSNAME, "init", batchConfig);
schema = batchConfig.getDatabaseConfigurationBean().getSchema();
jndiName = batchConfig.getDatabaseConfigurationBean().getJndiName();
if (null == jndiName || jndiName.isEmpty()) {
throw new BatchContainerServiceException("JNDI name is not defined.");
}
Context ctx;
try {
ctx = new InitialContext();
dataSource = (DataSource) ctx.lookup(jndiName);
} catch (NamingException e) {
LOGGER.log(Level.SEVERE, "Lookup failed for JNDI name: {0}. " + "One cause of this could be that the batch runtime " + "is incorrectly configured to EE mode when it " + "should be in SE mode.", jndiName);
throw new BatchContainerServiceException(e);
}
// Load the table names and queries shared between different database types
tableNames = getSharedTableMap(batchConfig);
schemaTableNames = getSharedSchemaTableMap(batchConfig);
try {
queryStrings = getSQLServerSharedQueryMap(batchConfig);
} catch (SQLException e1) {
throw new BatchContainerServiceException(e1);
}
SQLServerCreateStrings = setCreateSQLServerStringsMap(batchConfig);
LOGGER.log(Level.CONFIG, "JNDI name = {0}", jndiName);
try {
if (!isSQLServerSchemaValid()) {
setDefaultSchema();
}
checkSQLServerTables();
} catch (SQLException e) {
LOGGER.severe(e.getLocalizedMessage());
throw new BatchContainerServiceException(e);
}
LOGGER.exiting(CLASSNAME, "init");
}
Aggregations