So, you have multiple CSVBeanAgent&#39;s (created from a text file somewhere). These are stored in a Map created in Java called &quot;globals&quot;.<br><br>Where do you actually set the global in WorkingMemory: See <a href="http://docs.jboss.org/drools/release/5.4.0.Final/drools-expert-docs/html/ch04.html#d0e4482">http://docs.jboss.org/drools/release/5.4.0.Final/drools-expert-docs/html/ch04.html#d0e4482</a>.<br>
<br>Furthermore, the Global will be of type Map not CSVBeanAgent, unless you want a Global for each CSVBeanAgent - but then how do you decide which you need.<br><br>Personally, I&#39;d go back to inserting CSVBeanAgents as Facts and tackle the Java Heap Space issue... there are definitely things you are not telling us.<br>
<br>With kind regards,<br><br>Mike<br><br><div class="gmail_quote">On 26 July 2012 10:37, zeeshan <span dir="ltr">&lt;<a href="mailto:zeeshan.spring@gmail.com" target="_blank">zeeshan.spring@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">Hi Mike !<br>
<br>
Earlier I tried it inserting as a Fact in using Statefull Session in my<br>
RuleMain.java but was facing Java Heap Space error.......so I tried<br>
Declaring as a Global in RuleMain.java like this----<br>
<br>
<br>
HashMap&lt;String, Object&gt; globals = new HashMap&lt;String, Object&gt;();<br>
<br>
StatefulSession statefulSession=new<br>
RuleRunner().getStatefulSession(RULES_FILES8,null,null, globals, null);<br>
...<br>
....<br>
<br>
<br>
//local block for Agent<br>
                {<br>
                        System.out.println(&quot;agent block&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&quot;);<br>
                        String csvPath=&quot;C:/Users/new_user/Desktop/CIMS/ABAgent.csv&quot;;<br>
                          try{<br>
                        File f = new File(csvPath);<br>
                        InputStream is = new FileInputStream( f );<br>
                        Reader rdr = new InputStreamReader( is );<br>
                        LineNumberReader lnrdr = new LineNumberReader( rdr );<br>
<br>
                        String line;<br>
                        while( (line = lnrdr.readLine()) != null ){<br>
                            if( line.charAt(0) == &#39;&quot;&#39; ) continue;<br>
                            String[] tokens = line.split( &quot;;&quot; );<br>
                            if( tokens.length != 3 ) continue;<br>
<br>
                            int agentId = Integer.parseInt( tokens[0] );<br>
                            int agentNo  = Integer.parseInt( tokens[1] );<br>
                            String agentStatus = tokens[2];<br>
                           /* System.out.println(&quot;1&gt;&gt;&quot;+agentId);<br>
                            System.out.println(&quot;2&gt;&gt;&quot;+agentNo);<br>
                            System.out.println(&quot;3&gt;&gt;&quot;+agentStatus);*/<br>
<br>
                            CSVBeanAgent csvAg = new CSVBeanAgent();<br>
                            csvAg.setAgentId(agentId);<br>
                            csvAg.setAgentNo(agentNo);<br>
                            csvAg.setAgentStatus(agentStatus);<br>
<br>
                         //statefulSession.insert(csvAg);<br>
<br>
                            *globals.put(csvAg.getAgentId()+&quot;&quot;, csvAg);*<br>
<br>
                        }<br>
<br>
                          }catch (Exception e) {<br>
                                        System.out.println(e);<br>
                                }<br>
        }<br>
<br>
<br>
<br>
<br>
System.out.println(&quot;fire all rule&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&quot;);<br>
<br>
<br>
                statefulSession.fireAllRules();<br>
                //statefulSession2.fireAllRules();<br>
<br>
<br>
<br>
                log.debug(&quot;============ End Firing Rules =========&quot;);<br>
<br>
                // Close the session<br>
                 statefulSession.dispose();<br>
}<br>
}<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Using-global-variable-in-DRL-file-tp4018911p4018915.html" target="_blank">http://drools.46999.n3.nabble.com/Using-global-variable-in-DRL-file-tp4018911p4018915.html</a><br>

<div class="HOEnZb"><div class="h5">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">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></blockquote></div><br>