AnsweredAssumed Answered

Error checking for a transaction

Question asked by andremonteiro on Sep 12, 2013
Latest reply on Sep 17, 2013 by andremonteiro
Hi,

I'm using activit-cdi with Jboss AS 7 and facing the following issue:

1) I have a Listner in a flow process of type Expression, that calls a application's class method (let's say, myMethod), to validate some data;

2) When the user clicks into "Save" button of type submit into a xhml page, the listner is called;

3) If the validate fails, myMethod throws a business Exception, that should be intercepted by my interceptor, that shows a message to the user;

4) However, when the exception is launched, I'm suspecting that the Activiti class InvocationTargetException.java catch this exception, and then closes the transaction;

5) Then, when the page is reloaded, the xhtml tries to get some information by Activiti (using the RuntimeService class), but the transaction is no longer avaliable, which results into the following stacktrace:


javax.servlet.ServletException: org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  Cause: java.sql.SQLException: javax.resource.ResourceException: IJ000460: Error checking for a transaction
### The error may exist in org/activiti/db/mapping/entity/Execution.xml
### The error may involve org.activiti.engine.impl.persistence.entity.ExecutionEntity.selectExecution
### The error occurred while executing a query
### Cause: java.sql.SQLException: javax.resource.ResourceException: IJ000460: Error checking for a transaction
   javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
   org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:77)
   org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
   org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65)
   org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74)


My activiti.cgf.xml is configured as follow:


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
            
   <!– lookup the JTA-Transaction manager –>
   <bean id="transactionManager" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiName" value="java:jboss/TransactionManager"></property>
        <property name="resourceRef" value="true" />
    </bean>

    <bean id="processEngineConfiguration" class="org.activiti.cdi.CdiJtaProcessEngineConfiguration">
        <!– lookup the default Jboss datasource –>
        <property name="dataSourceJndiName" value="java:/bpm-activiti" />
        <property name="transactionManager" ref="transactionManager" />
        <!– using externally managed transactions –>
        <property name="transactionsExternallyManaged" value="true" />
        <property name="databaseSchemaUpdate" value="true" />
       
        <property name="databaseType" value="oracle" />
        <property name="jobExecutorActivate" value="true" />
        <property name="history" value="audit" />             
         
        <property name="customFormTypes">
            <list>
                …
            </list>
        </property>
    </bean>
</beans>


Can anyone help me? Thanks in advance.

Outcomes