Package org.ow2.easybeans.event.bean

Examples of org.ow2.easybeans.event.bean.EventBeanInvocationError


            resolve();
        }

        try {
            Thread.currentThread().setContextClassLoader(this.classLoader);
            Enhancer enhancer = new Enhancer(this.classLoader, this.deployment.getEjbJarArchiveMetadata(), this.enhancerMap);

            long tStartEnhancing = System.currentTimeMillis();
            try {
                enhancer.enhance();
            } catch (EnhancerException ee) {
                throw new EZBContainerException("Cannot run enhancer on archive '" + getName() + "'.", ee);
            } catch (RuntimeException e) {
                // Catch Exception as some exceptions can be runtime exception
                throw new EZBContainerException("Cannot run enhancer on archive '" + getName() + "'.", e);
View Full Code Here


                            beanInfo.setCluster(classAnnotationMetadata.getCluster());

                            // Set invocation context factor

                            if (Boolean.getBoolean("easybeans.dynamicinterceptors")) {
                              factory.setInvocationContextFactory(new EasyBeansInvocationContextFactory(classAnnotationMetadata,
                                   this.classLoader));
                            }
                            // Sets the bean info
                            this.ejbJarInfo.addBeanInfo(beanInfo);
View Full Code Here

        }

        // Needs to keep annotation for intercepted method
        if (this.classAnnotationMetadata.isBean()) {
            if (isInterceptedMethod(jMethod) || isInterceptorMethod(jMethod)) {
                MethodAdapterWithAnnotationRecorder methodAdapter = new MethodAdapterWithAnnotationRecorder(super.visitMethod(
                        newAccess, newName, desc, signature, exceptions));
                // keep annotations
                this.annotationsOfMethod.put(name + desc, methodAdapter.getAnnotationRecorders());
                this.parametersAnnotationsOfMethod.put(name + desc, methodAdapter.getParameterAnnotationRecorders());

                return methodAdapter;
            }
        }
        // Else only call super method
View Full Code Here

        try {
            value = m.invoke(bean, localCallRequest.getMethodArgs());
        } catch (IllegalArgumentException e) {
            ejbResponse.setRPCException(new RPCException(e));
            if (enabledEvent) {
                getEventDispatcher().dispatch(new EventBeanInvocationError(methodEventProviderId, number, e));
            }
        } catch (IllegalAccessException e) {
            ejbResponse.setRPCException(new RPCException(e));
            if (enabledEvent) {
                getEventDispatcher().dispatch(new EventBeanInvocationError(methodEventProviderId, number, e));
            }
        } catch (InvocationTargetException e) {
            Throwable cause = e.getCause();
            RPCException rpcException = new RPCException(cause);
            // ApplicationException ?
            ApplicationException applicationException = getBeanInfo().getApplicationExceptions().get(cause.getClass().getName());
            if (applicationException != null) {
                rpcException.setApplicationException();
            }
            ejbResponse.setRPCException(rpcException);
            if (enabledEvent) {
                getEventDispatcher().dispatch(new EventBeanInvocationError(methodEventProviderId, number, e));
            }
        } finally {
            // send events only if not called remotely
            if (enabledEvent) {
                getEventDispatcher().dispatch(new EventBeanInvocationEnd(methodEventProviderId, number, value));
View Full Code Here

        try {
            result = mdbMethod.invoke(getEasyBeansMDB(), args);
            endEvent = new EventBeanInvocationEnd(methodEventProviderId, number, null);
        } catch (IllegalArgumentException e) {
            logger.error("Cannot deliver the message", e);
            endEvent = new EventBeanInvocationError(methodEventProviderId, number, e);
            throw new IllegalStateException("Cannot deliver the message", e);
        } catch (IllegalAccessException e) {
            logger.error("Cannot deliver the message", e);
            endEvent = new EventBeanInvocationError(methodEventProviderId, number, e);
            throw new IllegalStateException("Cannot deliver the message", e);
        } catch (InvocationTargetException e) {
            endEvent = new EventBeanInvocationError(methodEventProviderId, number, e);
            logger.error("Cannot deliver the message", e.getTargetException());
            throw new IllegalStateException("Cannot deliver the message", e.getTargetException());
        } finally {
            // Reset classloader
            Thread.currentThread().setContextClassLoader(oldCL);
View Full Code Here

            try {
                value = m.invoke(bean, localCallRequest.getMethodArgs());
            } catch (IllegalArgumentException e) {
                ejbResponse.setRPCException(new RPCException(e));
                if (enabledEvent) {
                    getEventDispatcher().dispatch(new EventBeanInvocationError(methodEventProviderId, number, e));
                }
            } catch (IllegalAccessException e) {
                ejbResponse.setRPCException(new RPCException(e));
                if (enabledEvent) {
                    getEventDispatcher().dispatch(new EventBeanInvocationError(methodEventProviderId, number, e));
                }
            } catch (InvocationTargetException e) {
                Throwable cause = e.getCause();
                RPCException rpcException = new RPCException(cause);
                // ApplicationException ?
                ApplicationException applicationException = getBeanInfo().getApplicationExceptions().get(
                        cause.getClass().getName());
                if (applicationException != null) {
                    rpcException.setApplicationException();
                }
                ejbResponse.setRPCException(rpcException);
                if (enabledEvent) {
                    getEventDispatcher().dispatch(new EventBeanInvocationError(methodEventProviderId, number, e));
                }
            } finally {
                Thread.currentThread().setContextClassLoader(oldClassLoader);
                getInvokedBusinessInterfaceNameThreadLocal().set(oldInvokedBusinessInterface);
                getOperationStateThreadLocal().set(oldState);
View Full Code Here

            }

            return result;
        } catch (Exception ex) {
            // Create the bean invocation error event.
            event = new EventBeanInvocationError(methodEventProviderId, number, ex);
            throw new RuntimeException(ex);
        } finally {
            // Restore previous ID
            if (getCurrentInvocationID() != null) {
                getCurrentInvocationID().setAuditID(previousID);
View Full Code Here

        try {
            value = m.invoke(bean, localCallRequest.getMethodArgs());
        } catch (IllegalArgumentException e) {
            ejbResponse.setRPCException(new RPCException(e));
            if (enabledEvent) {
                getEventDispatcher().dispatch(new EventBeanInvocationError(methodEventProviderId, number, e));
            }
        } catch (IllegalAccessException e) {
            ejbResponse.setRPCException(new RPCException(e));
            if (enabledEvent) {
                getEventDispatcher().dispatch(new EventBeanInvocationError(methodEventProviderId, number, e));
            }
        } catch (InvocationTargetException e) {
            Throwable cause = e.getCause();
            RPCException rpcException = new RPCException(cause);
            // ApplicationException ?
            ApplicationException applicationException = getBeanInfo().getApplicationExceptions().get(cause.getClass().getName());
            if (applicationException != null) {
                rpcException.setApplicationException();
            }
            ejbResponse.setRPCException(rpcException);
            if (enabledEvent) {
                getEventDispatcher().dispatch(new EventBeanInvocationError(methodEventProviderId, number, e));
            }
        } finally {
            if (enabledEvent) {
                getEventDispatcher().dispatch(new EventBeanInvocationEnd(methodEventProviderId, number, value));
                // Restore previous ID
View Full Code Here

            logger.info("Container ''{0}'' [{1} SLSB, {2} SFSB, {3} MDB] started in {4} ms", getArchive().getName(),
                    Integer.valueOf(slsb), Integer.valueOf(sfsb), Integer.valueOf(mdb), Long.valueOf((System
                            .currentTimeMillis() - tStart)));
        }

        this.dispatcher.dispatch(new EventContainerStarted(this.j2eeManagedObjectId, getArchive(),
                                                           this.persistenceUnitManager, this.configuration));
        this.dispatcher.dispatch(new EventLifeCycleStarted(this.j2eeManagedObjectId));

        this.available = true;
View Full Code Here

            try {
                JPersistenceUnitInfo[] persistenceUnitInfos =
                        PersistenceXmlFileAnalyzer.analyzePersistenceXmlFile(getArchive());

                // Dispatch life cycle event.
                this.dispatcher.dispatch(new EventContainerStarting(this.j2eeManagedObjectId, getArchive(),
                                                                    persistenceUnitInfos, this.configuration));

                if (persistenceUnitInfos != null) {
                    analyzedPersistenceUnitManager =
                            PersistenceXmlFileAnalyzer.loadPersistenceProvider(persistenceUnitInfos, getClassLoader());
View Full Code Here

TOP

Related Classes of org.ow2.easybeans.event.bean.EventBeanInvocationError

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.