[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, 7 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, 7 months
[JBoss JIRA] Resolved: (JBRULES-2273) setting the Conflictresolver when you get a KnowledgeBase using KnowledgeAgent
by Mark Proctor (JIRA)
[ https://issues.jboss.org/browse/JBRULES-2273?page=com.atlassian.jira.plug... ]
Mark Proctor resolved JBRULES-2273.
-----------------------------------
Resolution: Rejected
> setting the Conflictresolver when you get a KnowledgeBase using KnowledgeAgent
> ------------------------------------------------------------------------------
>
> Key: JBRULES-2273
> URL: https://issues.jboss.org/browse/JBRULES-2273
> Project: Drools
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Components: drools-core (expert)
> Affects Versions: 5.0.1.FINAL
> Reporter: Edgardo Carena
> Assignee: Mark Proctor
> Priority: Critical
> Labels: agent, conflict, resolver
>
> a feature or at least a work-around to set a specific ConflictResolver when you set up a KnowledgeBase using the KnowledgeAgentFactory and a ResourceFactory.
> Currently your apidocs (http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/apidocs/org/droo...) state:
> "The follow properties have not yet been migrated from the Drools 4.0 api:
> * drools.executorService = <qualified class name>
> * drools.conflictResolver = <qualified class name>
> * drools.ruleBaseUpdateHandler = <qualified class name>"
> The only known work-around is to set up a RuleBaseConfiguration in this way:
> conf = new RuleBaseConfiguration();
> conf.setConflictResolver(new FifoConflictResolver());
> and then use it to get a KnowledgeBase using KnowledgeBaseFactory.newKnowledgeBase(conf), however this cannot be applied when you are using the KnowledgeAgentFactory.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 7 months
[JBoss JIRA] Created: (JBRULES-2968) mistake in determining the type of an eval expression
by Wolfgang Laun (JIRA)
mistake in determining the type of an eval expression
-------------------------------------------------------
Key: JBRULES-2968
URL: https://issues.jboss.org/browse/JBRULES-2968
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-compiler (expert)
Affects Versions: 3.0.1
Reporter: Wolfgang Laun
Assignee: Mark Proctor
Priority: Blocker
This rule compiled correctly a few weeks ago where MyDate contains the int field "year":
rule "Day in leap year"
when
$d: MyDate( $y: year, eval( $y % 4 == 0 && $y % 100 != 0 || $y % 400 == 0 ) )
then
System.out.println( $d.toString() + " is in a leap year" );
end
But now errors are reported:
Unable to build expression for 'inline-eval' : [Error: was expecting type: java.lang.Boolean; but found type: java.lang.Integer]
[Near : {... $y % 4 == 0 && $y % 100 != 0 || $y % 400 == 0 ....}]
^
[Line: 1, Column: 46]' $y % 4 == 0 && $y % 100 != 0 || $y % 400 == 0 '
[Error: was expecting type: java.lang.Boolean; but found type: java.lang.Integer]
[Near : {... $y % 4 == 0 && $y % 100 != 0 || $y % 400 == 0 ....}]
^
[Line: 1, Column: 46] : [Rule name='Day in leap year']
[Error: was expecting type: java.lang.Boolean; but found type: java.lang.Integer]
[Near : {... $y % 4 == 0 && $y % 100
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 7 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, 7 months
[JBoss JIRA] Created: (JBRULES-2952) JavaParser fails with JDK 1.5
by bodi bajk (JIRA)
JavaParser fails with JDK 1.5
-----------------------------
Key: JBRULES-2952
URL: https://issues.jboss.org/browse/JBRULES-2952
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-compiler
Reporter: bodi bajk
Assignee: Mark Proctor
Priority: Blocker
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'knowledgeBase': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: java.util.LinkedList.peekLast()Ljava/lang/Object;
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
... 57 more
Caused by: java.lang.NoSuchMethodError: java.util.LinkedList.peekLast()Ljava/lang/Object;
at org.drools.rule.builder.dialect.java.parser.JavaParser.addBlockDescr(JavaParser.java:249)
at org.drools.rule.builder.dialect.java.parser.JavaParser.pushContainerBlockDescr(JavaParser.java:254)
at org.drools.rule.builder.dialect.java.parser.JavaParser.ifStatement(JavaParser.java:6263)
at org.drools.rule.builder.dialect.java.parser.JavaParser.statement(JavaParser.java:5918)
at org.drools.rule.builder.dialect.java.parser.JavaParser.blockStatement(JavaParser.java:5733)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 7 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, 7 months