Search in sources :

Example 1 with BatchContainerServiceException

use of com.ibm.jbatch.container.exception.BatchContainerServiceException in project Payara by payara.

the class OraclePersistenceManager 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();
    if (jndiName == null || jndiName.equals("")) {
        throw new BatchContainerServiceException("JNDI name is not defined.");
    }
    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);
    oracleObjectNames = getOracleObjectsMap(batchConfig);
    try {
        queryStrings = getSharedQueryMap(batchConfig);
    } catch (SQLException e1) {
        // TODO Auto-generated catch block
        throw new BatchContainerServiceException(e1);
    }
    logger.config("JNDI name = " + jndiName);
    try {
        if (!isOracleSchemaValid()) {
            setDefaultSchema();
        }
        checkOracleTables();
    } catch (SQLException e) {
        logger.severe(e.getLocalizedMessage());
        throw new BatchContainerServiceException(e);
    }
    logger.config("Exiting CLASSNAME.init()");
}
Also used : InitialContext(javax.naming.InitialContext) Context(javax.naming.Context) SQLException(java.sql.SQLException) BatchContainerServiceException(com.ibm.jbatch.container.exception.BatchContainerServiceException) NamingException(javax.naming.NamingException) InitialContext(javax.naming.InitialContext)

Example 2 with BatchContainerServiceException

use of com.ibm.jbatch.container.exception.BatchContainerServiceException in project Payara by payara.

the class DB2PersistenceManager 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);
    createDB2Strings = setCreateDB2StringsMap(batchConfig);
    logger.config("JNDI name = " + jndiName);
    if (jndiName == null || jndiName.equals("")) {
        throw new BatchContainerServiceException("JNDI name is not defined.");
    }
    try {
        if (!isDB2SchemaValid()) {
            setDefaultSchema();
        }
        checkDB2Tables();
    } catch (SQLException e) {
        logger.severe(e.getLocalizedMessage());
        throw new BatchContainerServiceException(e);
    }
    logger.config("Exiting CLASSNAME.init()");
}
Also used : InitialContext(javax.naming.InitialContext) Context(javax.naming.Context) SQLException(java.sql.SQLException) NamingException(javax.naming.NamingException) BatchContainerServiceException(com.ibm.jbatch.container.exception.BatchContainerServiceException) InitialContext(javax.naming.InitialContext)

Example 3 with BatchContainerServiceException

use of com.ibm.jbatch.container.exception.BatchContainerServiceException in project Payara by payara.

the class H2PersistenceManager method init.

@Override
public void init(IBatchConfig batchConfig) throws BatchContainerServiceException {
    logger.log(Level.CONFIG, "Entering CLASSNAME.init(), batchConfig ={0}", batchConfig);
    this.batchConfig = batchConfig;
    schema = batchConfig.getDatabaseConfigurationBean().getSchema();
    jndiName = batchConfig.getDatabaseConfigurationBean().getJndiName();
    logger.log(Level.CONFIG, "JNDI name = {0}", jndiName);
    if (jndiName == null || jndiName.equals("")) {
        throw new BatchContainerServiceException("JNDI name is not defined.");
    }
    try {
        dataSource = (DataSource) new InitialContext().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);
    try {
        queryStrings = getSharedQueryMap(batchConfig);
    } catch (SQLException e1) {
        throw new BatchContainerServiceException(e1);
    }
    try {
        if (!isH2SchemaValid()) {
            setDefaultSchema();
        }
        checkH2Tables();
    } catch (SQLException e) {
        logger.severe(e.getLocalizedMessage());
        throw new BatchContainerServiceException(e);
    }
    try {
        requestTracing = getDefaultHabitat().getService(RequestTracingService.class);
    } catch (NullPointerException ex) {
        logger.log(INFO, "Error retrieving Request Tracing service " + "during initialisation of JBatchJDBCPersistenceManager - NullPointerException");
    }
    logger.config("Exiting CLASSNAME.init()");
}
Also used : SQLException(java.sql.SQLException) BatchContainerServiceException(com.ibm.jbatch.container.exception.BatchContainerServiceException) NamingException(javax.naming.NamingException) InitialContext(javax.naming.InitialContext) RequestTracingService(fish.payara.nucleus.requesttracing.RequestTracingService)

Example 4 with BatchContainerServiceException

use of com.ibm.jbatch.container.exception.BatchContainerServiceException in project Payara by payara.

the class JBatchJDBCPersistenceManager method init.

/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.ibm.jbatch.container.services.impl.AbstractPersistenceManagerImpl
	 * #init(com.ibm.jbatch.container.IBatchConfig)
	 */
@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();
    logger.config("JNDI name = " + jndiName);
    if (jndiName == null || jndiName.equals("")) {
        throw new BatchContainerServiceException("JNDI name is not defined.");
    }
    try {
        dataSource = (DataSource) new InitialContext().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) {
        throw new BatchContainerServiceException(e1);
    }
    try {
        if (!isDerbySchemaValid()) {
            setDefaultSchema();
        }
        checkDerbyTables();
    } catch (SQLException e) {
        logger.severe(e.getLocalizedMessage());
        throw new BatchContainerServiceException(e);
    }
    try {
        requestTracing = getDefaultHabitat().getService(RequestTracingService.class);
    } catch (NullPointerException ex) {
        logger.log(INFO, "Error retrieving Request Tracing service " + "during initialisation of JBatchJDBCPersistenceManager - NullPointerException");
    }
    logger.config("Exiting CLASSNAME.init()");
}
Also used : SQLException(java.sql.SQLException) BatchContainerServiceException(com.ibm.jbatch.container.exception.BatchContainerServiceException) NamingException(javax.naming.NamingException) InitialContext(javax.naming.InitialContext) RequestTracingService(fish.payara.nucleus.requesttracing.RequestTracingService)

Example 5 with BatchContainerServiceException

use of com.ibm.jbatch.container.exception.BatchContainerServiceException in project Payara by payara.

the class MySqlPersistenceManager 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();
    if (jndiName == null || jndiName.equals("")) {
        throw new BatchContainerServiceException("JNDI name is not defined.");
    }
    Context ctx = null;
    try {
        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);
    createMySQLStrings = setCreateMySQLStringsMap(batchConfig);
    logger.config("JNDI name = " + jndiName);
    try {
        if (!isMySQLSchemaValid()) {
            setDefaultSchema();
        }
        checkMySQLTables();
    } catch (SQLException e) {
        logger.severe(e.getLocalizedMessage());
        throw new BatchContainerServiceException(e);
    }
    logger.config("Exiting CLASSNAME.init()");
}
Also used : InitialContext(javax.naming.InitialContext) Context(javax.naming.Context) SQLException(java.sql.SQLException) BatchContainerServiceException(com.ibm.jbatch.container.exception.BatchContainerServiceException) NamingException(javax.naming.NamingException) InitialContext(javax.naming.InitialContext)

Aggregations

BatchContainerServiceException (com.ibm.jbatch.container.exception.BatchContainerServiceException)7 SQLException (java.sql.SQLException)7 InitialContext (javax.naming.InitialContext)7 NamingException (javax.naming.NamingException)7 Context (javax.naming.Context)5 RequestTracingService (fish.payara.nucleus.requesttracing.RequestTracingService)2