Drools verifier
by FrankVhh
Hi all,
Triggered by a post on this forum, I decided to try a testcase
implementation of Drool Verifiier.
I manage to write some code that does not produce any errors at runtime,
which is good. Unfortunately, it doesn't produce any errors/warnings/notes
on my rulefile either, which isn't good.
The drl file consists of some duplicate rules, and since the file is only
part of a ruleset, there might be some gaps as well.
I pasted the java-code below. Does anyone see where I am going wrong?
Thanks in advance!
Regards,
Frank
VerifierBuilder vBuilder =
VerifierBuilderFactory.newVerifierBuilder();
Verifier verifier = vBuilder.newVerifier();
String ruleText =
"C:\\Users\\Frank\\Documents\\DroolsWorkSpaces\\EmpiricalExperiments\\Financial
Rules\\src\\main\\rules\\clearancerules.drl";
verifier.addResourcesToVerify( ResourceFactory.newReaderResource(
new StringReader( ruleText ) ), ResourceType.DRL );
verifier.fireAnalysis();
VerifierReport result = verifier.getResult();
for(VerifierMessageBase base: result.getBySeverity(
Severity.ERROR ) ){
System.out.println( base );
}
for(VerifierMessageBase base: result.getBySeverity(
Severity.WARNING ) ){
System.out.println( base );
}
for(VerifierMessageBase base: result.getBySeverity( Severity.NOTE )
){
System.out.println( base );
}
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-verifier-tp268...
Sent from the Drools - User mailing list archive at Nabble.com.
12 years, 5 months
Challenge! Using javassist and drools presents an issue with drl
by markricard
In order to make writing drl files easy and not requiring writers to be
developers, I have written some JavaAssist code that dynamically creates a
subclass and new methods in memory.
If for example there is a REAL java class called 'com.foo.Instance'. Via
javasssist, I create a new in-memory subclass called 'com.foo.InstanceEx'.
The new class dynamically creates a new getter called getFoo(). The drl
writer would like to directly reference 'foo' in the drl file like so:
when
i : Instance(foo == 'fee')
The problem is, in order to reference foo, I would need the drl file to do
this:
import com.rrd.xspace.drools.InstanceEx;
But I cannot do that because InstanceEx does not exist at runtime. The
error I get, which is an obvious one, is "Unable to create Field Extractor
for 'foo' of '[ClassObjectType class=com.foo.Instance]' in rule 'Test' :
[Rule name='Test']"
Is there a way to include a dynamic import of a JavaAssist class while I am
constructing the KnowledgeBase instances to run the rules so that I can
reference that new method?
I would hope to have something similar to:
KnowledgeBuilder kbuilder = ....
kbuilder.addImport("com.foo.InstanceEx")
or
kbuilder.addClass(Class.forName("com.foo.InstanceEx"))
Any help GREATLY appreciated.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Challenge-Using-javas...
Sent from the Drools - User mailing list archive at Nabble.com.
12 years, 6 months
Bug with BatchExecutionHelper when using Log4j rootlogger?
by dunnlow
Hi,
I have a small drools client that sends a pojo to a Drools Server using
xstream:
MyBean mb = new MyBean();
List<Command> cmds = new ArrayList<Command>();
InsertObjectCommand insertCmd = (InsertObjectCommand)
CommandFactory.newInsert(mb);
insertCmd.setOutIdentifier("inserter");
insertCmd.setEntryPoint("Default");
cmds.add(insertCmd);
FireAllRulesCommand fireAllRulesCommand = new FireAllRulesCommand();
cmds.add(fireAllRulesCommand);
BatchExecutionCommand command =
CommandFactory.newBatchExecution(cmds,"ksession1");
String xml BatchExecutionHelper.newXstreammarshaller().toXML(command); *<--
this XML is sent to the server*
..........8<
Pretty standard, I think. It works just fine and I get a http 200 response
back from my server.
HOWEVER, if I add log4j (log4j.1.2.14.jar) and a log4j.properties that has a
root logger (set to any level) the XML produced includes an "appenderList"
which seems to be trying to stream the log4j appenders (e.g.
org.apache.log4j.ConsoleAppender). I'm guessing these are not serializable
(no surprise there) and the server complains about the XML. (fyi, the same
log4j jar is on the drools server)
Is this a known issue/expected? I can comment out the root logger and
everything is back to ok.
Thanks for any insight,
-J
--
View this message in context: http://drools.46999.n3.nabble.com/Bug-with-BatchExecutionHelper-when-usin...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 9 months
Re: [rules-users] Error running Drools 5.0 HelloWorldExample on WebSphere 6.1
by Blythe, Marshall
A quick follow-up: this error occurs only when I have rules using the MVEL dialect. I rewrote the MVEL rule in the HelloWorld.drl to use the Java dialect, and now the problem is gone. I may need to raise this issue on the MVEL mailing list instead.
----------------------------------------- This e-mail and any attachments may contain CONFIDENTIAL information, including PROTECTED HEALTH INFORMATION. If you are not the intended recipient, any use or disclosure of this information is STRICTLY PROHIBITED; you are requested to delete this e-mail and any attachments, notify the sender immediately, and notify the LabCorp Privacy Officer at privacyofficer(a)labcorp.com or call (877) 23-HIPAA.
12 years, 9 months
Camel-drools example
by Serge Vilvovsky
Can anybody provide, please, the example of using camel with drools? Where
should I place the drool files if I run them in ServiceMix?
Thank you!
12 years, 10 months
ruleflow and bpmn files issues with drools and guvnor 5.2 final
by style.x7
Hi all,
I've tried drools 5.2 final version with much excitement but the default
create new drools project is already giving problems:
Issue 1. Exceptions when running default created .rf and .bpmn files.
When I ran ProcessTest.java with .rf file, I get:
java.lang.NullPointerException
at
org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:516)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:556)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at com.sample.ProcessTest.readKnowledgeBase(ProcessTest.java:36)
at com.sample.ProcessTest.main(ProcessTest.java:23)
When I ran ProcessTest.java with .bpmn file, I get:
lang.IllegalArgumentException: Unable to instantiate service for Class
'org.drools.compiler.BPMN2ProcessProvider'
at org.drools.util.ServiceRegistryImpl.get(ServiceRegistryImpl.java:161)
at
org.drools.compiler.BPMN2ProcessFactory.loadProvider(BPMN2ProcessFactory.java:29)
at
org.drools.compiler.BPMN2ProcessFactory.getBPMN2ProcessProvider(BPMN2ProcessFactory.java:21)
at
org.drools.compiler.BPMN2ProcessFactory.configurePackageBuilder(BPMN2ProcessFactory.java:12)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:559)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at com.sample.ProcessTest.readKnowledgeBase(ProcessTest.java:33)
at com.sample.ProcessTest.main(ProcessTest.java:20)
Caused by: java.lang.IllegalArgumentException: Unable to instantiate
'org.jbpm.bpmn2.BPMN2ProcessProviderImpl'
at
org.drools.util.ServiceRegistryImpl$ReflectionInstantiator.newInstance(ServiceRegistryImpl.java:210)
at
org.drools.util.ServiceRegistryImpl$ReflectionInstantiator.call(ServiceRegistryImpl.java:202)
at org.drools.util.ServiceRegistryImpl.get(ServiceRegistryImpl.java:159)
... 7 more
Caused by: java.lang.ClassNotFoundException:
org.jbpm.bpmn2.BPMN2ProcessProviderImpl
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at
org.drools.util.ServiceRegistryImpl$ReflectionInstantiator.newInstance(ServiceRegistryImpl.java:207)
... 9 more
Issue 2: Guvnor 5.2 final unable to display .rf and .bpmn files
No error message was given when guvnor is unable to display .rf files. The
popup shows blank diagrams.
For .bpmn files, guvnor with designer-1.0.0.052-jboss.war shows the oryx
editor with blank diagrams, error message:
SEVERE [JbpmProfileImpl] Could not find BPMNDI information
java.lang.IllegalArgumentException: Could not find BPMNDI information
at
com.intalio.bpmn2.impl.Bpmn2JsonMarshaller.marshallProcess(Bpmn2JsonMarshaller.java:347)
at
com.intalio.bpmn2.impl.Bpmn2JsonMarshaller.marshallDefinitions(Bpmn2JsonMarshaller.java:255)
at
com.intalio.bpmn2.impl.Bpmn2JsonMarshaller.marshall(Bpmn2JsonMarshaller.java:138)
at
com.intalio.web.profile.impl.JbpmProfileImpl$2.parseModel(JbpmProfileImpl.java:197)
at
com.intalio.web.repository.impl.UUIDBasedJbpmRepository.load(UUIDBasedJbpmRepository.java:38)
at
com.intalio.web.server.UUIDBasedRepositoryServlet.doGet(UUIDBasedRepositoryServlet.java:123)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
com.intalio.web.filter.impl.PluggableFilter.doFilter(PluggableFilter.java:75)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at
org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at
org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
My development environment is eclipse 3.6, drools plugin 5.2 final, java 6,
windows 7, jboss as 5.1 jdk 6.
Any help would be greatly appreciated.
--
View this message in context: http://drools.46999.n3.nabble.com/ruleflow-and-bpmn-files-issues-with-dro...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
Difference between Rule Base and Knowledge Base
by Swapnil Sawant
Hi,
I had a very basic doubt. 'Rule Base' and 'Knowledge Base' are two different concepts (may be from implementation point of view )?
I got this doubt when I was going through section '1.4.7.2. Drools execution server' of drools guvnor (v5.0) where it was written like :
The drools execution server (drools-server) module is a war which you can deploy to execute "knowledgebases (rulebases)" remotely for any sort of client application
The thing is that , I have created Knowledge base from changeset.xml as follows :
kagent = KnowledgeAgentFactory.newKnowledgeAgent( "MyRuleAgent" );
kagent.applyChangeSet( ResourceFactory.newUrlResource( changesetUrl ) );
kbase = kagent.getKnowledgeBase();
Now if I wish to get Rule Base corresponding to my changeset(or rather my DRL file) using 'this kbase object' , how can I do that ?
Thanks,
Swapnil Sawant
This Email may contain confidential or privileged information for the intended recipient (s) If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system.
______________________________________________________________________
12 years, 10 months
proxy config for change-set schema fetch?
by Allen, Robert R
Hi All:
I'm running drools expert and guvnor on a single machine that runs
behind an authentication-required HTTP proxy to the outside world. I'm
fetching rulesets from the guvnor URL using the KnowledgeAgent. The
loading of each URL takes a consistent 3 minutes and it appears that the
delay may be from trying to fetch the xml schema which does not succeed
because the request must go to jboss thru a proxy. I get these two
messages in the log file:
(null: 1, 290): schema_reference.4: Failed to read schema document
'http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/sr
c/main/resources/change-set-1.0.0.xsd', because 1) could not find the
document; 2) the document could not be read; 3) the root element of the
document is not <xsd:schema>.
(null: 1, 290): cvc-elt.1: Cannot find the declaration of element
'change-set'.
After the delay, the parsing works correctly and the KnowledgeAgent
creates the KnowledgeBase correctly. Here is an example of the change
set being passed to the KnowledgeAgent:
<change-set xmlns='http://drools.org/drools-5.0/change-set'
xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
xs:schemaLocation='http://drools.org/drools-5.0/change-set
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src
/main/resources/change-set-1.0.0.xsd' > <add> <resource
source='http://localhost:8080/arcotadmin/org.drools.guvnor.Guvnor/packag
e/pkg1/LATEST.drl' type='DRL' basicAuthentication='enabled'
username='usr1' password='123456' /> </add> </change-set>
Questions:
1. Can I tell KnowledgeAgent to use a local file for the schema
and thereby bypass the external lookup altogether? What would the syntax
for that look like?
2. Is there a way to provide proxy information to KnowledgeAgent
or drools expert as a whole that includes authentication credentials?
Thanks,
-Robert
12 years, 10 months
drools flow - how to crate a human task form?
by gs76pl
hi,
What is the best way of creating some UI for human tasks with an input form?
I've a sample process with a human task that should update some values in
the process. I had a look into API of a task and the only thing i can find
there is 'content' which i'm not really sure about (is it the place where
for instance HTML UI should be created?) Is there any way to create this
form with some additional actions like : claim/fail etc?
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/drools-flow-how-to-cr...
Sent from the Drools - User mailing list archive at Nabble.com.
12 years, 10 months