[JBoss JIRA] Created: (JBRULES-2788) NPE in AbstractWorkingMemory due to session.retract(null)
by Wolfgang Laun (JIRA)
NPE in AbstractWorkingMemory due to session.retract(null)
---------------------------------------------------------
Key: JBRULES-2788
URL: https://jira.jboss.org/browse/JBRULES-2788
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-core (expert)
Affects Versions: 5.1.1.FINAL
Reporter: Wolfgang Laun
Assignee: Mark Proctor
Fix For: 5.2.0.M1
StatefulKnowledgeSession kSession = ...;
kSession.retract( null );
Notice that this might occur if kSession.getFactHandle() returns null because the fact object
is invalid or already gone etc.
The above call causes
java.lang.NullPointerException
at org.drools.common.AbstractWorkingMemory.retract(AbstractWorkingMemory.java:1261)
at org.drools.common.AbstractWorkingMemory.retract(AbstractWorkingMemory.java:1242)
at org.drools.impl.StatefulKnowledgeSessionImpl.retract(StatefulKnowledgeSessionImpl.java:255)
at resource.Main.exec(Main.java:92)
Expected: This should be ignored, or throw an Exception with a reasonable diagnostic. (Javadoc does not say that an exception may be thrown.)
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 8 months
[JBoss JIRA] Created: (JBRULES-1925) ClassCastException problem with reading working memory using ObjectInputStream
by Przemyslaw Rozycki (JIRA)
ClassCastException problem with reading working memory using ObjectInputStream
------------------------------------------------------------------------------
Key: JBRULES-1925
URL: https://jira.jboss.org/jira/browse/JBRULES-1925
Project: JBoss Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 4.0.7
Environment: JDK 1.5.0_11
Reporter: Przemyslaw Rozycki
Assignee: Mark Proctor
I experienced the problem while reading WorkingMemory using ObjectInputStream.
Here is the code:
public class DroolsTest5 {
public static void main(String[] args) {
Properties props = new Properties();
props.setProperty("file", "<<place a path to any working DRL here>>");
RuleAgent ruleAgent = RuleAgent.newRuleAgent(props);
Fact fact1 = new Fact("a","b");
RuleBase ruleBase = ruleAgent.getRuleBase();
WorkingMemory baseWm = ruleBase.newStatefulSession(false);
baseWm.insert(fact1);
Iterator iter1 = baseWm.iterateObjects();
while (iter1.hasNext()) {
System.out.println(iter1.next());
}
System.out.println("=====");
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(baseWm);
oos.close();
byte[] buf = baos.toByteArray();
ByteArrayInputStream bais = new ByteArrayInputStream(buf);
ObjectInputStream ois = new ObjectInputStream(bais);
WorkingMemory wm = (WorkingMemory) ois.readObject();
Iterator iter2 = wm.iterateObjects();
while (iter2.hasNext()) {
System.out.println(iter2.next());
}
System.out.println("=====");
} catch (Exception e) {
e.printStackTrace();
}
}
public static class Fact implements Serializable {
String name;
String id;
public Fact(String _name, String _id) {
name = _name;
id = _id;
}
public String getId() {
return id;
}
public String getName() {
return name;
}
@Override
public String toString() {
return "Name: " + name + ", Id: " + id;
}
}
}
And here is an exception I get:
java.lang.ClassCastException: java.io.ObjectInputStream
at org.drools.reteoo.Rete$ClassObjectTypeConf.readObject(Rete.java:605)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:946)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1809)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1634)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at org.drools.util.AbstractHashTable.readExternal(AbstractHashTable.java:66)
at org.drools.util.ObjectHashMap.readExternal(ObjectHashMap.java:41)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1755)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1717)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1634)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1634)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at com.sample.DroolsTest5.main(DroolsTest5.java:52)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 8 months
[JBoss JIRA] Created: (JBRULES-1996) NPE when using directory scanner and drl is incorrect.
by Przemyslaw Rozycki (JIRA)
NPE when using directory scanner and drl is incorrect.
------------------------------------------------------
Key: JBRULES-1996
URL: https://jira.jboss.org/jira/browse/JBRULES-1996
Project: JBoss Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-core
Affects Versions: 4.0.7
Environment: Sun JDK 1.5.0_11, Kubuntu Linux 8.10, x86, 32-bit
Reporter: Przemyslaw Rozycki
Assignee: Mark Proctor
When I use rule agent with directory scanner, and the rule that is being scanned contains a bug, then I receive a NPE instead of error message:
java.lang.NullPointerException
at org.drools.agent.FileScanner.readPackage(FileScanner.java:102)
at org.drools.agent.FileScanner.getChangeSet(FileScanner.java:79)
at org.drools.agent.FileScanner.loadPackageChanges(FileScanner.java:57)
at org.drools.agent.DirectoryScanner.loadPackageChanges(DirectoryScanner.java:43)
at org.drools.agent.RuleAgent.checkForChanges(RuleAgent.java:330)
at org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:298)
at org.drools.agent.RuleAgent.configure(RuleAgent.java:284)
at org.drools.agent.RuleAgent.init(RuleAgent.java:208)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:176)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:164)
... (further entries of stack trace contains my application's lines)
When I looked into code I found that DirectoryScanner object, used by the agent uses FileScanner object to scan each file in a directory. And the file scanner does not have a listener set. That's why the NPE is thrown.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 8 months
[JBoss JIRA] Created: (JBRULES-2729) NullPointerException from CompositeMaxDurationTimer.createTrigger
by Will Lauer (JIRA)
NullPointerException from CompositeMaxDurationTimer.createTrigger
-----------------------------------------------------------------
Key: JBRULES-2729
URL: https://jira.jboss.org/browse/JBRULES-2729
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-compiler
Affects Versions: 5.1.1.FINAL
Environment: Windows XP SP3, Java 1.6.0_21, Drools Fusion 5.1.1
Reporter: Will Lauer
Assignee: Mark Proctor
The timer field of CompositeMaxDurationTimer appears to be not getting populated correctly when certain types of rules are created in Drools Fusion. This results in subsequent calls to CompositeMaxDurationTimer.createTimer to reference a null pointer during execution. While the error triggers during fact insertion in Drools Fusion, it appears to be due to an incomplete timer definition during rules compilation.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 8 months
[JBoss JIRA] Created: (JBRULES-2488) Wrong type for NodeInstanceLog and ProcessInstanceLog feild "id"
by Sameeh Harfoush (JIRA)
Wrong type for NodeInstanceLog and ProcessInstanceLog feild "id"
----------------------------------------------------------------
Key: JBRULES-2488
URL: https://jira.jboss.org/jira/browse/JBRULES-2488
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-core
Affects Versions: 5.1.0.M1
Environment: Drools history persistence on MySQL
Reporter: Sameeh Harfoush
Assignee: Mark Proctor
Priority: Blocker
i am using drools-bam to persist the history to MySQL DB with the below configuration
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/drools</property>
<property name="connection.username">root</property>
<property name="connection.password">JAVA</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create</property>
and with the following hibernate mapping file:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="org.drools.process.audit.ProcessInstanceLog" >
<id name="id" >
<generator class="native"/>
</id>
<property name="processInstanceId"/>
<property name="processId"/>
<property name="start" type="timestamp" column="START_DATE"/>
<property name="end" type="timestamp" column="END_DATE"/>
</class>
<class name="org.drools.process.audit.NodeInstanceLog" >
<id name="id">
<generator class="native"/>
</id>
<property name="type"/>
<property name="nodeInstanceId"/>
<property name="nodeId"/>
<property name="processInstanceId"/>
<property name="processId"/>
<property name="date" type="timestamp" column="DATE"/>
</class>
</hibernate-mapping>
<mapping resource="DroolsAuditLog.hbm.xml" />
</session-factory>
</hibernate-configuration>
when i run mu unit test i get the following logging
INFO: Running hbm2ddl schema export
Apr 16, 2010 3:45:36 PM org.hibernate.tool.hbm2ddl.SchemaExport execute
INFO: exporting generated schema to database
Apr 16, 2010 3:45:37 PM org.hibernate.tool.hbm2ddl.SchemaExport create
SEVERE: Unsuccessful: create table NodeInstanceLog (id varchar(255) not null auto_increment, type integer, nodeInstanceId varchar(255), nodeId varchar(255), processInstanceId bigint, processId varchar(255), DATE datetime, primary key (id))
Apr 16, 2010 3:45:37 PM org.hibernate.tool.hbm2ddl.SchemaExport create
SEVERE: Incorrect column specifier for column 'id'
Apr 16, 2010 3:45:37 PM org.hibernate.tool.hbm2ddl.SchemaExport create
SEVERE: Unsuccessful: create table ProcessInstanceLog (id varchar(255) not null auto_increment, processInstanceId bigint, processId varchar(255), START_DATE datetime, END_DATE datetime, primary key (id))
Apr 16, 2010 3:45:37 PM org.hibernate.tool.hbm2ddl.SchemaExport create
SEVERE: Incorrect column specifier for column 'id'
Apr 16, 2010 3:45:37 PM org.hibernate.tool.hbm2ddl.SchemaExport execute
INFO: schema export complete
the id is set to varchar with auto increment...this doesn't work for MySQL
and after changing the "id" column type in hibernate-mapping to
<id name="id" type="integer">
<generator class="native"/>
</id>
i get the following error
SEVERE: expected type: java.lang.String, actual value: java.lang.Integer
i checked org.drools.process.audit.ProcessInstanceLog and org.drools.process.audit.NodeInstanceLog i realized that the id feils type is set to String which is causing a problem
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 8 months