<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 14/04/2010 19:27, Wouter Van Isterdael wrote:
<blockquote
 cite="mid:x2sb41304ad1004141127q5ae4950ah85b5f0303fb20c25@mail.gmail.com"
 type="cite">I still seem to be having problems getting it working. The
problem did not go away.<br>
  <br>
I still get the same error. Would anyone know of a simple step-by-step
tutorial for using Drools in a Felix OSGi environment? Preferrably
within Eclipse and with Pax Runner.<br>
  <br>
Any help would be very much appreciated.<br>
</blockquote>
Try using the dependencies provided in OSGi bundles:<br>
<a class="moz-txt-link-freetext" href="https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/">https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/</a><br>
<br>
And follow this unit test for examples:<br>
<a class="moz-txt-link-freetext" href="http://fisheye.jboss.org/browse/JBossRules/trunk/osgi-bundles/org.drools.osgi.test/src/test/java/org/drools/osgi/integrationtests/SimpleOsgiTest.java?r=31755">http://fisheye.jboss.org/browse/JBossRules/trunk/osgi-bundles/org.drools.osgi.test/src/test/java/org/drools/osgi/integrationtests/SimpleOsgiTest.java?r=31755</a><br>
<br>
Mark<br>
<br>
<br>
<blockquote
 cite="mid:x2sb41304ad1004141127q5ae4950ah85b5f0303fb20c25@mail.gmail.com"
 type="cite"><br>
Thank you for your time!<br>
  <br>
Kind regards<br>
  <br>
Aerv<br>
  <br>
  <div class="gmail_quote">2010/4/6 AervTerrh <span dir="ltr">&lt;<a
 moz-do-not-send="true" href="mailto:woutervanisterdael@gmail.com">woutervanisterdael@gmail.com</a>&gt;</span><br>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
    <div class="im">Thanks for the reply. I will try this tomorrow and
keep you posted!<br>
    <br>
    </div>
    <div class="gmail_quote">2010/4/5 Jason Davidson [via Drools - Java
Rules Engine] <span dir="ltr">&lt;<a moz-do-not-send="true"
 href="http://n3.nabble.com/user/SendEmail.jtp?type=node&amp;node=698969&amp;i=0"
 rel="nofollow" target="_blank">[hidden email]</a>&gt;</span><br>
    <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
      <div class="im">
      <div>I don't know if this helps, but I had to turn the MVEL JIT
compiler off in the Equinox OSGi container:<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; OptimizerFactory.setDefaultOptimizer("reflective");<br>
      <br>
Also, we used pre-compiled packages instead of compiling the DRL files
at runtime.&nbsp; For example:<br>
      <br>
....<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; RuleBaseConfiguration ruleBaseConfig = new
RuleBaseConfiguration();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
ruleBaseConfig.setClassLoader(this.getClass().getClassLoader());&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //MVEL in OSGi is a complete CF - this turns off the MVEL
JIT - potential resource hog but that's the nature of OSGi classloading<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //and Drools...<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; OptimizerFactory.setDefaultOptimizer("reflective");<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; RuleBase ruleBase =
RuleBaseFactory.newRuleBase(ruleBaseConfig);&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; InputStream pkgIs =
this.getClass().getResourceAsStream("/com/cjs/hazel/rules/com.cjs.hazel.rules.pkg");<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; addPackage(ruleBase,pkgIs);<br>
.....<br>
      <br>
      </div>
      </div>
      <div class="gmail_quote">
      <div>
      <div class="h5">
      <div>
      <div>On Fri, Apr 2, 2010 at 4:42 PM, AervTerrh <span dir="ltr">&lt;<a
 moz-do-not-send="true"
 href="http://n3.nabble.com/user/SendEmail.jtp?type=node&amp;node=698731&amp;i=0"
 rel="nofollow" link="external" target="_blank">[hidden email]</a>&gt;</span>
wrote:<br>
      </div>
      </div>
      </div>
      </div>
      <blockquote class="gmail_quote"
 style="border-left: 2px solid rgb(204, 204, 204); padding: 0pt 1em;">
        <div>
        <div class="h5">
        <div>
        <div><br>
Hey,<br>
        <br>
Okay. I know this problem can be found all over. But I can't seem to
figure<br>
out a solution to it. Somehow I must be doing something wrong. I've
created<br>
a simple application that evaluates some rules and changes some objects<br>
based on that. Everything worked fine, not a single problem there. All<br>
libraries could be easily found etc.<br>
        <br>
Now I wanted to convert this to a Felix OSGi bundle.<br>
        <br>
So, what I did, was creating a bundle (new plugin project based on
existing<br>
jars) with the drools jars (core, compiler, api, jsr) and tried the next<br>
code in the RuleEngine class:<br>
        <br>
Properties props = new Properties();<br>
props.setProperty("drools.dialect.java.compiler", "JANINO");<br>
KnowledgeBuilderConfiguration config =<br>
KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(props, null);<br>
(here's where it fails)<br>
KnowledgeBuilder kbuilder =<br>
KnowledgeBuilderFactory.newKnowledgeBuilder(config);<br>
kbuilder.add(ResourceFactory.newClassPathResource(fileName,<br>
RuleEngine.class), ResourceType.DRL);<br>
        <br>
This is pretty much the loading of the rule file. The RuleEngine is
started<br>
in an Activator. The file is found and everything. But I keep getting
the<br>
same error when starting the bundle.<br>
        <br>
org.drools.RuntimeDroolsException: Unable to load dialect<br>
'org.drools.rule.builder.dialect.mvel.MVELDialectConfigurati
on:mvel:null'<br>
at org.drools.compiler.PackageBuilderConfiguration.addDialect(P<br>
ackageBuilderConfiguration.java:274)<br>
at org.drools.compiler.PackageBuilderConfiguration.buildDialect<br>
ConfigurationMap(PackageBuilderConfiguration.java:259)<br>
at org.drools.compiler.PackageBuilderConfiguration.init(Package<br>
BuilderConfiguration.java:176)<br>
at<br>
org.drools.compiler.PackageBuilderConfiguration.&lt;init&gt;(PackageBuilderConfiguration.java:148)<br>
at org.drools.builder.impl.KnowledgeBuilderProviderImpl.newKnow<br>
ledgeBuilderConfiguration(KnowledgeBuilderProviderImpl.java: 21)<br>
at org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuild<br>
erConfiguration(KnowledgeBuilderFactory.java:68)<br>
at test.Activator$RuleCreator.createRule(Activator.java:52)<br>
at test.Activator.start(Activator.java:32)<br>
at org.apache.felix.framework.util.SecureAction.startActivator(<br>
SecureAction.java:639)<br>
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1 700)<br>
at org.apache.felix.framework.Felix.startBundle(Felix.java:1622 )<br>
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.j
ava:1077)<br>
at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl
.java:264)<br>
at java.lang.Thread.run(Unknown Source)<br>
Caused by: java.lang.ClassNotFoundException:<br>
org.drools.rule.builder.dialect.mvel.MVELDialectConfiguratio n<br>
at java.net.URLClassLoader$1.run(Unknown Source)<br>
        <br>
        <br>
The packages I import in the manifest:<br>
Import-Package: org.codehaus.janino;version="2.4.3",<br>
org.drools,<br>
org.drools.builder,<br>
org.drools.compiler,<br>
        <a moz-do-not-send="true" href="http://org.drools.io"
 rel="nofollow" link="external" target="_blank">org.drools.io</a>,<br>
org.drools.rule,<br>
org.drools.rule.builder.dialect.java,<br>
org.drools.rule.builder.dialect.mvel,<br>
org.osgi.framework;version="1.3.0"<br>
        <br>
In my target platform I add the the drools project I created (with<br>
drools-xx.jar (the necessary ones), I also added the following:<br>
-ant<br>
-antlr-runtime<br>
-janino<br>
-jsr94<br>
-xstream<br>
        <br>
But I can't seem to get it working... Does anyone know what can be done<br>
about this? Or a working example of Drools in Felix OSGi would also be<br>
helpful.<br>
        <br>
Any help is very much appreciated, I've been looking into this for days.<br>
        <br>
Thanks!<br>
        <br>
Kind regards,<br>
        <br>
Aerv<br>
        </div>
        </div>
        </div>
        </div>
        <font color="#888888">
        <div>
        <div class="h5">
        <div>
        <div>--<br>
View this message in context: <a moz-do-not-send="true"
 href="http://n3.nabble.com/Drools-and-OSGi-tp694011p694011.html"
 rel="nofollow" link="external" target="_blank">http://n3.nabble.com/Drools-and-OSGi-tp694011p694011.html</a><br>
Sent from the Drools - User mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
        </div>
        </div>
        </div>
        </div>
        <a moz-do-not-send="true"
 href="http://n3.nabble.com/user/SendEmail.jtp?type=node&amp;node=698731&amp;i=1"
 rel="nofollow" link="external" target="_blank">[hidden email]</a>
        <div class="im">
        <div><br>
        <a moz-do-not-send="true"
 href="https://lists.jboss.org/mailman/listinfo/rules-users"
 rel="nofollow" link="external" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
        </div>
        </div>
        </font></blockquote>
      </div>
      <br>
      <br>
_______________________________________________
      <br>
      <div class="im">rules-users mailing list
      <br>
      <a moz-do-not-send="true"
 href="http://n3.nabble.com/user/SendEmail.jtp?type=node&amp;node=698731&amp;i=2"
 rel="nofollow" link="external" target="_blank">[hidden email]</a>
      <br>
      </div>
      <div class="im">
      <div><a moz-do-not-send="true"
 href="https://lists.jboss.org/mailman/listinfo/rules-users"
 rel="nofollow" link="external" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
      </div>
      </div>
    </blockquote>
    </div>
    <br>
    <br clear="all">
    <div class="im"><br>
-- <br>
__________________________________<br>
Van Isterdael Wouter<br>
Roesbeke 27<br>
9402 Meerbeke<br>
0496401476<br>
    <br>
    </div>
    <hr width="300" align="left">View this message in context: <a
 moz-do-not-send="true"
 href="http://n3.nabble.com/Drools-and-OSGi-tp694011p698969.html"
 target="_blank">Re: Drools and OSGi</a>
    <div>
    <div class="h5"><br>
Sent from the <a moz-do-not-send="true"
 href="http://n3.nabble.com/Drools-User-f47000.html" target="_blank">Drools
- User mailing list archive</a> at Nabble.com.<br>
    </div>
    </div>
    <br>
_______________________________________________<br>
rules-users mailing list<br>
    <a moz-do-not-send="true" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
    <a moz-do-not-send="true"
 href="https://lists.jboss.org/mailman/listinfo/rules-users"
 target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
    <br>
  </blockquote>
  </div>
  <br>
  <br clear="all">
  <br>
-- <br>
__________________________________<br>
Van Isterdael Wouter<br>
Roesbeke 27<br>
9402 Meerbeke<br>
0496401476<br>
  <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
  </pre>
</blockquote>
<br>
</body>
</html>