The problem mentioned by Richard is fixed in trunk. Regarding Guvnor 379, I will ask Toni to re-test it. Thanks for pointing it out.
Regarding your comment on the documentation, it is documented here:
http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-expert/html_single/index.html#d0e3350
Edson
Looks like it is related to this open jira:
https://jira.jboss.org/jira/browse/GUVNOR-379
Cheers,
Jarek
richarda wrote:
> Yeah, its in the classpath.. and to be doubly sure just before the code I do
> a
> Signature s=new Signature();
> and that works.. so jvm can find the Signature object.
>
> I have created https://jira.jboss.org/jira/browse/JBRULES-2348
> I would love to know if any workarounds are possible, this has ground my
> project to a halt.
>
> thanks
> Ric
>
>
> Edson Tirelli-4 wrote:
>> Kris just reminded me of something: do you have the actual Message
>> class
>> in the test program classpath?
>>
>> When downloading the package from guvnor, I think it does not download
>> the model jar... only the actual rules, etc...
>>
>> 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
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users