Package org.apache.openejb

Examples of org.apache.openejb.ApplicationException


                callContext.setCurrentAllowedStates(EntityContext.getStates());
                try {
                    bean.ejbLoad();
                } catch (NoSuchEntityException e) {
                    instanceManager.discardInstance(callContext, bean);
                    throw new ApplicationException(new NoSuchObjectException("Entity not found: " + callContext.getPrimaryKey())/*.initCause(e)*/);
                } catch (Exception e) {
                    instanceManager.discardInstance(callContext, bean);
                    throw e;
                } finally {
                    callContext.setCurrentOperation(orginalOperation);
View Full Code Here


        }
    }

    public void handleApplicationException(Throwable appException, boolean rollback, TransactionContext context) throws ApplicationException, SystemException {
        if (rollback && context.currentTx != null) markTxRollbackOnly(context.currentTx);
        throw new ApplicationException(appException);
    }
View Full Code Here

        } else {
            // if it is not in the queue, the bean is already being invoked
            // the only reentrant/concurrent operations allowed are Session synchronization callbacks
            Operation currentOperation = callContext.getCurrentOperation();
            if (currentOperation != Operation.AFTER_COMPLETION && currentOperation != Operation.BEFORE_COMPLETION) {
                throw new ApplicationException(new RemoteException("Concurrent calls not allowed"));
            }

            return entry.bean;
        }
    }
View Full Code Here

        try {
            checkAuthorization(deploymentInfo, callMethod, callInterface);

            InterfaceType type = deploymentInfo.getInterfaceType(callInterface);
            if (type.isComponent() && instanceManager.getBeanTransaction(callContext) != null) {
                throw new ApplicationException(new RemoveException("A stateful EJB enrolled in a transaction can not be removed"));
            }

            Method runMethod = deploymentInfo.getMatchingBeanMethod(callMethod);
            StatefulInstanceManager.Instance instance = (StatefulInstanceManager.Instance) instanceManager.obtainInstance(primKey, callContext);

            if (instance == null) throw new ApplicationException(new javax.ejb.NoSuchEJBException());

            boolean retain = false;
            try {
                callContext.setCurrentAllowedStates(StatefulContext.getStates());
                callContext.setCurrentOperation(Operation.REMOVE);
View Full Code Here

    }

    private void checkAuthorization(CoreDeploymentInfo deployInfo, Method callMethod, Class callInterface) throws ApplicationException {
        boolean authorized = securityService.isCallerAuthorized(callMethod, deployInfo.getInterfaceType(callInterface));
        if (!authorized) {
            throw new ApplicationException(new EJBAccessException("Unauthorized Access by Principal Denied"));
        }
    }
View Full Code Here

    protected TransactionManager getTransactionManager() {
        return transactionManager;
    }

    protected void throwExceptionToServer(Throwable sysException) throws ApplicationException {
        throw new ApplicationException(sysException);
    }
View Full Code Here

                } catch (final Throwable t) {
                    // no-op
                }

                /* [3] Throw the RemoteException to the client */
                throw new ApplicationException(new RemoteException(message));
            }

            fireNonTransactionalCompletion();
        } finally {
            resumeTransaction(clientTx);
View Full Code Here

    public TxMandatory(final TransactionManager transactionManager) throws SystemException, ApplicationException {
        super(TransactionType.Mandatory, transactionManager);

        clientTx = getTransaction();
        if (clientTx == null) {
            throw new ApplicationException(new TransactionRequiredException());
        }
    }
View Full Code Here

        if (rollback) {
            txPolicy.setRollbackOnly(appException);
        }

        if (!(appException instanceof ApplicationException)) {
            throw new ApplicationException(appException);
        }
    }
View Full Code Here

            }
        } catch (final RollbackException e) {

            txLogger.debug("The transaction has been rolled back rather than commited: {0}", e.getMessage());
            final Throwable txe = new TransactionRolledbackException("Transaction was rolled back, presumably because setRollbackOnly was called during a synchronization").initCause(e);
            throw new ApplicationException(txe);

        } catch (final HeuristicMixedException e) {

            txLogger.debug("A heuristic decision was made, some relevant updates have been committed while others have been rolled back: {0}", e.getMessage());
            throw new ApplicationException(new RemoteException("A heuristic decision was made, some relevant updates have been committed while others have been rolled back", e));

        } catch (final HeuristicRollbackException e) {

            txLogger.debug("A heuristic decision was made while commiting the transaction, some relevant updates have been rolled back: {0}", e.getMessage());
            throw new ApplicationException(new RemoteException("A heuristic decision was made while commiting the transaction, some relevant updates have been rolled back", e));

        } catch (final SecurityException e) {

            txLogger.error("The current thread is not allowed to commit the transaction: {0}", e.getMessage());
            throw new SystemException(e);
View Full Code Here

TOP

Related Classes of org.apache.openejb.ApplicationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.