<br> Drools tries to create the ShadowProxy. The reason is that it does not know about the implementation... it just knows it is a Map and as so, it must be shadowed. Problem is that SingletonMap is either final or does not have a default constructor.<br>
My recommendation, besides opening a JIRA for this, is avoid inserting collections/maps directly as facts. The semantic for such facts is not clearly defined and it may cause undesired behavior.<br><br> []s<br> Edson<br>
<br><div><span class="gmail_quote">2008/2/19, Godmar Back <<a href="mailto:godmar@gmail.com">godmar@gmail.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><br>usings Drools 4.0.4 and MVEL 1.4, this simple rule:<br>---<br>package test;<br><br>import java.util.Collections;<br><br>dialect "mvel"<br><br>rule "Rule #1"<br>when<br>then<br> insert(Collections.singletonMap("content", "hello"));<br>
end<br>--<br><br>produces:<br>java.lang.IllegalAccessError: class<br>org.drools.shadow.java.util.Collections$SingletonMapShadowProxy cannot<br>access its superclass java.util.Collections$SingletonMap<br> at java.lang.ClassLoader.defineClass1(Native Method)<br>
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)<br> at org.drools.rule.MapBackedClassLoader.fastFindClass(MapBackedClassLoader.java:60)<br> at org.drools.rule.MapBackedClassLoader.loadClass(MapBackedClassLoader.java:79)<br>
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)<br> at org.drools.reteoo.Rete$ClassObjectTypeConf.loadOrGenerateProxy(Rete.java:547)<br> at org.drools.reteoo.Rete$ClassObjectTypeConf.defineShadowProxyData(Rete.java:494)<br>
at org.drools.reteoo.Rete$ClassObjectTypeConf.<init>(Rete.java:461)<br> at org.drools.reteoo.Rete.assertObject(Rete.java:152)<br> at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)<br>
at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)<br> at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:909)<br> at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:881)<br>
at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:67)<br> at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:61)<br><br><br>It's not clear to me why Drools creates Proxies for such classes as<br>
java.util.Collections, or does MVEL do it?<br><br> - Godmar<br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br>
Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>