Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-2040

Drools, Jboss AS, Dynamic Bean Generation

    XMLWordPrintable

    Details

      Description

      The issues is this guys i am creating a bean dynamically in this simple example i have an arraylist of strings which will create a private field, and a getXXX and a setXXX method for each of these fields

      The problem arises when i try to load the .drl file in the package builder which gives me the follow error (SEE BELOW)

      I suspect it has something to do with the class loader or the package structure in the rules?

      Any suggestion reading material or help would be greatly usefull
      the code i have loaded is a simple application which replicates the error

      22:20:59,435 ERROR [STDERR] Unable to create Field Extractor for 'name' of '[ClassObjectType class=com.beancreation.personXYZ]' in rule 'Credit Allowed' : [Rule name=Credit Allowed, agendaGroup=MAIN, salience=0, no-loop=false]
      22:20:59,435 ERROR [STDERR] Rule Compilation error : [Rule name=Credit Allowed, agendaGroup=MAIN, salience=0, no-loop=false]
      com/beancreation/Rule_Credit_Allowed_0.java (1:0) : The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
      com/beancreation/Rule_Credit_Allowed_0.java (1:8) : The package com.beancreation collides with a type
      com/beancreation/Rule_Credit_Allowed_0.java (2:34) : The import com.beancreation cannot be resolved
      22:20:59,435 INFO [STDOUT] Could not parse knowledge.
      22:20:59,435 ERROR [STDERR] java.lang.IllegalArgumentException: Could not parse knowledge.
      22:20:59,435 ERROR [STDERR] at com.expertsystem.DroolsExecution.loadRules(DroolsExecution.java:49)
      22:20:59,435 ERROR [STDERR] at com.create.TestCase.run(TestCase.java:52)
      22:20:59,445 ERROR [STDERR] at org.apache.jsp.index_jsp._jspService(index_jsp.java:74)
      22:20:59,445 ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      22:20:59,445 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      22:20:59,445 ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
      22:20:59,445 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
      22:20:59,445 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
      22:20:59,445 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      22:20:59,445 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      22:20:59,445 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      22:20:59,445 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      22:20:59,445 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      22:20:59,445 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      22:20:59,445 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      22:20:59,445 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      22:20:59,445 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
      22:20:59,445 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      22:20:59,445 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      22:20:59,445 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      22:20:59,445 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      22:20:59,445 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      22:20:59,445 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
      22:20:59,445 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      22:20:59,445 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      22:20:59,445 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
      22:20:59,445 ERROR [STDERR] at java.lang.Thread.run(Thread.java:619)
      22:20:59,445 ERROR [STDERR] java.lang.IllegalArgumentException: Could not parse knowledge.
      22:20:59,445 ERROR [STDERR] at com.expertsystem.DroolsExecution.loadRules(DroolsExecution.java:49)
      22:20:59,445 ERROR [STDERR] at com.create.TestCase.run(TestCase.java:52)
      22:20:59,445 ERROR [STDERR] at org.apache.jsp.index_jsp._jspService(index_jsp.java:74)
      22:20:59,445 ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      22:20:59,445 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      22:20:59,445 ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
      22:20:59,445 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
      22:20:59,445 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
      22:20:59,445 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      22:20:59,445 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      22:20:59,445 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      22:20:59,445 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      22:20:59,445 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      22:20:59,445 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      22:20:59,445 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      22:20:59,445 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      22:20:59,445 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
      22:20:59,445 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      22:20:59,445 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      22:20:59,445 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      22:20:59,445 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      22:20:59,445 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      22:20:59,445 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
      22:20:59,445 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      22:20:59,445 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      22:20:59,445 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
      22:20:59,445 ERROR [STDERR] at java.lang.Thread.run(Thread.java:619)

      This is the error given When i use Drools5 on simple java application which does not require JBoss application server

      java.lang.NullPointerException
      at org.drools.base.ClassFieldAccessorStore.getClassObjectType(ClassFieldAccessorStore.java:245)
      at org.drools.base.ClassFieldAccessorStore.getClassObjectType(ClassFieldAccessorStore.java:231)
      at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:184)
      at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:104)
      at org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.java:69)
      at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:68)
      at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:1191)
      at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:662)
      at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:284)
      at com.create.DroolsExecution.loadRules(DroolsExecution.java:41)
      at com.create.TestCase.main(TestCase.java:54)
      java.lang.NullPointerException
      at org.drools.base.ClassFieldAccessorStore.getClassObjectType(ClassFieldAccessorStore.java:245)
      at org.drools.base.ClassFieldAccessorStore.getClassObjectType(ClassFieldAccessorStore.java:231)
      at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:184)
      at org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:104)
      at org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.java:69)
      at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:68)
      at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:1191)
      at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:662)
      at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:284)
      at com.create.DroolsExecution.loadRules(DroolsExecution.java:41)
      at com.create.TestCase.main(TestCase.java:54)

        Attachments

        1. JavaApplication.rar
          10 kB
        2. rule3.drl
          0.2 kB
        3. rules2.drl
          0.2 kB
        4. SampleApp.rar
          14 kB

          Activity

            People

            Assignee:
            mfusco Mario Fusco
            Reporter:
            aptritchie Shawn Ritchie (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: