JBoss Community

Re: Drools, Spring integration and JTA in container

created by bodi bajk in jBPM - View the full discussion

Maybe the problem is in my configuration:

 

    

.....

 

<drools:ksession id="jpaSingleSessionCommandService" type="stateful" kbase="knowledgeBase">

                    <drools:configuration>

                              <drools:work-item-handlers>

                                        <!-- ....  -->

                              </drools:work-item-handlers>

                              <drools:jpa-persistence>

                                        <drools:transaction-manager ref="transactionManager"/>

                                        <drools:entity-manager-factory ref="entityManagerFactory"/>

                              </drools:jpa-persistence>

                    </drools:configuration>

          </drools:ksession>

 

  .....

 

<jee:jndi-lookup id="entityManagerFactory" jndi-name="java:/org.drools.persistence.jpa.local"/>

 

<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">

        <property name="transactionManagerName" value="java:/TransactionManager"/>

        <property name="userTransactionName" value="UserTransaction"/>

</bean>

.....

 

 

     

During deployment, application throws NullpointerException in class: SingleSessionCommandService

 

 

because when invoked initTransactionManager(Environment env) method:

 

  

Object tm = env.get( EnvironmentName.TRANSACTION_MANAGER );

....

if ( tm.getClass().getName().toLowerCase().contains( "jpa" ) ) {

                    // configure spring for JPA and local transactions

                    cls = Class.forName( "org.drools.container.spring.beans.persistence.DroolsSpringJpaManager" );

                    con = cls.getConstructors()[0];

                    this.jpm =  ( JpaManager) con.newInstance( new Object[] { this.env } );

                } else {

                    // configure spring for JPA and distributed transactions 

 

                }

 

 

jpm is null,

because tm.getClass().getName() is not true, in my case (org.springframework.transaction.jta.JtaTransactionManager)

Reply to this message by going to Community

Start a new discussion in jBPM at Community