<div dir="ltr">Is it a list that you would like to use as global param ? If this is the case, maybe change your rule &amp; code like that <div><br></div><div><div>        //GET A KSESSION</div><div>        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();</div>
<div><br></div><div>        //now create some test data</div><div>        ksession.insert( new Cheese( &quot;stilton&quot;,</div><div>                               42 ) );</div><div>        ksession.insert( new Person( &quot;michael&quot;,</div>
<div>                               &quot;stilton&quot;,</div><div>                               42 ) );</div><div>        final List&lt;String&gt; list = new ArrayList&lt;String&gt;();</div><div>        ksession.setGlobal( &quot;list&quot;,</div>
<div>                      list );</div><div><br></div><div>        ksession.fireAllRules();</div><div><br></div><div>        System.out.println(list);</div><div><br></div><div>        ksession.dispose();</div><div><br></div>
<div>Rule </div><div><br></div><div><div>template header</div><div>age</div><div>type</div><div>log</div><div><br></div><div>package org.drools.examples.templates;</div><div><br></div><div>global java.util.List list;</div>
<div><br></div><div>template &quot;cheesefans&quot;</div><div><br></div><div>rule &quot;Cheese fans_@{row.rowNumber}&quot;</div><div>    when</div><div>        Person(age == @{age})</div><div>        Cheese(type == &quot;@{type}&quot;)</div>
<div>    then</div><div>        list.add(&quot;@{log}&quot;);</div><div>end</div><div>end template</div></div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 20, 2014 at 4:40 PM, Ephemeris Lappis <span dir="ltr">&lt;<a href="mailto:ephemeris.lappis@gmail.com" target="_blank">ephemeris.lappis@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hello.</div><div><br></div><div>I have no such kind test with Pax Exam. Should you send me a simple maven project example using a Karaf container ?</div>
<div><br></div><div>Back to the problem, a very simple rule with something like that in the RHS always fails when deployed in a bundle whose class loader is the felix one :</div>
<div><br></div><div>List&lt;String&gt; l = new ArrayList&lt;&gt;();</div><div>that must be fixed with :</div><div>List&lt;String&gt; l = new ArrayList&lt;String&gt;();</div><div><br></div><div>or</div><div><br></div><div>

int n = 1_000;</div><div>that fails instead of :</div><div>int n = 1000;</div><div><br></div><div>FYI, I use ServiceMix 4.5.3.</div><div><br></div><div>Thanks again.</div><div>Regards.</div></div><div><br></div></div><div class="gmail_extra">

<br><br><div class="gmail_quote">2014-05-20 15:41 GMT+02:00 Charles Moulliard <span dir="ltr">&lt;<a href="mailto:ch007m@gmail.com" target="_blank">ch007m@gmail.com</a>&gt;</span>:<div><div class="h5"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr">A test case will be required to reproduce your problem. Do you have a pax-exam test ?</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 20, 2014 at 1:03 PM, Ephemeris Lappis <span dir="ltr">&lt;<a href="mailto:ephemeris.lappis@gmail.com" target="_blank">ephemeris.lappis@gmail.com</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello.<br>
<br>
Here is the first lines of the error message :<br>
<br>
<br>
14:58:57,457 | ERROR | tp1946301910-151 | AbstractKieModule                |<br>
239 - org.drools.compiler - 6.1.0.20140429-1643 | Unable to build<br>
KieBaseModel:MyKBase<br>
Rule Compilation error : [Rule name=&#39;Main Rule&#39;]<br>
        my/tests/drools/osgi/expert/rules/Rule_Main_Rule1409557233.java (8:649) :<br>
Incorrect number of arguments for type HashMap&lt;K,V&gt;; it cannot be<br>
parameterized with arguments &lt;?&gt;<br>
        my/tests/drools/osgi/expert/rules/Rule_Main_Rule1409557233.java (8:666) :<br>
Syntax error on token &quot;&lt;&quot;, ? expected after this token<br>
<br>
<br>
I have found the explanation and a workaround : put it all with a strict<br>
&quot;1.5&quot; syntax in the RHS ! In this current case, do not use &lt;&gt; to infere the<br>
generic type, but use the expected declared types instead.<br>
<br>
After a rather touchy remote debug of the ServiceMix runtime to inspect what<br>
is different from the Junit tests, I think that the problem comes from the<br>
classloader that is associated with the Kie container. Before compilation<br>
the language source and target level is  set with version 1.7 as expected,<br>
but in the nameEnvironment that is passed to the JavaCompiler (indeed, ecj<br>
compiler), the droolsClassloader is of type<br>
&quot;org/apache/felix/framework/ModuleImpl$ModuleClassLoaderJava5&quot;. As its name<br>
seems to incidate, I&#39;m afraid that the Karaf/Felix loader is originally<br>
built in 1.5.<br>
<br>
I&#39;ve read some posts about the eclipse compiler that perhaps takes into<br>
account the caller compliance to adapt its compilation language level.<br>
<br>
Class loaders seem to be a serious problem when using Drools in complex<br>
environment such as a OSGi one...<br>
<br>
Please, could you confirm my analysis, and, if you have one, propose any<br>
better solution ? I don&#39;t know, for example, if it&#39;s possible to influence<br>
Karaf to use different levels of bundle class loaders...<br>
<br>
Thanks a lot.<br>
<br>
Regards.<br>
<br>
<br><span><font color="#888888">
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Rules-compilation-error-with-OSGi-integration-6-1-0-Beta3-tp4029601p4029622.html" target="_blank">http://drools.46999.n3.nabble.com/Rules-compilation-error-with-OSGi-integration-6-1-0-Beta3-tp4029601p4029622.html</a><br>



<div><div>Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></font></span></blockquote></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><div>Charles Moulliard</div><div>Apache Committer / Architect @RedHat</div>
<div>Twitter : @cmoulliard | Blog : <a href="http://cmoulliard.github.io" target="_blank"> http://cmoulliard.github.io</a></div>
<div><br></div></div>
</font></span></div>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br></blockquote></div></div></div><br></div>
<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" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><div>
Charles Moulliard</div><div>Apache Committer / Architect @RedHat</div><div>Twitter : @cmoulliard | Blog : <a href="http://cmoulliard.github.io" target="_blank"> http://cmoulliard.github.io</a></div><div><br></div></div>
</div>