<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content=text/html;charset=ISO-8859-1>
<META content="MSHTML 6.00.6000.16705" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY text=#000000 bgColor=#ffffff>
<DIV><FONT face=Arial size=2>had similar problem, traced it back to classloader 
problem: make sure drools-compiler.jar is not on path used for classpathref 
attribute of drools compile ant task</FONT></DIV>
<DIV><FONT face=Arial size=2>cf. <A 
href="https://jira.jboss.org/jira/browse/JBRULES-1801">https://jira.jboss.org/jira/browse/JBRULES-1801</A></FONT></DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=mproctor@codehaus.org href="mailto:mproctor@codehaus.org">Mark 
  Proctor</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=rules-users@lists.jboss.org 
  href="mailto:rules-users@lists.jboss.org">Rules Users List</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Monday, September 22, 2008 12:56 
  PM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [rules-users] Unable to load 
  dialect java from Ant task</DIV>
  <DIV><BR></DIV>the only Eclipe jar drools depends on is Eclipse JDT Compiler, 
  which is available separately and is up on ibiblio.<BR><BR><BR>Justin Case 
  wrote: 
  <BLOCKQUOTE cite=mid:96467.51886.qm@web36506.mail.mud.yahoo.com type="cite"><PRE wrap="">Thanks a lot for the answer. The problem is exactly that one: how could I know what the dependencies for the DRools compiler are?! I thought this list would know :)) Anyway, I'll print out the Eclipse runtime classpath and compare them two to see what stands out. 

The Ant task is mentioned here and there in the documentation (albeit without examples) so I kinda thought more people are using it. An older thread of this same list talks about adding (only) the drools-ant to the classpath, which of course solves the ant task itself but none of its dependencies... I find it difficult to believe that the compiler depends on some Eclipse stuff, especially after I added ALL the jars existing in the Eclipse configuration. The only thing I cannot directly rule out is the classloader issue, but that's also the only thing I have no idea how to debug/solve :(

Thank you,
M

--- On Sun, 9/21/08, Edson Tirelli <A class=moz-txt-link-rfc2396E href="mailto:tirelli@post.com">&lt;tirelli@post.com&gt;</A> wrote:
  </PRE>
    <BLOCKQUOTE type="cite"><PRE wrap="">This is always related to classpath problems. Make sure you have all
dependencies set in your classpath and if that does not work, maybe 
make an&gt; example project with the error available somewhere that
another person can take a look at it. (don't think you can send zip
attachements to the list, but not sure).

   Eclipse-plugin embeds a series of dependency jars that are 
transparently added to the classpath. That is the major reason you may
see the problem outside of eclipse, but not inside. Classloader
configuration is also another reason.

   []s
   Edson

2008/9/18 Soterro <A class=moz-txt-link-rfc2396E href="mailto:send_lotsa_spam_here@yahoo.com">&lt;send_lotsa_spam_here@yahoo.com&gt;</A>

    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">Hi all,

I have a perfectly running Eclipse 3.3 with DRools
      </PRE></BLOCKQUOTE><PRE wrap="">4.0.4 and JDK 1.5.14.
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">The rules are compiled with a post build Ant task
      </PRE></BLOCKQUOTE><PRE wrap="">which uses Janino (need
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">it for Tomcat compatibility).
Now OUTSIDE Eclipse it seems I cannot use that Ant
      </PRE></BLOCKQUOTE><PRE wrap="">task to save my life :(
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">I tried switching from Janino to the default compiler,
      </PRE></BLOCKQUOTE><PRE wrap="">same thing. I always
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">get this infamous error:

 BUILD FAILED
 E:\buildRules-hudson.xml:30: RuleBaseTask failed:
      </PRE></BLOCKQUOTE><PRE wrap="">Unable to load dialect
    </PRE><PRE wrap="">'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java'
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">       at

      </PRE></BLOCKQUOTE><PRE wrap="">com.csc.ezbook.eztarif.rules.DroolsCompilerAntTaskStandalone.execute
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">       (DroolsCompilerAntTaskStandalone.java:163)
       at

      </PRE></BLOCKQUOTE><PRE wrap="">org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">       at
      </PRE></BLOCKQUOTE><PRE wrap="">sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">       at

      </PRE></BLOCKQUOTE><PRE wrap="">sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">       java:39)
       at
      </PRE></BLOCKQUOTE><PRE wrap="">sun.reflect.DelegatingMethodAccessorImpl.invoke(
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">       DelegatingMethodAccessorImpl.java:25)
       at
      </PRE></BLOCKQUOTE><PRE wrap="">java.lang.reflect.Method.invoke(Method.java:585)
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">       at

      </PRE></BLOCKQUOTE><PRE wrap="">org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">       :105)
       at
      </PRE></BLOCKQUOTE><PRE wrap="">org.apache.tools.ant.Task.perform(Task.java:348)
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap=""> [...]
 Caused by: org.drools.RuntimeDroolsException: Unable
      </PRE></BLOCKQUOTE><PRE wrap="">to load dialect
    </PRE><PRE wrap="">'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java'
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">       at
      </PRE></BLOCKQUOTE><PRE wrap="">org.drools.compiler.PackageBuilderConfiguration.addDialect(
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">       PackageBuilderConfiguration.java:152)
       at
      </PRE></BLOCKQUOTE><PRE wrap="">org.drools.compiler.PackageBuilderConfiguration.
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">      
      </PRE></BLOCKQUOTE><PRE wrap="">buildDialectConfigurationMap(PackageBuilderConfiguration.java:140)
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">       at
      </PRE></BLOCKQUOTE><PRE wrap="">org.drools.compiler.PackageBuilderConfiguration.init(
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">       PackageBuilderConfiguration.java:117)
       at
      </PRE></BLOCKQUOTE><PRE wrap="">org.drools.compiler.PackageBuilderConfiguration.&lt;init&gt;(
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">       PackageBuilderConfiguration.java:94)
       at

      </PRE></BLOCKQUOTE><PRE wrap="">com.my.app.rules.DroolsCompilerAntTaskStandalone.getPackageBuilder(
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">       DroolsCompilerAntTaskStandalone.java:257)
       at
      </PRE></BLOCKQUOTE><PRE wrap="">com.my.app.rules.DroolsCompilerAntTaskStandalone.execute(
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">       DroolsCompilerAntTaskStandalone.java:136)

That "DroolsCompilerAntTaskStandalone" is my
      </PRE></BLOCKQUOTE><PRE wrap="">task using the default
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">compiler like this:
   PackageBuilderConfiguration conf = new
      </PRE></BLOCKQUOTE><PRE wrap="">PackageBuilderConfiguration();
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">   conf.setClassLoader( loader );
   PackageBuilder builder = new PackageBuilder( conf
      </PRE></BLOCKQUOTE><PRE wrap="">);
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">If I use Janino like below the error is exactly the
      </PRE></BLOCKQUOTE><PRE wrap="">same...
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">   PackageBuilderConfiguration pkgBuilderCfg = new
   PackageBuilderConfiguration();
   pkgBuilderCfg.setClassLoader( loader );
   JavaDialectConfiguration javaConf =
      </PRE></BLOCKQUOTE><PRE wrap="">(JavaDialectConfiguration)
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">   pkgBuilderCfg.getDialectConfiguration(
      </PRE></BLOCKQUOTE><PRE wrap="">"java" );
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">   javaConf.setCompiler(
      </PRE></BLOCKQUOTE><PRE wrap="">JavaDialectConfiguration.JANINO );
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">   PackageBuilder builder = new PackageBuilder(
      </PRE></BLOCKQUOTE><PRE wrap="">pkgBuilderCfg );
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">Again, in Eclipse all is working fine. I checked
      </PRE></BLOCKQUOTE><PRE wrap="">Ant's classpath, here it
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">is:

      </PRE></BLOCKQUOTE><PRE wrap="">E:\apache-ant-1.7.0\bin\..\lib\ant-launcher.jar
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap=""> E:\apache-ant-1.7.0\lib\*.jar
 C:\Program
      </PRE></BLOCKQUOTE><PRE wrap="">Files\Java\jdk1.5.0_14\lib\tools.jar
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">Here is how I provide a classpath:
       &lt;taskdef name="rulescompiler"
      </PRE></BLOCKQUOTE><PRE wrap="">classname="com.my.app.rules.
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">       DroolsCompilerAntTaskStandalone"
classpathref="droolsutils.classpath" /&gt;

       &lt;target depends="newfilesarethere"
      </PRE></BLOCKQUOTE><PRE wrap="">name="build"
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">unless="rulesCompile.
       notRequired"&gt;
               &lt;rulescompiler
      </PRE></BLOCKQUOTE><PRE wrap="">srcdir="${THIS_PROJ}/src/com/my/app/rules"
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">      </PRE></BLOCKQUOTE><PRE wrap="">tofile="${THIS_PROJ}/build/classes/com/my/app/rules/
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">                              packaged.rules"
                             
      </PRE></BLOCKQUOTE><PRE wrap="">classpathref="droolsutils.classpath" &gt;
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">                   &lt;include name="*.drl"
      </PRE></BLOCKQUOTE><PRE wrap="">/&gt;
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">               &lt;/rulescompiler&gt;
       &lt;/target&gt;

The classpath I provide contains pretty much all
      </PRE></BLOCKQUOTE><PRE wrap="">libraries I use normally
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">in the project, but I tried even to add ALL jar's
      </PRE></BLOCKQUOTE><PRE wrap="">from the Eclipse 3.3
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">install directory (that would include all DRools 4.0.4
      </PRE></BLOCKQUOTE><PRE wrap="">libraries, with antlr
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">and whatnot)

I tried also with DRools 4.0.7, same behaviour...

What does that mean and where is it coming from? Could
      </PRE></BLOCKQUOTE><PRE wrap="">it have issues with
    </PRE>
      <BLOCKQUOTE type="cite"><PRE wrap="">the tools.jar from Java 1.5.0_14?

Thank you for any input,
M



_______________________________________________
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><PRE wrap="">
-- 
Edson Tirelli
JBoss Drools Core Development
JBoss, a division of Red Hat @ <A class=moz-txt-link-abbreviated href="http://www.jboss.com">www.jboss.com</A>
    </PRE></BLOCKQUOTE><PRE wrap=""><!---->

      
_______________________________________________
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>
  <P>
  <HR>

  <P></P>_______________________________________________<BR>rules-users mailing 
  list<BR>rules-users@lists.jboss.org<BR>https://lists.jboss.org/mailman/listinfo/rules-users<BR></BLOCKQUOTE></BODY></HTML>