[jboss-jira] [JBoss JIRA] Updated: (JBRULES-2348) unable to resolve Type Declaration class

Richard Ambridge (JIRA) jira-events at lists.jboss.org
Fri Nov 27 04:47:29 EST 2009


     [ https://jira.jboss.org/jira/browse/JBRULES-2348?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard Ambridge updated JBRULES-2348:
--------------------------------------

    Description: 
Using the following code to create a Knowledge Base from a guvnor compiled pkg, (download the pkg and put in /tmp/my.pkg)

 	private static KnowledgeBase readKnowledgeBase() throws Exception {
		KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
		File pkgFile = new File("/tmp/my.pkg");
      if (pkgFile.exists() == false) {
          System.out.println("Unable to find rule pkg");
      } else {
    	  System.out.println("RuleService. adding pkg");
    	  kbuilder.add(ResourceFactory.newFileResource(pkgFile), ResourceType.PKG);
      }
		KnowledgeBuilderErrors errors = kbuilder.getErrors();
		if (errors.size() > 0) {
			for (KnowledgeBuilderError error: errors) {
				System.err.println(error);
			}
			throw new IllegalArgumentException("Could not parse knowledge.");
		}
		KnowledgeBaseConfiguration conf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
		conf.setOption(EventProcessingOption.STREAM);
		KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(conf);
		kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
		
		return kbase;
	}


The pkg was created from Guvnor.

If in the package declaration area in Guvnor,  (where you put the import statements)
If I put

import com.sample.Message

declare Message
  @role( event )
end


then build the package, save it to disk /tmp/my.pkg
on startup I get:

org.drools.RuntimeDroolsException: unable to resolve Type Declaration class 'Message'
	at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:759)
	at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:516)
	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)


I am unable to declare an object as an event type in guvnor. This prevents any rules creation and compiling :(

Attached is the workbench from eclipse, and the guvnor repository export

  was:
Using the following code to create a Knowledge Base from a guvnor compiled pkg, (download the pkg and put in /tmp/my.pkg)

 
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 am unable to declare an object as an event type in guvnor. This prevents any rules creation and compiling :(

Attached is the workbench from eclipse, and the guvnor repository export



> unable to resolve Type Declaration class
> ----------------------------------------
>
>                 Key: JBRULES-2348
>                 URL: https://jira.jboss.org/jira/browse/JBRULES-2348
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: drools-compiler, drools-guvnor
>    Affects Versions: 5.0.1.FINAL, 5.1.0.M1
>         Environment: Ubuntu 8.04
>            Reporter: Richard Ambridge
>            Assignee: Mark Proctor
>         Attachments: repository_export.zip, workbench.tar
>
>
> Using the following code to create a Knowledge Base from a guvnor compiled pkg, (download the pkg and put in /tmp/my.pkg)
>  	private static KnowledgeBase readKnowledgeBase() throws Exception {
> 		KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
> 		File pkgFile = new File("/tmp/my.pkg");
>       if (pkgFile.exists() == false) {
>           System.out.println("Unable to find rule pkg");
>       } else {
>     	  System.out.println("RuleService. adding pkg");
>     	  kbuilder.add(ResourceFactory.newFileResource(pkgFile), ResourceType.PKG);
>       }
> 		KnowledgeBuilderErrors errors = kbuilder.getErrors();
> 		if (errors.size() > 0) {
> 			for (KnowledgeBuilderError error: errors) {
> 				System.err.println(error);
> 			}
> 			throw new IllegalArgumentException("Could not parse knowledge.");
> 		}
> 		KnowledgeBaseConfiguration conf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
> 		conf.setOption(EventProcessingOption.STREAM);
> 		KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(conf);
> 		kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
> 		
> 		return kbase;
> 	}
> The pkg was created from Guvnor.
> If in the package declaration area in Guvnor,  (where you put the import statements)
> If I put
> import com.sample.Message
> declare Message
>   @role( event )
> end
> then build the package, save it to disk /tmp/my.pkg
> on startup I get:
> org.drools.RuntimeDroolsException: unable to resolve Type Declaration class 'Message'
> 	at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:759)
> 	at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:516)
> 	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)
> I am unable to declare an object as an event type in guvnor. This prevents any rules creation and compiling :(
> Attached is the workbench from eclipse, and the guvnor repository export

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list