[rules-users] problem in Maven tests: class antlr CharStream not found, although it is there!

tim tim timbaermannextra at googlemail.com
Thu Feb 5 10:21:04 EST 2009


thanks edson

your hints helped me search in the right direction.
i resolved the problem although i do not know what
exactly was the problem..

i did have this antlr dependency in my pom:

<dependency>
        <groupId>org.antlr</groupId>
        <artifactId>antlr-runtime</artifactId>
        <version>3.1.1</version>
 </dependency>
 <dependency>
        <groupId>org.antlr</groupId>
        <artifactId>antlr</artifactId>
        <version>3.1.1</version>
</dependency>

which is the same dependency drools uses.

when i removed these two dependencies from my pom
everything worked.


anyway: it works, i am happy! thanks, tim


On Wed, Feb 4, 2009 at 11:23 PM, Edson Tirelli <tirelli at post.com> wrote:
>
>     You need antlr-runtime jar in your classpath, although maven should get
> it as a transitive dependency.
>
>     Try running:
>
> mvn help:effective-pom
>
>     That will show you what maven is using as pom after resolving
> dependencies. If antlr-runtime jar is not there or if you have the wrong
> version, that would be the problem.
>
>     []s
>     Edson
>
> 2009/2/4 tim tim <timbaermannextra at googlemail.com>
>>
>> hello all
>>
>> my problem is that my tests work fine in eclipse, but they
>> don't work in maven.
>>
>> when i execute my code via
>>
>>     mvn test
>>
>> drools cant find the antl CharStream class.
>>
>> this is the error i get:
>>
>> java.lang.NoClassDefFoundError: org/antlr/runtime/CharStream
>>        at
>> org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:276)
>>        at
>> com.hikuku.rules.util.TestHelperRules.getPackage(TestHelperRules.java:85)
>>        at
>> com.hikuku.rules.util.TestHelperRules.readRules(TestHelperRules.java:48)
>>        at
>> com.hikuku.rules.util.TestHelperRules.readRules(TestHelperRules.java:67)
>>        at
>> com.hikuku.rules.TestMemoryInsertRetract.insertRetract(TestMemoryInsertRetract.java:126)
>>        at
>> com.hikuku.rules.TestMemoryInsertRetract.testInsertRetractAlldifferent(TestMemoryInsertRetract.java:84)
>> Caused by: java.lang.ClassNotFoundException: org.antlr.runtime.CharStream
>>        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>>        at java.security.AccessController.doPrivileged(Native Method)
>>        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>>        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>>        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
>>        ... 32 more
>>
>>
>>
>> i have the antlr3.jar in my dependencies via the drools-compiler  pom.xml
>> and the class  org.antlr.runtime.CharStream is definitely in the
>> classpath.
>> i can use it from my own code without problems.
>>
>> but the drools package builder does not seem to find it.
>>
>> this works (even under maven):
>>
>>     final int a = org.antlr.runtime.CharStream.EOF;
>>
>> but this doesn't find CharStream:
>>
>>     PackageBuilder builder = new PackageBuilder();
>>     builder.addPackageFromDrl(r);
>>
>>
>> this is my dependency on drools as i have it in my pom:
>>
>>            <dependency>
>>                    <groupId>org.eclipse.jdt</groupId>
>>                    <artifactId>core</artifactId>
>>                    <version>3.4.2.v_883_R34x</version>
>>            </dependency>
>>
>>            <dependency>
>>                    <groupId>janino</groupId>
>>                    <artifactId>janino</artifactId>
>>                    <version>2.5.10</version>
>>            </dependency>
>>
>>            <dependency>
>>                    <groupId>org.drools</groupId>
>>                    <artifactId>drools-core</artifactId>
>>                    <version>5.0.0.SNAPSHOT</version>
>>            </dependency>
>>            <dependency>
>>                    <groupId>org.drools</groupId>
>>                    <artifactId>drools-api</artifactId>
>>                    <version>5.0.0.SNAPSHOT</version>
>>            </dependency>
>>            <dependency>
>>                    <groupId>org.drools</groupId>
>>                    <artifactId>drools-compiler</artifactId>
>>                    <version>5.0.0.SNAPSHOT</version>
>>            </dependency>
>>
>>
>> the snapshot i use is the drools-5.0.0.20090203.112022-386
>>
>>
>> does anyone have an idea what the problem might be?
>>
>> thanks, tim
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> --
>  Edson Tirelli
>  JBoss Drools Core Development
>  JBoss, a division of Red Hat @ www.jboss.com
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>



More information about the rules-users mailing list