[rules-users] Drools examples don't run

Michael Anstis michael.anstis at gmail.com
Thu Oct 21 15:48:54 EDT 2010


Hi Kevin,

The problem is a dependancy missing on the broker example.

If you add the following to your maven dependancies you'll be OK:-

    <dependency>
        <groupId>org.drools</groupId>
        <artifactId>drools-flow-compiler</artifactId>
    </dependency>

If you had previously generated the Eclipse project files you'll need to
re-run mvn eclipse:eclipse to add the new dependancy (or add manually).

If you use M2Eclipse I suspect you'll have to re-import (or fix the missing
dependancy manually).

JIRA https://jira.jboss.org/browse/JBRULES-2748 created.

Cheers,

Mike

2010/10/21 赵侃侃 <kevin223 at gmail.com>

> Thanks Michael, I couldn't find any XML files under the example project. It
> will be a great help if you can take a look at yours when you have time.
>
> Best Regards,
> Kevin Zhao
>
> 2010/10/21 Michael Anstis <michael.anstis at gmail.com>
>
>> Your stack trace shows:-
>>
>> at
>> org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:432)
>>
>> So a process is being built from associated XML!
>>
>> If I get time I'll have a look at the example (when I'm at home later). I
>> don't recall anything being copied anywhere as they're normally picked up
>> directly from the classpath.
>>
>> 2010/10/21 赵侃侃 <kevin223 at gmail.com>
>>
>>> No, the NPE is all I've got in the console output.
>>>
>>> Can you detail what process definition that you are referring to? I saw
>>> all the rules definition files are all copied over to the classpath after
>>> conducting the compile.
>>>
>>> Namely, those files are borker.drl, notify.drl, position.drl, position.rf
>>> and stocktickstream.dat. All of them now exist under
>>> project-root/target/classes
>>>
>>> Best Regards,
>>> Kevin Zhao
>>>
>>>
>>> 2010/10/21 Michael Anstis <michael.anstis at gmail.com>
>>>
>>>> Are there any errors in addition to the NPE?
>>>>
>>>> The context of the stack-trace suggests the process definition being
>>>> loaded is not on your classpath.
>>>>
>>>> 2010/10/21 赵侃侃 <kevin223 at gmail.com>
>>>>
>>>> Thanks Bruno,
>>>>>
>>>>> I have now fixed the NoClassDefFoundError, any ideas about the
>>>>> NullPointer one?
>>>>>
>>>>> Best Regards,
>>>>> Kevin Zhao
>>>>>
>>>>> 2010/10/20 Bruno Freudensprung <bruno.freudensprung at temis.com>
>>>>>
>>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I think you have to add the xstream jar to your classpath.
>>>>>> Here is the Maven dependency :
>>>>>>
>>>>>>     <dependency>
>>>>>>       <groupId>com.thoughtworks.xstream</groupId>
>>>>>>       <artifactId>xstream</artifactId>
>>>>>>       <version>1.3.1</version>
>>>>>>     </dependency>
>>>>>>
>>>>>> Best regards,
>>>>>>
>>>>>> Bruno.
>>>>>>
>>>>>>
>>>>>> 赵侃侃 a écrit :
>>>>>>
>>>>>> Hello,
>>>>>>
>>>>>>  I checked out the latest source from svn repository. It compiled OK
>>>>>> and imported the example projects to my eclipse workspace but the examples
>>>>>> run with error.
>>>>>> The two example projects are namely drools-examples-drl
>>>>>> & drools-examples-fusion.
>>>>>>
>>>>>>  org.drools.examples.pacman.Main gives the errors:
>>>>>>
>>>>>>  Exception in thread "main" java.lang.NoClassDefFoundError:
>>>>>> com/thoughtworks/xstream/XStream
>>>>>>  at
>>>>>> org.drools.audit.KnowledgeRuntimeLoggerProviderImpl.newThreadedFileLogger(KnowledgeRuntimeLoggerProviderImpl.java:34)
>>>>>>  at
>>>>>> org.drools.logger.KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(KnowledgeRuntimeLoggerFactory.java:69)
>>>>>>  at org.drools.examples.pacman.Main.initKsession(Main.java:88)
>>>>>>  at org.drools.examples.pacman.Main.main(Main.java:39)
>>>>>> Caused by: java.lang.ClassNotFoundException:
>>>>>> com.thoughtworks.xstream.XStream
>>>>>>  at java.net.URLClassLoader$1.run(Unknown Source)
>>>>>>  at java.security.AccessController.doPrivileged(Native Method)
>>>>>>  at java.net.URLClassLoader.findClass(Unknown Source)
>>>>>>  at java.lang.ClassLoader.loadClass(Unknown Source)
>>>>>>  at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
>>>>>>  at java.lang.ClassLoader.loadClass(Unknown Source)
>>>>>>  ... 4 more
>>>>>>
>>>>>>
>>>>>>  org.drools.examples.broker.Main gives the errors:
>>>>>>
>>>>>>  java.lang.NullPointerException
>>>>>>  at
>>>>>> org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:432)
>>>>>>  at
>>>>>> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:468)
>>>>>>  at
>>>>>> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
>>>>>>  at org.drools.examples.broker.Broker.loadRuleBase(Broker.java:95)
>>>>>>  at org.drools.examples.broker.Broker.createSession(Broker.java:80)
>>>>>>  at org.drools.examples.broker.Broker.<init>(Broker.java:57)
>>>>>>  at org.drools.examples.broker.Main.main(Main.java:53)
>>>>>>
>>>>>>  Does anyone experience the similar issues and know how to fix that?
>>>>>>
>>>>>>  Best Regards,
>>>>>> Kevin
>>>>>>
>>>>>> ------------------------------
>>>>>>
>>>>>> _______________________________________________
>>>>>> rules-users mailing listrules-users at lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> rules-users mailing list
>>>>>> rules-users at lists.jboss.org
>>>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> rules-users mailing list
>>>>> rules-users at lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> rules-users mailing list
>>>> rules-users at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>
>>>>
>>>
>>> _______________________________________________
>>> rules-users mailing list
>>> rules-users at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20101021/22bd1fbc/attachment.html 


More information about the rules-users mailing list