[rules-users] InvocationTargetException in KnowledgeStoreServiceImpl - full code

Odelya Holiday odelyay at sintecmedia.com
Wed Mar 16 06:38:13 EDT 2011


Hi!

I posted my previous message from the web client and it was corrupted. So here is the full one:

get InvocationTargetException  after the following: 

 return constructor.newInstance( kbase,  conf, env ); 

in KnowledgeStoreServiceImpl. 

I see that in return (T) constructorAccessor.newInstance(initargs) of Constructor class it throws the InvocationTargetException. 

The exception is null so I can't see what it the problem! 

I call the code from this: 

EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.drools.persistence.jpa"); 
                Environment env = KnowledgeBaseFactory.newEnvironment(); 
                env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf); 
                env.set(EnvironmentName.GLOBALS, new MapGlobalResolver()); 
                env.set(EnvironmentName.TRANSACTION_MANAGER, TransactionManagerServices.getTransactionManager()); 
                ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env); 

I define the transaction manager in my spring beans like this:
<!--  Bitronix Transaction Manager embedded configuration -->
	<bean id="xaDataSource" class="bitronix.tm.resource.jdbc.PoolingDataSource"
		init-method="init" destroy-method="close">
		<property name="className" value="bitronix.tm.resource.jdbc.lrc.LrcXADataSource" />
		<property name="uniqueName" value="java/DS1" />
		<property name="maxPoolSize" value="5" />
		<property name="minPoolSize" value="0" />
		<property name="allowLocalTransactions" value="false" />
		<property name="testQuery" value="SELECT 1 FROM DUAL" />
		<property name="driverProperties">
			<props>
				<prop key="user">username</prop>
				<prop key="password">username</prop>
				<prop key="url">url</prop>
				<prop key="driverClassName">oracle.jdbc.OracleDriver</prop>
			</props>
		</property>
	</bean>


	<bean id="btmConfig" factory-method="getConfiguration"
		class="bitronix.tm.TransactionManagerServices">
		<property name="serverId" value="spring-btm" />
	</bean>


	<bean id="bitronixTransactionManager" factory-method="getTransactionManager"
		class="bitronix.tm.TransactionManagerServices" depends-on="btmConfig,xaDataSource"
		destroy-method="shutdown" />


	<bean id="jtaTransactionManager"
		class="org.springframework.transaction.jta.JtaTransactionManager">
		<property name="transactionManager" ref="bitronixTransactionManager" />
		<property name="userTransaction" ref="bitronixTransactionManager" />
	</bean>
	<!--  end of Bitronix Transaction Manager embedded configuration -->
	
	<bean id="transactionManager"
		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory" ref="OnMediaSessionFactory" />
	</bean>

I see that bitronix is up via the debugging messages. (2011-03-16 12:14:53,399 DEBUG (        PoolingDataSource.java:84)     - building XA pool for java/DS1 with 0 connection(s) etc..) 

in persistence.xml I have:

<persistence-unit name="org.drools.persistence.jpa" transaction-type="JTA">
                    <provider>org.hibernate.ejb.HibernatePersistence</provider>
                    <jta-data-source>java/DS1</jta-data-source>
                    <mapping-file>persistenceorm.xml</mapping-file>
                    <class>org.drools.persistence.info.SessionInfo</class>
                    <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
                    <class>org.drools.persistence.info.WorkItemInfo</class>
                    <exclude-unlisted-classes>true</exclude-unlisted-classes>
                    <properties>
                              <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
                              <property name="hibernate.connection.autocommit" value="false" />
                              <property name="hibernate.max_fetch_depth" value="3" />
                              <property name="hibernate.show_sql" value="true" />
                              <property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver" />
                               <property name="hibernate.jndi.class" value="bitronix.tm.jndi.BitronixInitialContextFactory"/>
                              <property name="hibernate.transaction.manager_lookup_class"
                                        value="org.hibernate.transaction.BTMTransactionManagerLookup" />
                    </properties>
          </persistence-unit>

What could cause the problem? 

When I defined the btm with tomcat and not with spring - it worked fine. (but I had context reloading problems). when I define it only with spring - it get this weird exception.

Thanks!

Odelya




More information about the rules-users mailing list