2016-04-20 86 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

相关问题