2016-04-20 104 views
0

我正在運行一個簡單的測試,其中KieSession在STREAM模式下運行。我將「MyEvent」定義爲一個事件並指定它應在3秒內過期。插入事件後,我處理KieSession,休眠5秒(以使計時器到期),然後嘗試重新加載會話。但是,當我嘗試會話重新加載時,我得到類似於下面顯示的異常。爲什麼我在KieSession重新加載時出現異常?

在此先感謝您的任何見解。

kmodule.xml:

<?xml version="1.0" encoding="UTF-8"?> 
 
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule"> 
 
    <kbase name="rules" eventProcessingMode="stream" packages="rules"> 
 
     <ksession name="ksession-rules"/> 
 
    </kbase> 
 
</kmodule>

MyEvent.drl

package com.mytest.stream; 

import java.util.Date; 

declare MyEvent 
    @role(event) 
    @expires(3s) 
end 

rule 'MyEvent' 
when 
    $m: MyEvent() 
then 
    System.out.println(new Date() + " demoReload: Got MyEvent, id=" + $m.getId()); 
end 

MyEvent.java

package com.mytest.stream; 
import java.io.Serializable; 
public class MyEvent implements Serializable { 
    private static final long serialVersionUID = 1L; 
    private String id; 
    public MyEvent(String id) { 
     this.id = id; 
    } 
    public static long getSerialversionuid() { 
     return serialVersionUID; 
    } 
    public String getId() { 
     return id; 
    } 
} 

的persistence.xml

<?xml version="1.0" encoding="UTF-8" ?> 
 
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> 
 
    <persistence-unit name="myPU" transaction-type="JTA"> 
 
    <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> 
 
    <jta-data-source>jdbc/BitronixJTADataSource</jta-data-source> 
 
    <class>org.drools.persistence.info.SessionInfo</class> 
 
    <class>org.drools.persistence.info.WorkItemInfo</class> 
 
    <properties> 
 
     <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" /> 
 
     <property name="hibernate.max_fetch_depth" value="3" /> 
 
     <property name="hibernate.hbm2ddl.auto" value="update" /> 
 
     <property name="hibernate.show_sql" value="true" /> 
 
     <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.BTMTransactionManagerLookup" /> 
 
    </properties> 
 
    </persistence-unit> 
 
</persistence>

DroolsTest.java

package com.mytest.stream; 

import javax.persistence.Persistence; 

import org.junit.Test; 
import org.kie.api.KieBase; 
import org.kie.api.KieServices; 
import org.kie.api.runtime.Environment; 
import org.kie.api.runtime.EnvironmentName; 
import org.kie.api.runtime.KieContainer; 
import org.kie.api.runtime.KieSession; 

import bitronix.tm.TransactionManagerServices; 
import bitronix.tm.resource.jdbc.PoolingDataSource; 

import com.mytest.stream.MyEvent; 

import java.util.Date; 
public class DroolsTest { 

    @Test 
    public void demoReloadFailure() throws Throwable {  
     System.getProperties().put("java.naming.factory.initial","bitronix.tm.jndi.BitronixInitialContextFactory"); 
     PoolingDataSource ds = new PoolingDataSource(); 
     ds.setUniqueName("jdbc/BitronixJTADataSource"); 
     ds.setClassName("org.h2.jdbcx.JdbcDataSource"); 
     ds.setMaxPoolSize(3); 
     ds.setAllowLocalTransactions(true); 
     ds.getDriverProperties().put("user", "sa"); 
     ds.getDriverProperties().put("password", ""); 
     ds.getDriverProperties().put("URL", "jdbc:h2:file:./sql/mytest"); 
     ds.init(); 

     try { 
      KieServices ks = KieServices.Factory.get(); 
      Environment env = ks.newEnvironment(); 
      env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, Persistence.createEntityManagerFactory("myPU")); 
      env.set(EnvironmentName.TRANSACTION_MANAGER,TransactionManagerServices.getTransactionManager()); 
      KieContainer kieContainer = ks.getKieClasspathContainer(); 
      KieBase kieBase = kieContainer.getKieBase("rules"); 
      KieSession kieSession = ks.getStoreServices().newKieSession(kieBase, null, env); 
      long kieSessionId = kieSession.getIdentifier(); 
      kieSession.insert(new MyEvent("EVENT1")); 
      kieSession.fireAllRules(); 
      kieSession.dispose(); 

      // Timer in MyEvent.drl set for 3 second expiration, so it will already have expired 
      // when session reload is attempted. 
      // 
      Thread.sleep(5000); 

      kieSession = ks.getStoreServices().loadKieSession(kieSessionId, kieBase, null, env); 
      kieSession.fireAllRules(); 
      kieSession.dispose(); 

     } catch (Exception e) { 
      System.out.println(new Date() + " demoReloadFailure: Caught Exception, message=" + e.getMessage()); 
     } 
    } 
} 

的pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
 
    <modelVersion>4.0.0</modelVersion> 
 
    <groupId>com.mytest.stream</groupId> 
 
    <artifactId>drools-stream</artifactId> 
 
    <version>1.0</version> 
 

 
    <properties> 
 
    <drools.version>6.3.0.Final</drools.version> 
 
    </properties> 
 
    <!-- JBOSS repository --> 
 
    <repositories> 
 
    <repository> 
 
     <id>jboss-public-repository-group</id> 
 
     <name>JBoss Public Repository Group</name> 
 
     <url>http://repository.jboss.org/nexus/content/groups/public/</url> 
 
     <layout>default</layout> 
 
     <releases> 
 
     <enabled>true</enabled> 
 
     <updatePolicy>never</updatePolicy> 
 
     </releases> 
 
    </repository> 
 
    </repositories> 
 
    <dependencies> 
 
    <dependency> 
 
     <groupId>org.drools</groupId> 
 
     <artifactId>drools-core</artifactId> 
 
     <version>${drools.version}</version> 
 
    </dependency> 
 
    <dependency> 
 
     <groupId>org.drools</groupId> 
 
     <artifactId>drools-compiler</artifactId> 
 
     <version>${drools.version}</version> 
 
    </dependency> 
 
    <dependency> 
 
     <groupId>org.drools</groupId> 
 
     <artifactId>drools-persistence-jpa</artifactId> 
 
     <version>${drools.version}</version> 
 
     <exclusions> 
 
     <exclusion> 
 
      <artifactId>hibernate-jpa-2.0-api</artifactId> 
 
      <groupId>org.hibernate.javax.persistence</groupId> 
 
     </exclusion> 
 
     </exclusions> 
 
    </dependency> 
 
    <!-- Testing --> 
 
    <dependency> 
 
     <groupId>junit</groupId> 
 
     <artifactId>junit</artifactId> 
 
     <version>4.11</version> 
 
     <scope>test</scope> 
 
    </dependency> 
 
    <!-- Logging --> 
 
    <dependency> 
 
     <groupId>org.slf4j</groupId> 
 
     <artifactId>slf4j-api</artifactId> 
 
     <version>1.6.4</version> 
 
     <scope>provided</scope> 
 
    </dependency> 
 
    <dependency> 
 
     <groupId>org.slf4j</groupId> 
 
     <artifactId>slf4j-log4j12</artifactId> 
 
     <version>1.6.4</version> 
 
     <scope>provided</scope> 
 
    </dependency> 
 
    <dependency> 
 
     <groupId>log4j</groupId> 
 
     <artifactId>log4j</artifactId> 
 
     <version>1.2.14</version> 
 
     <scope>provided</scope> 
 
    </dependency> 
 
    <dependency> 
 
     <groupId>com.h2database</groupId> 
 
     <artifactId>h2</artifactId> 
 
     <version>[1.4.186,)</version> 
 
    </dependency> 
 
    <dependency> 
 
     <groupId>javax.transaction</groupId> 
 
     <artifactId>jta</artifactId> 
 
     <version>1.1</version> 
 
    </dependency> 
 
    <dependency> 
 
     <groupId>org.codehaus.btm</groupId> 
 
     <artifactId>btm</artifactId> 
 
     <version>2.1.4</version> 
 
    </dependency> 
 
    <!-- Persistence using hibernate --> 
 
    <dependency> 
 
     <groupId>org.hibernate</groupId> 
 
     <artifactId>hibernate-core</artifactId> 
 
     <version>5.0.7.Final</version> 
 
    </dependency> 
 
    <dependency> 
 
     <groupId>org.hibernate</groupId> 
 
     <artifactId>hibernate-entitymanager</artifactId> 
 
     <version>5.0.7.Final</version> 
 
    </dependency> 
 
    </dependencies> 
 
</project>

登錄(包括空指針異常;省略了一些線,以符合StackOverflow的字符)

[main] DEBUG bitronix.tm.resource.jdbc.PoolingDataSource - building XA pool for jdbc/BitronixJTADataSource with 0 connection(s) 
20 [main] DEBUG bitronix.tm.resource.common.XAPool - setting vendor property 'URL' to 'jdbc:h2:file:./sql/mytest' 
23 [main] DEBUG bitronix.tm.resource.common.XAPool - setting vendor property 'user' to 'sa' 
23 [main] DEBUG bitronix.tm.resource.common.XAPool - setting vendor property 'password' to '' 
35 [main] DEBUG bitronix.tm.timer.TaskScheduler - task scheduler backed by ConcurrentSkipListSet 
50 [main] DEBUG bitronix.tm.timer.TaskScheduler - scheduling pool shrinking task on an XAPool of resource jdbc/BitronixJTADataSource with 0 connection(s) (0 still available) for Tue Jan 06 21:47:35 EST 1970 
50 [main] DEBUG bitronix.tm.timer.TaskScheduler - removing task by an XAPool of resource jdbc/BitronixJTADataSource with 0 connection(s) (0 still available) 
51 [main] DEBUG bitronix.tm.timer.TaskScheduler - scheduled a PoolShrinkingTask scheduled for Tue Jan 06 21:47:35 EST 1970 on an XAPool of resource jdbc/BitronixJTADataSource with 0 connection(s) (0 still available), total task(s) queued: 1 
53 [main] DEBUG bitronix.tm.Configuration - loading default configuration 
53 [main] DEBUG bitronix.tm.Configuration - no configuration file found, using default settings 
129 [main] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Log4jLoggerProvider 
229 [main] DEBUG org.hibernate.jpa.boot.spi.ProviderChecker - Persistence-unit [myPU] requested PersistenceProvider [org.hibernate.jpa.HibernatePersistenceProvider] 
235 [main] DEBUG org.hibernate.jpa.internal.util.LogHelper - PersistenceUnitInfo [ 
    name: myPU 
    persistence provider classname: org.hibernate.jpa.HibernatePersistenceProvider 
    classloader: null 
    excludeUnlistedClasses: false 
    JTA datasource: jdbc/BitronixJTADataSource 
    Non JTA datasource: null 
    Transaction type: JTA 
    PU root URL: file:/C:/Users/ks922p/workspace_luna/drools-stream-a/target/classes/ 
    Shared Cache Mode: null 
    Validation Mode: null 
    Jar files URLs [] 
    Managed classes names [ 
     org.drools.persistence.info.SessionInfo 
     org.drools.persistence.info.WorkItemInfo] 
    Mapping files names [] 
    Properties [ 
     hibernate.max_fetch_depth: 3 
     hibernate.transaction.manager_lookup_class: org.hibernate.transaction.BTMTransactionManagerLookup 
     hibernate.dialect: org.hibernate.dialect.H2Dialect 
     hibernate.show_sql: true 
     hibernate.hbm2ddl.auto: update] 
245 [main] DEBUG org.hibernate.integrator.internal.IntegratorServiceImpl - Adding Integrator [org.hibernate.cfg.beanvalidation.BeanValidationIntegrator]. 
246 [main] DEBUG org.hibernate.integrator.internal.IntegratorServiceImpl - Adding Integrator [org.hibernate.secure.spi.JaccIntegrator]. 
248 [main] DEBUG org.hibernate.integrator.internal.IntegratorServiceImpl - Adding Integrator [org.hibernate.cache.internal.CollectionCacheInvalidator]. 
248 [main] DEBUG org.hibernate.integrator.internal.IntegratorServiceImpl - Adding Integrator [org.hibernate.jpa.event.spi.JpaIntegrator]. 
8266 [main] DEBUG bitronix.tm.BitronixTransaction - executing synchronization a DeferredReleaseSynchronization of a JdbcPooledConnection from datasource jdbc/BitronixJTADataSource in state NOT_ACCESSIBLE with usage count 0 wrapping xads1: conn2: url=jdbc:h2:file:./sql/mytest user=SA with status=ROLLEDBACK 
8266 [main] DEBUG bitronix.tm.resource.common.DeferredReleaseSynchronization - DeferredReleaseSynchronization requeuing a JdbcPooledConnection from datasource jdbc/BitronixJTADataSource in state NOT_ACCESSIBLE with usage count 0 wrapping xads1: conn2: url=jdbc:h2:file:./sql/mytest user=SA 
8266 [main] DEBUG bitronix.tm.resource.common.AbstractXAStatefulHolder - notifying 2 stateChangeEventListener(s) about state changing from NOT_ACCESSIBLE to IN_POOL in a JdbcPooledConnection from datasource jdbc/BitronixJTADataSource in state NOT_ACCESSIBLE with usage count 0 wrapping xads1: conn2: url=jdbc:h2:file:./sql/mytest user=SA 
8266 [main] DEBUG bitronix.tm.resource.jdbc.JdbcPooledConnection - closing 0 dangling uncached statement(s) 
8266 [main] DEBUG bitronix.tm.resource.jdbc.JdbcPooledConnection - clearing warnings of conn3: url=jdbc:h2:file:./sql/mytest user=SA 
8266 [main] DEBUG bitronix.tm.resource.common.AbstractXAStatefulHolder - state changing from NOT_ACCESSIBLE to IN_POOL in a JdbcPooledConnection from datasource jdbc/BitronixJTADataSource in state NOT_ACCESSIBLE with usage count 0 wrapping xads1: conn2: url=jdbc:h2:file:./sql/mytest user=SA 
8266 [main] DEBUG bitronix.tm.resource.common.AbstractXAStatefulHolder - notifying 2 stateChangeEventListener(s) about state changed from NOT_ACCESSIBLE to IN_POOL in a JdbcPooledConnection from datasource jdbc/BitronixJTADataSource in state IN_POOL with usage count 0 wrapping xads1: conn2: url=jdbc:h2:file:./sql/mytest user=SA 
8266 [main] DEBUG bitronix.tm.resource.jdbc.JdbcPooledConnection - requeued JDBC connection of a PoolingDataSource containing an XAPool of resource jdbc/BitronixJTADataSource with 2 connection(s) (1 still available) 
8266 [main] DEBUG bitronix.tm.resource.common.XAPool - a connection's state changed to IN_POOL, notifying a thread eventually waiting for a connection 
8266 [main] DEBUG bitronix.tm.resource.common.DeferredReleaseSynchronization - DeferredReleaseSynchronization requeued a JdbcPooledConnection from datasource jdbc/BitronixJTADataSource in state IN_POOL with usage count 0 wrapping xads1: conn2: url=jdbc:h2:file:./sql/mytest user=SA 
8267 [main] WARN org.drools.persistence.jta.JtaTransactionManager - Unable to commit transaction 
bitronix.tm.internal.BitronixRollbackException: RuntimeException thrown during beforeCompletion cycle caused transaction rollback 
    at bitronix.tm.BitronixTransaction.commit(BitronixTransaction.java:241) 
    at bitronix.tm.BitronixTransactionManager.commit(BitronixTransactionManager.java:143) 
    at org.drools.persistence.jta.JtaTransactionManager.commit(JtaTransactionManager.java:236) 
    at org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:185) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422) 
    at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:143) 
    at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.loadKieSession(KnowledgeStoreServiceImpl.java:111) 
    at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.loadKieSession(KnowledgeStoreServiceImpl.java:39) 
    at com.mytest.stream.DroolsTest.demoReloadFailure(DroolsTest.java:52) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:497) 
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) 
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) 
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) 
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) 
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) 
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) 
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) 
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) 
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) 
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) 
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) 
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) 
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309) 
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) 
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) 
Caused by: java.lang.NullPointerException 
    at org.drools.core.reteoo.ObjectTypeNode$ExpireJobContextTimerOutputMarshaller.serialize(ObjectTypeNode.java:618) 
    at org.drools.core.marshalling.impl.ProtobufOutputMarshaller.writeTimers(ProtobufOutputMarshaller.java:882) 
    at org.drools.core.marshalling.impl.ProtobufOutputMarshaller.serializeSession(ProtobufOutputMarshaller.java:214) 
    at org.drools.core.marshalling.impl.ProtobufOutputMarshaller.writeSession(ProtobufOutputMarshaller.java:120) 
    at org.drools.core.marshalling.impl.ProtobufMarshaller.marshall(ProtobufMarshaller.java:154) 
    at org.drools.core.marshalling.impl.ProtobufMarshaller.marshall(ProtobufMarshaller.java:138) 
    at org.drools.persistence.SessionMarshallingHelper.getSnapshot(SessionMarshallingHelper.java:79) 
    at org.drools.persistence.info.SessionInfo.transform(SessionInfo.java:96) 
    at org.drools.persistence.TriggerUpdateTransactionSynchronization.beforeCompletion(TriggerUpdateTransactionSynchronization.java:57) 
    at org.drools.persistence.jta.JtaTransactionSynchronizationAdapter.beforeCompletion(JtaTransactionSynchronizationAdapter.java:54) 
    at bitronix.tm.BitronixTransaction.fireBeforeCompletionEvent(BitronixTransaction.java:532) 
    at bitronix.tm.BitronixTransaction.commit(BitronixTransaction.java:235) 
    ... 34 more 
8268 [main] WARN org.drools.persistence.SingleSessionCommandService - Could not commit session 
java.lang.RuntimeException: Unable to commit transaction 
    at org.drools.persistence.jta.JtaTransactionManager.commit(JtaTransactionManager.java:239) 
    at org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:185) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422) 
    at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:143) 
    at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.loadKieSession(KnowledgeStoreServiceImpl.java:111) 
    at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.loadKieSession(KnowledgeStoreServiceImpl.java:39) 
    at com.mytest.stream.DroolsTest.demoReloadFailure(DroolsTest.java:52) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:497) 
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) 
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) 
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) 
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) 
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) 
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) 
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) 
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) 
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) 
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) 
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) 
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) 
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309) 
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) 
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) 
Caused by: bitronix.tm.internal.BitronixRollbackException: RuntimeException thrown during beforeCompletion cycle caused transaction rollback 
    at bitronix.tm.BitronixTransaction.commit(BitronixTransaction.java:241) 
    at bitronix.tm.BitronixTransactionManager.commit(BitronixTransactionManager.java:143) 
    at org.drools.persistence.jta.JtaTransactionManager.commit(JtaTransactionManager.java:236) 
    ... 32 more 
Caused by: java.lang.NullPointerException 
    at org.drools.core.reteoo.ObjectTypeNode$ExpireJobContextTimerOutputMarshaller.serialize(ObjectTypeNode.java:618) 
    at org.drools.core.marshalling.impl.ProtobufOutputMarshaller.writeTimers(ProtobufOutputMarshaller.java:882) 
    at org.drools.core.marshalling.impl.ProtobufOutputMarshaller.serializeSession(ProtobufOutputMarshaller.java:214) 
    at org.drools.core.marshalling.impl.ProtobufOutputMarshaller.writeSession(ProtobufOutputMarshaller.java:120) 
    at org.drools.core.marshalling.impl.ProtobufMarshaller.marshall(ProtobufMarshaller.java:154) 
    at org.drools.core.marshalling.impl.ProtobufMarshaller.marshall(ProtobufMarshaller.java:138) 
    at org.drools.persistence.SessionMarshallingHelper.getSnapshot(SessionMarshallingHelper.java:79) 
    at org.drools.persistence.info.SessionInfo.transform(SessionInfo.java:96) 
    at org.drools.persistence.TriggerUpdateTransactionSynchronization.beforeCompletion(TriggerUpdateTransactionSynchronization.java:57) 
    at org.drools.persistence.jta.JtaTransactionSynchronizationAdapter.beforeCompletion(JtaTransactionSynchronizationAdapter.java:54) 
    at bitronix.tm.BitronixTransaction.fireBeforeCompletionEvent(BitronixTransaction.java:532) 
    at bitronix.tm.BitronixTransaction.commit(BitronixTransaction.java:235) 
    ... 34 more 
Wed Apr 20 16:56:06 EDT 2016 demoReloadFailure: Caught Exception, message=java.lang.reflect.InvocationTargetException 
+0

聽起來像一個bug給我。你可能想在6.4中試試這個,如果它仍然失敗,我會提交一個錯誤報告。 –

+0

@Esteban:謝謝你的提示;將嘗試 – noobie

+0

@EstebanAliverti請檢查我的論點 - 我無法對齊「fireAllRules」,STREAM和會話重新加載。 – laune

回答

0

我們在STREAM模式下運行的會話已設置(),然後再拉出的帽子!我認爲已經完成的會議已經結束,已經死亡並且被埋沒了:所有的資源都已經被放棄了。

另外,我想知道你打算如何觸發一個事件處理會話,使用fireAllRules實時時鐘運行,這個會話不允許超時到期。 fireUntilHalt將用於事件處理。另外,「掛在冰上」的等待超時會引起對Drools應用程序的邏輯一致性的嚴重懷疑。如果計時器在會話休眠期間到期,應撤消事實和/或應觸發規則,這應觸發其他事實,等等。通常,這種行爲取決於「按時」或「及時」完成,而不是在冰融化時完成。

+0

感謝您的反饋!我堅持會話,所以儘管我做了「處置」,但我可以用它的ID檢索會話(事實上,Exceptions似乎是間歇性的,有時我實際上可以成功地重新加載持久會話)。另外,當我在CLOUD模式下運行時,我總是可以執行「dispose」,然後重新加載持久會話。 – noobie

+0

不知道fireAllRules()與定時器到期時間不兼容。謝謝(你的)信息!我們想使用持久性API,我們的理解是會話持久性與fireUntilHalt()不兼容。這是正確的,還是我們錯了? – noobie

+0

關於定時器到期時「冰融化」時,處理會話崩潰時仍然處於活動狀態的定時器的推薦過程是什麼(這就是我們試圖用「dispose」和重載序列來模擬的:崩潰持久會話及其後續重載)?再次感謝feedack,laune。 – noobie

相關問題