[jboss-jira] [JBoss JIRA] Created: (JBRULES-378) NoClassDefFoundError at org.drools.compiler.PackageBuilder.loadCompiler

Mihai Florea (JIRA) jira-events at jboss.com
Tue Jul 18 12:35:11 EDT 2006


NoClassDefFoundError at org.drools.compiler.PackageBuilder.loadCompiler
-----------------------------------------------------------------------

                 Key: JBRULES-378
                 URL: http://jira.jboss.com/jira/browse/JBRULES-378
             Project: JBoss Rules
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: Drl Parser/Builder
    Affects Versions: 3.0.2
         Environment: -Linux 2.4.26;
-Sun JDK 1.5.0_06;
-Eclipse 3.2.0 M20060629-1905;
-Jar classpath entries:
antlr-2.7.6.jar                    
antlr-3.0ea8.jar                   
colt-1.2.0.jar                     
commons-collections-3.1.jar        
commons-io-1.1.jar                 
commons-jci-core-1.0-406301.jar    
commons-jci-eclipse-3.2.0.666.jar  
commons-jci-janino-2.4.3.jar       
commons-lang-2.1.jar               
commons-logging-api-1.0.4.jar      
concurrent-1.3.4.jar               
drools-compiler.jar                
drools-core.jar
drools-decisiontables.jar
drools-jsr94.jar
janino-2.4.3.jar
jsr94-1.1.jar
jung-1.7.2.jar
junit-3.8.1.jar
poi-2.5.1-final-20040804.jar
stringtemplate-2.3b6.jar
xercesImpl-2.6.2.jar
xml-apis-1.0.b2.jar
xpp3-1.1.3.4.O.jar
xstream-1.1.3.jar       
            Reporter: Mihai Florea
         Assigned To: Mark Proctor


When trying to run the HelloWorldExample from drools-samples, I ended up with the following error:

java.lang.NoClassDefFoundError: org/eclipse/jdt/internal/compiler/env/INameEnvironment
	at org.drools.compiler.PackageBuilder.loadCompiler(Unknown Source)
	at org.drools.compiler.PackageBuilder.<init>(Unknown Source)
	at org.drools.compiler.PackageBuilder.<init>(Unknown Source)
	at org.drools.examples.HelloWorldExample.readRule(HelloWorldExample.java:49)
	at org.drools.examples.HelloWorldExample.main(HelloWorldExample.java:21)

The "eclipse" part from the error message seemed quite to me strange since I specified it to use the Janino compiler with 
   -Ddrools.compiler=JANINO -Ddrools.compiler.lnglevel=1.4 

I was running the example from within Eclipse, having all the required libraries in classpath (not the DROOLS/JBoss Rules library, but the jar files added manually).

Taking a look at "loadCompiler()" method in org.drools.compiler.PackageBuilder, I noticed a missing break in the switch statement, which is the cause of the problem IMHO.

    private void loadCompiler() {
        switch ( configuration.getCompiler() ) {
            case PackageBuilderConfiguration.JANINO : {
                if ( !"1.4".intern().equals( configuration.getJavaLanguageLevel() ) ) throw new RuntimeDroolsException( "Incompatible Java language level with selected compiler" );
                compiler = JavaCompilerFactory.getInstance().createCompiler("janino");
            }
            // I believe we should have a "break" statement at this line, unless we want the system properties to be ignored
            case PackageBuilderConfiguration.ECLIPSE :
            default : {
                EclipseJavaCompilerSettings eclipseSettings = new EclipseJavaCompilerSettings();
                eclipseSettings.getMap().put( "org.eclipse.jdt.core.compiler.codegen.targetPlatform",
                                              configuration.getJavaLanguageLevel() );
                eclipseSettings.getMap().put( "org.eclipse.jdt.core.compiler.source",
                                              configuration.getJavaLanguageLevel() );
                compiler = new EclipseJavaCompiler( eclipseSettings );
            }
        }
    }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list