Client code using RuleAgent API - Guvnor 5.1.1 - getting 401 error
by Achyutha, Venkata
Hi,
This error would be basic one but it's very frustrating to me to debug this, few days ago it use to work.
I deployed guvnor 5.1.1 war into web logic 10.3, created package with 4 rules, build and deploy, got package url.
Started using package url in properties file and passing file to RuleAgent api, suddenly it started giving HTTP response code: 401 for URL.
Any thoughts on this issue would be greatly appreciated.
Below is the content of properties file and Client code.
{url=http://10.117.39.51:7001/Guvnor5.1.1/org.drools.guvnor.Guvnor/package/com.tmobile.pos.rules/LATEST , name=myrules, username=weblogic, poll=30, newInstance=true, localCacheDir=C:\Installed\workspaces\drools\POC\bin, workspacepath=C://bea/user_projects/domains/posdomain, password=weblogic123, enableBasicAuthentication=true}
Error:
RuleAgent(myrules) INFO (Fri Nov 26 15:19:00 IST 2010): Configuring with newInstance=true, secondsToRefresh=30
RuleAgent(myrules) INFO (Fri Nov 26 15:19:00 IST 2010): Configuring package provider : URLScanner monitoring URLs: http://10.117.39.51:7001/Guvnor5.1.1/org.drools.guvnor.Guvnor/package/com... with local cache dir of C:\Installed\workspaces\drools\POC\bin
RuleAgent(myrules) EXCEPTION (Fri Nov 26 15:19:01 IST 2010): Server returned HTTP response code: 401 for URL: http://10.117.39.51:7001/Guvnor5.1.1/org.drools.guvnor.Guvnor/package/com.... Stack trace should follow.
java.io.IOException: Server returned HTTP response code: 401 for URL: http://10.117.39.51:7001/Guvnor5.1.1/org.drools.guvnor.Guvnor/package/com...
Client Code: (getting error at 3rd line)
File file = new File("C:\\guvnor.properties");
properties.load(new FileInputStream(file));
RuleAgent agent = RuleAgent.newRuleAgent(properties);
RuleBase ruleBase = agent.getRuleBase();
WorkingMemory workingMemory = ruleBase.newStatefulSession();
Thanks
Kumar
14 years, 6 months
Classloading error with AspectJ and Drools 5.2.0.Final
by Steven Williams
Hi,
I have just upgraded to Drools 5.2.0.Final and am getting a weird error when
running unit tests.
java.lang.NullPointerException
at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.parseDefinitions(
ClassLoaderWeavingAdaptor.java:251)
at org.aspectj.weaver.loadtime.DefaultWeavingContext.getDefinitions(
DefaultWeavingContext.java:130)
at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.initialize(
ClassLoaderWeavingAdaptor.java:161)
at
org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializedClassLoaderWeavingAdaptor.initialize(
Aj.java:271)
at
org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializedClassLoaderWeavingAdaptor.getWeavingAdaptor(
Aj.java:276)
at org.aspectj.weaver.loadtime.Aj$WeaverContainer.getWeaver(Aj.java:254)
at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:90)
at org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(
ClassPreProcessorAgentAdapter.java:54)
at sun.instrument.TransformerManager.transform(TransformerManager.java:169)
at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:365
)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at org.drools.rule.JavaDialectRuntimeData$PackageClassLoader.fastFindClass(
JavaDialectRuntimeData.java:570)
at org.drools.util.CompositeClassLoader$CachingLoader.load(
CompositeClassLoader.java:258)
at org.drools.util.CompositeClassLoader$CachingLoader.load(
CompositeClassLoader.java:241)
at org.drools.util.CompositeClassLoader.loadClass(
CompositeClassLoader.java:88)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.drools.rule.JavaDialectRuntimeData.wire(
JavaDialectRuntimeData.java:405)
at org.drools.rule.JavaDialectRuntimeData.wire(
JavaDialectRuntimeData.java:396)
at org.drools.rule.JavaDialectRuntimeData.onBeforeExecute(
JavaDialectRuntimeData.java:237)
at org.drools.rule.DialectRuntimeRegistry.onBeforeExecute(
DialectRuntimeRegistry.java:132)
at org.drools.compiler.PackageBuilder.reloadAll(PackageBuilder.java:796)
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:751)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(
PackageBuilder.java:360)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(
PackageBuilder.java:538)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(
KnowledgeBuilderImpl.java:28)
at au.com.promedicus.rules.KnowledgeBaseBuilder.addPackagesFromList(
KnowledgeBaseBuilder.java:108)
at au.com.promedicus.rules.KnowledgeBaseBuilder.build(
KnowledgeBaseBuilder.java:69)
at au.com.promedicus.rules.KnowledgeBaseBuilder.build(
KnowledgeBaseBuilder.java:54)
I have traced the problem to org.drools.rule.
JavaDialectRuntimeData$PackageClassLoader.getResources. This returns null
whereas AspectJ expects it to at least return an empty enumeration - hence
the NPE. Interestingly the problem does not occur when running our server,
however we can't upgrade unless our unit tests pass and we can't easily turn
off aspectj for these.
regards
Steve
14 years, 6 months
Insert a fact into drools server from a web application or java application
by kkelleyjr
Ok, I have read the documentation like a million times. I have looked at all
the examples. Yet I still can not figure out how to add a fact to the drools
server ksession1 from a web application or a java application. I have got
the server to work. I have even got the soapUI to work. now I want to add a
fact from my own client.
My issue is that I need to add a facts that has maps and list in the pojo.
how can I just add the pojo to the ksession1? Is there an example that is
out there that I have not found?
It seems simple, but I just do not understand... can someone provide some
additional help, please?
--
View this message in context: http://drools.46999.n3.nabble.com/Insert-a-fact-into-drools-server-from-a...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 6 months
Drools Execution Server memory leak?
by Mike Reynolds
Using: 5.2.0.Final of drools camel server , JSON api, and a Stateless Session
We are making JSON calls to the camel (execution) server. Our
end-to-end unit tests pass. Our load tests, however, show that memory
is never reclaimed after each call to the rules engine. After parsing
through a heap dump, we see the following path taking up over 800 meg of
memory:
(kagent) KnowledgeAgentImpl$ChangeSetNotificationDetector
> (kbase) KnowledgeAgentImpl
>> (ruleBase) KnowledgeBaseImpl
>>> (eventSupport) ReteooRuleBase
>>>> (listeners) RuleBaseEventSupport
>>>>> (array) CopyOnWriteArrayList
>>>>>> ReteooWorkingMemory (around 864K of these)
The rule base is very small and simple - this is only a problem during a load test (or over the course of a weeks worth of calls). We make the following call 10K times:
{
"batch-execution": {
"lookup": "ksession1",
"commands": [
{
"insert": {
"out-identifier": "tc_1",
"object": {.....}
}}]}}
The knowledge-services.xml configures :
- kagent id="agent1" kbase="kbase1" new-instance="true"
- ksession id="ksession1" type="stateless" kbase="kbase1" node="node1"
The rules just update the inserted "timecard" fact.
Because I'm using a stateless session, I don't think I need to
dispose of the agent...and I don't think there is a way to call dispose
using the json/Execution Command api.
We are calling the camel (execution) server from a non-java
environment to process employee timecards entries and evaluate for
overtime calculations.
Thanks!
Mike
14 years, 7 months
org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[
by bhavindalal
Hello,
I am new to Drools. On starting to execute a simple program, eclipse gives
the following stacktrace as error. I even included the org.eclipse.jdt that
comes with eclipse, but it is still giving me error. Anybody please suggest
the problem. I am using Drools 5.0 and its dependencies and Eclipse Helios
java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/eclipse/jdt/core/compiler/CategorizedProblem;
at
org.drools.commons.jci.compilers.EclipseJavaCompiler$3.acceptResult(EclipseJavaCompiler.java:321)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:335)
at
org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:351)
at
org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:51)
at
org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:389)
at
org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:56)
at org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:74)
at org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:690)
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:653)
at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:290)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:488)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:40)
at com.sample.DroolsTest.main(DroolsTest.java:23)
Thanks
--
View this message in context: http://drools.46999.n3.nabble.com/org-eclipse-jdt-internal-compiler-Compi...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 7 months
how to update object modified by call to remote web service
by lhorton
We are at 5.2.0 Final
We recently moved our rules server (written in-house) to its own Tomcat
instance. Some of our existing rules call a service to modify facts. With
the move of the rules server, these calls to the service no longer happen in
the working memory of the rules server. The rule must now capture the
return from the call to the remote service, in order to see the changes made
by the remote service call.
Within the rule, this change is working fine. The RHS was:
applicationService.applyInstruction($step);
as above, the $step fact would not be updated within the rule WM now that
the service is called remotely. However, when I changed this to
$step = applicationService.applyInstruction($step);
then $step did have the changes(I am verifying this by writing debug info to
the log). BUT, the object that was passed in to execute() on the knowledge
session did NOT have the changes. I have tried several things to fix this.
one was to update($step) but this failed with "Update error: handle not
found for object," I assume because the fact handle changed in the object
returned from the service call.
I also tried some variations on retracting and inserting the step:
retract($step);
$step = applicationService.applyInstruction($step);
insert($step);
and also tried using a different variable name:
retract($step);
$step2 = applicationService.applyInstruction($step);
insert($step2);
update($step2);
both these above did not get errors, but also did not cause the updated
object to return from session.execute() call.
To summarize:
in a call to execute() on a stateless knowledge session, an object is passed
in
a rule fires that calls a remote service that modifies the object
within the rule, we catch the changed object that is returned from the
service call
within the rule, the changes to the object ARE visible
on the return from execute(), the changes are NOT visible
thanks for your help...
--
View this message in context: http://drools.46999.n3.nabble.com/how-to-update-object-modified-by-call-t...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 7 months
Drools-Fusion : Inserting an Event in to an "entry-point" stream in the RHS of a rule?? Pls help
by Chetan Mahadev
Hi
Can we insert an Event in the RHS part of a rule to an entry-point?
basically i am trying to do this. Pls let me know if this is possible? if
not any alternative approaches? Any example would be useful pls
declare TransactionEvent
@role( event )
end
$tmp : TestClass()
$tmp.message == "TRUE"
then
TransactionEvent ev1 = new TransactionEvent (); // This should be
inserted in to an entry-pont "Temporal Reasoning" stream
ev1.setMessage("Temporal Reasoning")
insert (ev1) to entry-point "Temporal Reasoning"
end
rule "Temporal Reasoning"
$tmp : TransactionEvent ( message== "Temporal Reasoning") from entry-point
"Temporal Reasoning"
then
System.out.println("Rule fired due to entry point ");
end
Regds
Chetan
14 years, 7 months
Java 1.4 Application
by Sumeet Karawal
Hi All,
I have to use Drools in a Java Application with Java version 1.4
Can I use Drools 5.0 for that or do I have to use Drools 4.0.x version?
Please help me on this.
Thanks & Regards
Sumeet Karawal
Mailto: sumeet.karawal(a)tcs.com
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
14 years, 7 months
Condition syntax to access Map
by bolsover
I'm struggling with the syntax to access a mapped object - hoping that
someone can help with this..
I have the following condition in a rule:
$a : Answer(getAnswerData().get(0).getValue_str() == "Valves")
Answer is a pojo where answerData is a Map<Integer, AnswerData>
object.
AnswerData is also a pojo and has a String variable value_str.
Rule containing this condition complies but I get the following error when I
fireAllRules
[Error: null pointer or function not found: getValue_str]
[Near : {... getAnswerData().get(0).getValu ....}]
^
[Line: 1, Column: 1]
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:997)
The method getValue_str() does exist in AnswerData as does getAnswerData()
in Answer and there are not any null values.
I'm assuming that autoboxing will correctly interpret .get(0) as an Integer
object.
Any ideas??
--
View this message in context: http://drools.46999.n3.nabble.com/Condition-syntax-to-access-Map-tp320442...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 7 months