Hello,<br><br>I&#39;ve been trying out the Spring integration package in Drools 5.1.1 and it works really well, but I have run into one issue I can&#39;t figure out.<br><br>I&#39;ve defined 2 knowledge sessions from the same knowledge base in the app context - one stateless, one stateful but otherwise identical. They both refer to a collaborator defined as a bean in the app context which is to be used as a global in my rules. This is just an excerpt of my full Spring context, the kbase definition itself is not an issue.<br>
<br>&lt;bean id=&quot;applicantDao&quot; class=&quot;com.acme.app.dao.impl.ApplicantDaoImpl&quot; /&gt;<br><br>&lt;drools:ksession id=&quot;statelessKSession&quot; type=&quot;stateless&quot; name=&quot;statelessKSession&quot; kbase=&quot;kbase&quot;&gt;<br>
      &lt;drools:script&gt;<br>          &lt;drools:set-global identifier=&quot;applicantDao&quot; ref=&quot;applicantDao&quot; /&gt;<br>      &lt;/drools:script&gt;<br>  &lt;/drools:ksession&gt;<br>  <br>   &lt;drools:ksession id=&quot;statefulKSession&quot; type=&quot;stateful&quot; name=&quot;statefulKSession&quot; kbase=&quot;kbase&quot;&gt;<br>
      &lt;drools:script&gt;<br>          &lt;drools:set-global identifier=&quot;applicantDao&quot; ref=&quot;applicantDao&quot; /&gt;<br>      &lt;/drools:script&gt;<br>  &lt;/drools:ksession&gt;<br><br>The issue is that this configuration works for the stateful but not the stateless session, in the sense that the stateful session appears to have a valid reference to the applicantDao object in the Globals object but the stateless session doesn&#39;t.<br>
<br>@Test<br>public void testStatelessGlobal() {<br>        Globals globals = statelessKSession.getGlobals();<br>        Object global = globals.get(&quot;applicantDao&quot;);<br>        Assert.assertNotNull(global);<br> }<br>
    <br>@Test<br>public void testStatefulGlobal() {<br>        Globals globals = statefulKSession.getGlobals();<br>        Object global = globals.get(&quot;applicantDao&quot;);<br>        Assert.assertNotNull(global);<br>
}<br><br>The first test fails (the global variable is null) but the second passes. No errors are thrown by Drools during the setup of the Spring container.<br><br>What am I doing wrong? Should I be able to define globals in this way for stateless sessions? The XSD seems to indicate this is a valid configuration, but it just doesn&#39;t work.<br>
<br>Is anyone else working with the Spring integration that can point out my error here?<br><br>Many thanks, <br><br>Patrick<br>