NPE for any @role( event )
by capn_ed
I am using Drools version 5.4.0.Beta1. My rules are defined in a drl file.
I cannot get a type with @role(event) to run correctly. In every case I've
tried, I get the following error at runtime:
---------------------
java.lang.NullPointerException
at
org.drools.reteoo.ReteooFactHandleFactory.newFactHandle(ReteooFactHandleFactory.java:56)
at
org.drools.common.AbstractFactHandleFactory.newFactHandle(AbstractFactHandleFactory.java:80)
at
org.drools.common.AbstractFactHandleFactory.newFactHandle(AbstractFactHandleFactory.java:65)
at org.drools.common.NamedEntryPoint.createHandle(NamedEntryPoint.java:740)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:286)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:122)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:52)
at test.DroolsTest.main(DroolsTest.java:62)
--------------------
Looking at the source:
ReteooFactHandleFactory.java:56:
if ( type.getTimestampExtractor() != null ) {
"type" is null, hence the NPE. Tracing through in Eclipse, I find that in
ReteooFactHandleFactory.java, on line 54, is the following:
TypeDeclaration type = conf.getTypeDeclaration();
getTypeDeclaration() returns null. Stepped in, goes to
AbstractRuleBase.java:745:
public TypeDeclaration getTypeDeclaration( Class< ? > clazz ) {
TypeDeclaration typeDeclaration = this.classTypeDeclaration.get(
clazz );
if ( typeDeclaration == null ) {
// check super classes and keep a score of how up in the
hierarchy is there a declaration
TypeDeclarationCandidate candidate = checkSuperClasses( clazz );
// now check interfaces
candidate = checkInterfaces( clazz,
candidate,
1 );
if ( candidate != null ) {
typeDeclaration = candidate.candidate;
}
}
return typeDeclaration;
}
On line 746,
TypeDeclaration typeDeclaration = this.classTypeDeclaration.get( clazz );
this.classTypeDeclaration is type Map<Class< ? >, TypeDeclaration>. Map
is empty (size = 0), so the get() returns null. checkSuperClasses() and
checkInterfaces() also attempt to retrieve a TypeDeclaration from this same
(empty) map. So, a null typeDeclaration is returned.
Checking classTypeDeclaration references, the put() occurs in
AbstractRuleBase.addPackages() (AbstractRuleBase.java:476), and in
AbstractRuleBase.populateTypeDeclarationMaps() (AbstractRuleBase.java:336).
The latter is not called before the NPE. Execution in addPackages() do not
get to the classTypeDeclaration.put() because newPkg.getTypeDeclarations()
is empty. So, apparently, the TypeDeclaration is never put into the Map.
Attached is the minimal testcase that exhibits the same behavior.
http://drools.46999.n3.nabble.com/file/n3683063/TestRules.zip
TestRules.zip
--
View this message in context: http://drools.46999.n3.nabble.com/NPE-for-any-role-event-tp3683063p368306...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
Custom Evaluator compile time error, If I am upgrading from drool 5.0 to 5.3
by kashif10
Hi,
Our current code is using drools 5.0.
We have some custom evaluators, which are working fine with 5.0.
example
*Code from Rule:*
Student(code compareCode "426656000, 426979002, 427295004" )
Where Student is a class & "code" is String field in that class. &
compareCode is a custom operator using custom evaluator. as follows.
*code from OP class:*
public static final Operator COMPARE_CODE =
Operator.addOperatorToRegistry( "compareCode",
false );
*Part from Evaluator Definitions class*
private EvaluatorCache evaluators = new EvaluatorCache() {
private static final long serialVersionUID = 100L;
{
addEvaluator( ValueType.STRING_TYPE, D1Operator.COMPARE_CODE,
CodeEvaluator.INSTANCE );
}
};
public static class CodeEvaluator extends BaseEvaluator {
private static final long serialVersionUID = 100L;
public final static Evaluator INSTANCE = new CodeEvaluator();
public CodeEvaluator() {
super( ValueType.STRING_TYPE,
D1Operator.COMPARE_CODE );
}
public boolean evaluate(InternalWorkingMemory workingMemory,
final InternalReadAccessor extractor,
final Object object1,
final FieldValue object2) {
final Object value1 = extractor.getValue( workingMemory,
object1 );
//System.out.println("************* in
CodeEqualEvaluator.evaluate");
final Object value2 = object2.getValue();
if ( value1 == null ) {
return value2 == null;
}
//return value1.equals( value2 );
return Utility.checkCode((String)value2, (String)value1);
}
Problem:
Now If I update my Eclipse Drool plugin to 5.2.1 or 5.3 I start getting
error
Evaluator does not support type 'ValueType = 'Object'
see attached snapshot/
http://drools.46999.n3.nabble.com/file/n3683440/Drool_problem.jpg
Drool_problem.jpg
Thanks.
--
View this message in context: http://drools.46999.n3.nabble.com/Custom-Evaluator-compile-time-error-If-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
Rules editor in Eclipse 3.7.1 with Jboss Tools
by Jorge Riquelme
Hi people, I'm starting with Drools, and I want to install the plugin
for Eclipse (I just need the rules editor for now).
In http://www.jboss.org/drools/downloads.html says that there is a
Drools plugin for Eclipse, part of Jboss Tools. I've installed a fresh
Eclipse 3.7.1, and JBoss Tools for Indigo from the marketplace, but I
can't find any plugin or feature related to Drools. There isn't any
file association or content type provided by Jboss Tools for rules/drl
files.
Maybe I'm doing something wrong, I would appreciate some advice to get
this thing working.
thanks
pd: I'm using the following update site for Jboss Tools:
http://download.jboss.org/jbosstools/updates/development/indigo
--
Jorge Riquelme Santana
12 years, 10 months
jBPM 5.2 and Drools 5.3
by gboro54
I am working with jBPM for the first time since it was rewritten based on
Drools flow. I have a set up rules(separated with rule rule flow groups),
which need to be executed at different part of a process. If I just start
the process as such(with parameters)
ProcessInstance processInstance = this.session.startProcess(
"com.sample.process", vars);
My rules are ignored. The only thing I can do is insert the objects into
session then do the following:
ProcessInstance processInstance = this.session.startProcess(
"com.nasdaq.billing.core", vars);
session.fireAllRules();
Is this the correct way to handle this or am I missing something(the
documentation is lacking in this area).
--
View this message in context: http://drools.46999.n3.nabble.com/jBPM-5-2-and-Drools-5-3-tp3682896p36828...
Sent from the Drools: User forum mailing list archive at Nabble.com.
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
Code Coverage
by mike
Hi there,
I was wondering if its possible to measure code coverage on test running
against a set of rules.
Thank you
Mike
12 years, 10 months
DSL translation handing - what is the most stable version?
by drdaveg
I've built rules using DSL's before and with 5.3 I am seeing Eclipse hang
intermitently during builds. I've seen this in previous versions of DROOLS
so wondered what/where is the most stable version of DROOLS? I downloaded,
but have not yet installed the product version (this is for a lartge US
firm, so buying the product is feasible). They could not accept needing to
kill off processes when they build. The schedule is VERY tight so I am
asking this question while I install the product version (5.2).
The rules, XOM, and DSL are simple, so I think the parser is intermitently
generating some infinitely deep tree during builds.
--
View this message in context: http://drools.46999.n3.nabble.com/DSL-translation-handing-what-is-the-mos...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
Which version of Guvnor is compatible with Websphere Application Server 6.1 ???
by arup
I can't able deploy guvnor 5.1 in WAS 6.1. getting lots of error. can u
please let me khon which version of guvnor is most compatible with WAS
6.1???
Erros:
[1/23/12 18:51:26:015 IST] 00000022 WebApp E [Servlet
Error]-[/index.jsp]: java.lang.NullPointerException
at
org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:39)
at org.jboss.seam.web.ContextFilter.doFilter(ContextFilter.java:37)
at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
at
com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:832)
at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:679)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:565)
at
com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
at
com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:122)
at
com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:226)
at
com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionProcessor.handleRequest(AbstractJSPExtensionProcessor.java:285)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3440)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:267)
at
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:815)
at
com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1461)
at
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:118)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:267)
at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at
com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at
com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
at
com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
--
View this message in context: http://drools.46999.n3.nabble.com/Which-version-of-Guvnor-is-compatible-w...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months