Nope, this sounds like a bug... can you open a JIRA with that info please?

   Edson

2009/11/25 richarda <richard.ambridge@gmail.com>

Also tried under 5.1.0M1 release.. same issue :(
Am i doing something wrong by declaring the @role in the Configuration
section?


richarda wrote:
>
> Still trying to get this to work.
> I have managed to create from a default (new) guvnor setup.
>
> Steps I do..
> 1. Create fresh guvnor
> 2. In eclipse create  Message.java file in package com.sample, and create
> a jar file
> 3. In guvnor import the model for the Message.jar file
> 4. In guvnor create a category
> 5. Create an import statement for  import com.sample.Message
> 6. Create a simple technical rule,  something like   when, Message(),
> then, System.out.println(".");
> 7. Build the pkg
> 8. download the pkg
>
> use the code from previous post to load the pkg...
> it works fine..
>
> now, goto guvnor advanced view and change the Configuration from:
> import com.sample.Message
>
> to:
>
> import com.sample.Message;
>
> declare Message
>   @role( event )
> end
>
>
> build the pkg,
> download the pkg,
> run the test program...
>
> I get:
> org.drools.RuntimeDroolsException: unable to resolve Type Declaration
> class 'Message'
>       at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:754)
>       at
> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:515)
>       at
> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
>       at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:69)
>       at com.sample.DroolsTest.main(DroolsTest.java:27)
>
>
> richarda wrote:
>>
>> So, my code is doing this:
>>
>>  KnowledgeBaseConfiguration conf =
>> KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
>>             conf.setOption(EventProcessingOption.STREAM);
>>             KnowledgeBuilder builder =
>> KnowledgeBuilderFactory.newKnowledgeBuilder();
>>             try {
>>                 File f = new File("/tmp/my.pkg");
>>                 InputStream stream = new FileInputStream(f);
>>                 if (stream == null) {
>>                     jlog.fatal("Unable to find rule pkg");
>>                 } else {
>>                     jlog.info("adding pkg");
>>
>> builder.add(ResourceFactory.newInputStreamResource(stream),
>> ResourceType.PKG);
>>                 }
>>             } catch (Exception e) {
>>                 e.printStackTrace();
>>             }
>>             KnowledgeBase kbase =
>> KnowledgeBaseFactory.newKnowledgeBase(conf);
>>             kbase.addKnowledgePackages(builder.getKnowledgePackages());
>>             jlog.info("setup creating knowledge session");
>>             ksession = kbase.newStatefulKnowledgeSession();
>>             jlog.info(" setup ksession created");
>>
>>
>> The pkg was created from Guvnor.
>>
>> If in the package declaration area in Guvnor,  (where you put the import
>> statements)
>> If I put
>> declare Signature
>>  @role ( event )
>> end
>>
>> then build the package, save it to disk /tmp/my.pkg
>> on startup I get:
>>
>> [#|2009-11-24T14:50:38.944+0000|WARNING|sun-appserver2.1|javax.enterprise.system.stream.err|_ThreadID=12;_ThreadName=pool-1-thread-3;_RequestID=7c35064d-757e-4519-b5eb-433db89e168d;|org.drools.RuntimeDroolsException:
>> unable to resolve Type Declaration class 'Signature'
>>      at
>> org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:754)
>>      at
>> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:515)
>>      at
>> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
>>
>>
>> I need to declare 'Signature' as an 'event'
>> Am I doing this wrong?
>>
>> If I do this all in Eclipse and load the DRL files manually it all works.
>>
>
>

--
View this message in context: http://old.nabble.com/unable-to-resolve-Type-Declaration-class-tp26497326p26519888.html
Sent from the drools - user mailing list archive at Nabble.com.

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
 Edson Tirelli
 JBoss Drools Core Development
 JBoss by Red Hat @ www.jboss.com