[rules-users] Mavenizing a new drools project

eyal edri eyal.edri at gmail.com
Mon May 10 07:21:40 EDT 2010


I'm still having problem unfortunately.. :(

i get a strange error that i didn't got before turning to maven:

when running:

*kbuilder.add(ResourceFactory.newClassPathResource("src/main/rules/sample.drl"),
ResourceType.DRL);*

this errors occurs:
java.lang.RuntimeException: java.io.FileNotFoundException:
'src/main/rules/sample.drl' cannot be opened because it does not exist
 at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:559)
 at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
 at com.commtouch.drools.DroolsTest.readKnowledgeBase(DroolsTest.java:42)
 at com.commtouch.drools.DroolsTest.main(DroolsTest.java:25)
Caused by: java.io.FileNotFoundException: 'src/main/rules/sample.drl' cannot
be opened because it does not exist
 at
org.drools.io.impl.ClassPathResource.getInputStream(ClassPathResource.java:104)
 at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:287)
 at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:488)
 ... 3 more

i see a difference between the .classpth and .project files in both projects
(Drools project vs Maven Project).
could this be the reason?

Eyal.

On Mon, May 10, 2010 at 12:20 PM, eyal edri <eyal.edri at gmail.com> wrote:

> OK, the eclipse maven plugin added those deps type as 'pom' instead of
> 'jar',
> so the drools jars weren't included.
>
> fixed that.
>
> thanks.
>
>
> On Mon, May 10, 2010 at 11:25 AM, eyal edri <eyal.edri at gmail.com> wrote:
>
>> OK, Still got problems.
>>
>> i've created a maven project, and all looks good in compile time (with all
>> the org.drools dep below).
>>
>> but i think i still missing a 'runtime' dependency, cause when i try to
>> run the Hello World example, i get this error:
>>
>> [the src line is this:
>> KnowledgeBuilder kbuilder =
>> KnowledgeBuilderFactory.newKnowledgeBuilder();]
>>
>> org.drools.ProviderInitializationException: Provider
>> org.drools.builder.impl.KnowledgeBuilderProviderImpl could not be set.
>>  at
>> org.drools.builder.KnowledgeBuilderFactory.loadProvider(KnowledgeBuilderFactory.java:111)
>>  at
>> org.drools.builder.KnowledgeBuilderFactory.getKnowledgeBuilderProvider(KnowledgeBuilderFactory.java:101)
>>  at
>> org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(KnowledgeBuilderFactory.java:29)
>>  at com.commtouch.drools.DroolsTest.readKnowledgeBase(DroolsTest.java:38)
>>  at com.commtouch.drools.DroolsTest.main(DroolsTest.java:24)
>> Caused by: java.lang.ClassNotFoundException:
>> org.drools.builder.impl.KnowledgeBuilderProviderImpl
>>  at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>>  at java.security.AccessController.doPrivileged(Native Method)
>>  at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>  at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>>  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>>  at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>>  at java.lang.Class.forName0(Native Method)
>>  at java.lang.Class.forName(Class.java:169)
>>  at
>> org.drools.builder.KnowledgeBuilderFactory.loadProvider(KnowledgeBuilderFactory.java:108)
>>  am i missing org.drools.builder? (i didn't see it in the maven repo..)
>>
>> On Sun, May 9, 2010 at 3:35 PM, Salaboy <salaboy at gmail.com> wrote:
>>
>>> I always prefer to create the maven projects from the scratch. You
>>> only need to add the following deps (groupid and artifactid)
>>>
>>> org.drools
>>> drools-api
>>>
>>> org.drools
>>> drools-core
>>>
>>> org.drools
>>> drools-compiler
>>>
>>> You probably need to add the jboss repository as well in order to get
>>> this deps
>>>
>>> Repository.jboss.org/maven2
>>>
>>>
>>> - Ing. Mauricio Salatino -
>>>
>>> On May 9, 2010, at 5:01, eyal edri <eyal.edri at gmail.com> wrote:
>>>
>>> > Hi,
>>> >
>>> > I've created the HelloWorld drools sample project and i want to turn
>>> > it into a maven project.
>>> >
>>> > i know i can create and empty maven project and copy all sources
>>> > from the drools project to it,
>>> > but how do i handle the dependant jars (drools runtime?)
>>> >
>>> > is there a guide of how to mavenize your drools projects?
>>> >
>>> > --
>>> > Eyal Edri
>>> > _______________________________________________
>>> > 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
>>>
>>
>>
>>
>> --
>> Eyal Edri
>>
>
>
>
> --
> Eyal Edri
>



-- 
Eyal Edri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100510/2b6e854a/attachment.html 


More information about the rules-users mailing list