2
votes

I have a maven gwt project which should integrate drools (5.4.0.CR1) on the server.

The problem here is that it seems that drools requires drools-pipline as dependency for it to find the class:

org.drools.builder.impl.KnowledgeBuilderFactoryServiceImpl

Which when added makes drools run correctly but breaks GWT...

I have read an article describing similar problem but with an older version saying that this is because of different versions of "org.eclipse.jdt" and it could be fixed by adding:

<exclusions>
    <exclusion>
        <groupId>org.eclipse.jdt.core.compiler</groupId>
        <artifactId>ecj</artifactId>
    </exclusion>
</exclusions>

but that doesn't work...

The funny is that when inspecting from eclipse, I found that this class actually exists in drools-compiler jar Which looks like being the same as the pom "drools-multiproject" which is already referenced.

Any help is greatly appreciated.. Thanks a lot.


Update 1:

This is the error I get when enabling the dependency of "drools-pipline".. and the Internal jetty server doesn't run (other dependencies cause the server to run but not the dev mode) but It doesn't load the dev mode:

   [INFO] log4j: reset attribute= "false".
   [INFO] log4j: Threshold ="null".
   [INFO] log4j: Retreiving an instance of org.apache.log4j.Logger.
   [INFO] log4j: Setting [org.drools.grid] additivity to [true].
   [INFO] log4j: Level value for org.drools.grid is  [INFO].
   [INFO] log4j: org.drools.grid level set to INFO
   [INFO] log4j: Level value for root is  [ERROR].
   [INFO] log4j: root level set to ERROR
   [INFO] log4j: Class name: [org.apache.log4j.ConsoleAppender]
   [INFO] log4j: Setting property [target] to [System.out].
   [INFO] log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
   [INFO] log4j: Setting property [conversionPattern] to [%-4r %-5p %x- %m%n].
   [INFO] log4j: Adding appender named [console] to category [root].

Update 2:

While viewing the drools-pipline pom, I found it is described as being legacy to drools-camel, so I replaced it with drools-camel... now Things load correctly, but If I use the exclusion put above on drools-camel dependency GWT works but drools doesn't complaining it can't find it, if I remove the exclusion GWT breaks with:

java.lang.NoSuchFieldError: warningThreshold
at com.google.gwt.dev.javac.JdtCompiler.getCompilerOptions(JdtCompiler.java:400)
at com.google.gwt.dev.javac.JdtCompiler$CompilerImpl.<init>(JdtCompiler.java:228)
at com.google.gwt.dev.javac.JdtCompiler.doCompile(JdtCompiler.java:689)
at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater.compile(CompilationStateBuilder.java:215)
at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:406)
at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:299)
at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:325)
at com.google.gwt.dev.DevModeBase$UiBrowserWidgetHostImpl.createModuleSpaceHost(DevModeBase.java:105)
at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:190)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:510)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
at java.lang.Thread.run(Thread.java:662)
2

2 Answers

3
votes

We had this problem too in guvnor. It's because the GWT compiler fails to separate it's compiler and compilation classpath. Even worse, gwt-dev shades several jars (yes, the gwt-dev jar is evil:). Here's an issue at google code for it (there are several related issue).

Anyway, here's the fix:

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>gwt-maven-plugin</artifactId>
    <version>2.3.0</version>
    <configuration>
      ...
      <gwtSdkFirstInClasspath>true</gwtSdkFirstInClasspath><!-- The GWT compiler must the correct JDT version -->
      ...
    </configuration>
0
votes

I had the same problem, and the solution of using <gwtSdkFirstInClasspath>true</gwtSdkFirstInClasspath> in configuration did not work for me. What I've done is reorder the Classpath in the "Eclipse - Run Configurations ...", putting the GWT SDK before the Maven Dependencies