/** * Logs and throws an AtomikosSQLException. * * @param message The message to use. * @throws AtomikosSQLException */ public static void throwAtomikosSQLException ( String message ) throws AtomikosSQLException { throwAtomikosSQLException ( message , null ); }
/** * Logs and throws an AtomikosSQLException. * * @param message The message to use. * @param cause The causing error. * @throws AtomikosSQLException */ public static void throwAtomikosSQLException ( String message , Throwable cause ) throws AtomikosSQLException { LOGGER.logWarning ( message , cause ); throw new AtomikosSQLException ( message , cause ); }
private AtomikosSQLException(Throwable cause) { if (cause instanceof SQLException) { setNextException((SQLException) cause); } initCause(cause); }
private void throwAtomikosSQLException ( String msg , Throwable cause ) throws AtomikosSQLException { AtomikosSQLException.throwAtomikosSQLException ( msg , cause ); }
private AtomikosSQLException(String message, Throwable cause) { super(message); if (cause instanceof SQLException) { setNextException((SQLException) cause); } initCause(cause); }
public void init() throws SQLException { try { Class<java.sql.Driver> driverClass = ClassLoadingHelper.loadClass ( driverClassName ); driver = driverClass.newInstance(); if(user!=null){ connectionProperties.put("user", user); } if(password!=null){ connectionProperties.put("password",password); } } catch ( InstantiationException e ) { AtomikosSQLException.throwAtomikosSQLException ( "Could not instantiate driver class: " + driverClassName ); } catch ( IllegalAccessException e ) { AtomikosSQLException.throwAtomikosSQLException ( e.getMessage () ); } catch ( ClassNotFoundException e ) { AtomikosSQLException.throwAtomikosSQLException ( "Driver class not found: '" + driverClassName + "' - please make sure the spelling is correct." ); } catch (ClassCastException cce){ String msg = "Driver class '" + driverClassName + "' does not seem to be a valid JDBC driver - please check the spelling and verify your JDBC vendor's documentation"; AtomikosSQLException.throwAtomikosSQLException ( msg ); } DriverManager.setLoginTimeout ( loginTimeout ); }
public synchronized void setResourceTransaction ( ResourceTransaction restx ) throws SQLException { // System.out.println ( "setResourceTransaction"); super.setResourceTransaction ( restx ); try { // add synchronization to current CT. // NOTE: since we are only reusable AFTER termination // of the CT, we can not add ourselves as synchronization // more than once -> GOOD, otherwise we would have // dangerous behaviour (multiple terminated notifications // would mess up reused connections!) // System.out.println ( "registering synchronization" ); CompositeTransaction ct = Configuration .getCompositeTransactionManager () .getCompositeTransaction (); ct.registerSynchronization ( this ); afterCompletionDone_ = false; // added: needed for reuse of aborts (beforecompletion not called!) } catch ( Exception e ) { AtomikosSQLException.throwAtomikosSQLException ( e.getMessage() , e ); } }
AtomikosSQLException.throwAtomikosSQLException ( msg , ite ); AtomikosSQLException.throwAtomikosSQLException ( msg , ex );
AtomikosSQLException.throwAtomikosSQLException ( msg ); } else { String msg = "Connection was already closed - calling " + methodName + " is no longer allowed!"; AtomikosSQLException.throwAtomikosSQLException ( msg ); AtomikosSQLException.throwAtomikosSQLException("Cannot call method '" + methodName + "' while a global transaction is running"); AtomikosSQLException.throwAtomikosSQLException("Cannot call 'setAutoCommit(true)' while a global transaction is running");
AtomikosSQLException.throwAtomikosSQLException ( "Attempt to use connection after it was closed." ); AtomikosSQLException.throwAtomikosSQLException("Cannot call method '" + methodName + "' while a global transaction is running"); AtomikosSQLException.throwAtomikosSQLException("Cannot call 'setAutoCommit(true)' while a global transaction is running"); AtomikosSQLException.throwAtomikosSQLException ( "Connection accessed by transaction " + ct.getTid ()
if ( LOGGER.isDebugEnabled() ) LOGGER.logDebug ( "Exception in pooled connection - closing it", i ); AtomikosSQLException.throwAtomikosSQLException ( i.getMessage() , i ); } catch ( Exception e ) { String msg = "Exception in pooled connection: unexpected error - closing it"; pc_.setInvalidated (); pc_.close (); AtomikosSQLException.throwAtomikosSQLException ( e.getMessage() , e );
String msg = "Error in commit on vendor connection"; if ( ! commit ) msg = "Error in rollback on vendor connection"; AtomikosSQLException.throwAtomikosSQLException ( msg , e ); } finally {
/** * Enlist if necessary * @return True if a JTA transaction was found, false otherwise. * * @throws AtomikosSQLException */ private boolean enlist() throws AtomikosSQLException { boolean ret = false; try { if ( LOGGER.isTraceEnabled() ) LOGGER.logTrace( this + ": notifyBeforeUse " + sessionHandleState); CompositeTransaction ct = null; CompositeTransactionManager ctm = getCompositeTransactionManager(); if ( ctm != null ) { ct = ctm.getCompositeTransaction(); //first notify the session handle - see case 27857 sessionHandleState.notifyBeforeUse ( ct ); if (ct != null && ct.getProperty ( TransactionManagerImp.JTA_PROPERTY_NAME ) != null ) { ret = true; if ( LOGGER.isTraceEnabled() ) LOGGER.logTrace ( this + ": detected transaction " + ct ); if ( ct.getState().equals(TxState.ACTIVE) ) ct.registerSynchronization(new JdbcRequeueSynchronization( this , ct )); else AtomikosSQLException.throwAtomikosSQLException("The transaction has timed out - try increasing the timeout if needed"); } } } catch (InvalidSessionHandleStateException ex) { AtomikosSQLException.throwAtomikosSQLException ( ex.getMessage() , ex); } return ret; }
AtomikosSQLException.throwAtomikosSQLException ( "Connection accessed by transaction " + ct.getTid ()
AtomikosSQLException.throwAtomikosSQLException ( "The class '" + getXaDataSourceClassName() + "' specified by property 'xaDataSourceClassName' could not be found in the classpath. Please make sure the spelling is correct, and that the required jar(s) are in the classpath." , nf ); } catch (ClassCastException cce) { AtomikosSQLException.throwAtomikosSQLException ( "The class '" + getXaDataSourceClassName() + "' specified by property 'xaDataSourceClassName' does not implement the required interface javax.jdbc.XADataSource. Please make sure the spelling is correct, and check your JDBC driver vendor's documentation.");
} catch ( Exception ex) { String msg = "Cannot initialize AtomikosDataSourceBean"; AtomikosSQLException.throwAtomikosSQLException ( msg , ex );