Url Resource Guvnor connection + ProtocolException
by abhinay_agarwal
Hey,
I am trying to reach my guvnor repository using a very simple block of code
UrlResource urlResource = new UrlResource(url);
urlResource.setBasicAuthentication("enabled");
urlResource.setUsername("admin");
urlResource.setPassword("admin");
kbuilder.add(urlResource, ResourceType.PKG);
Now, this code works fine on standalone, but as soon as the code is deployed
with the application, it throws this exception:
*java.net.ProtocolException: Server redirected too many times (20)*
I know there is some problem with server side coding, but I am not able to
get it.
I guess, when I am trying to access the guvnor link through my application,
it gets into an infinite redirection and not able to come out from it.
Might be the Authenticator class of java.net is called and
getPasswordAuthentication() fails, but since I am not an expertise in this
locale so facing issue to resolve it.
Any help is welcome.
Regards,
Abhinay
--
View this message in context: http://drools.46999.n3.nabble.com/Url-Resource-Guvnor-connection-Protocol...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 6 months
Knowledge base Import/Export?
by gilbertoy
Good afternoon everyone,
Since I am inexperienced on using Drools, I would like to ask an
information:
There is a way to export and import rules, variables and such ? I would like
to try using Drools Guvnor validations on another software knowledge base,
but for this I would have to implement a way to both programs communicate
with each other.
There is a something like that already implemented on Drools or it would be
necessary to create a way from scratch?
Any information will be helpful and appreciated.
Thanks in advance!
Yours sincerely,
Gilberto.
--
View this message in context: http://drools.46999.n3.nabble.com/Knowledge-base-Import-Export-tp4024151....
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 6 months
Setting a value in LHS
by stephen.masters
Hi folks,
Is there a decent way to set a value in the LHS of a rule so that it's available in the RHS?
Reason being I have a DSL driving the guided rules editor which will pluck out the value of a field, where the name of that field is driven by a drop down menu enumeration.
A change I now have would be a lot easier if I could assign a string to a variable in the LHS, which could be read by the RHS. Otherwise I might need to extend the RHS DSLs to include the same enumeration as the LHS. Which looks a bit redundant for a business user wondering why the need to write the same thing twice.
Any thoughts?
Steve
Sent from Samsung Mobile
12 years, 6 months
Separate selectable drl files in drools kbase.. Or agenda groups
by Ramon Buckland
Hi,
I am using a Stateless Knowledge session backed behind a web rest api.
The rest api is provided by spring Mvc, so I have a stateless ksession
injected in.
As it is stateless, I have found it difficult to use agenda groups to
meet my need. And have a question to how I set this up.
My task.
In short, I have 10 or so set up rules (init rules), then a 300 odd
(work) rules, then I need to fire a few (5) (finalisation) rules.
They need to be processed in that order. If I were using stateful I
see how an agenda group solves that need.. In the calling java that is
nice. setFocus().. But stateless blocks that api.
So I have attempted with auto-focus..
In the DRL (from XLS) however getting the agenda group settings right
has been a small 'mare. Suffice to say I haven't got it working.
My options:
1. get agenda groups working.
2. split the three groups into 3 DRL files. and execute in sequence
each one using a different ksession for each.
--- on 1.
How would I construct the flow.. .. Do I use three separate auto focus
rules , one for each a.group and set a salience ( I don think
salience helps here ) ? How do I guarantee to stack the focus using
auto-focus to follow my ordering?
-- on 2.
Can I create a separate ksession for each DRL file (injecting them in
from spring).
--
Thoughts ? Am I solving right ?
Many thanks. Ramon
12 years, 6 months
Unsubscribe
by Deepak Gmail
On 4 Jun 2013, at 17:00, rules-users-request(a)lists.jboss.org wrote:
> Send rules-users mailing list submissions to
> rules-users(a)lists.jboss.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.jboss.org/mailman/listinfo/rules-users
> or, via email, send a message with subject or body 'help' to
> rules-users-request(a)lists.jboss.org
>
> You can reach the person managing the list at
> rules-users-owner(a)lists.jboss.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of rules-users digest..."
>
>
> Today's Topics:
>
> 1. ClassCastException due to binding (bdolbeare)
> 2. Re: Setting a value in LHS (Michael Anstis)
> 3. Re: ClassCastException due to binding (Davide Sottara)
> 4. Re: Setting a value in LHS (Stephen Masters)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 4 Jun 2013 08:12:09 -0700 (PDT)
> From: bdolbeare <bdolbeare(a)yahoo.com>
> Subject: [rules-users] ClassCastException due to binding
> To: rules-users(a)lists.jboss.org
> Message-ID: <1370358729183-4024115.post(a)n3.nabble.com>
> Content-Type: text/plain; charset=us-ascii
>
> We have a need to support binds for conditional or elements so that we can
> describe why a rule fired in the then clause of a rule. The following DRL
> is a simple example of what we are trying to do. There are two versions of
> our rule in the DRL:
>
> *rule "WORKING: find with or"*: works but only because the first variable
> we try to bind in the or expression is of type "target" which is a super
> class of the other elements in the or expression.
>
> *rule "BROKEN: find with or"*: causes a class cast exception when the
> "bar" pattern is matched because the then clause tries to store the bar
> object in handle "x" which it thinks is of type "foo".
>
> Is there a way to define the object type for the bind variable?
>
> Is there any other way to make something like this work?
>
>
>
> package tests
>
> import org.apache.log4j.Logger;
>
> global Logger log
>
> declare target
> notreal : boolean
> end
>
> declare foo extends target
> foovalue : String
> end
>
> declare bar extends target
> barvalue : String
> end
>
> rule "insertdata"
> when
> then
> insert(new foo(false, "a"));
> insert(new bar(false, "b"));
> end
>
> rule "WORKING: find with or"
> when
> ( or x: target(notreal)
> x: foo(foovalue == "a")
> x: bar(barvalue == "b")
> )
> then
> log.info("i found object: " + x);
> end
>
> rule "BROKEN: find with or"
> when
> ( or
> x: foo(foovalue == "a")
> x: bar(barvalue == "b")
> )
> then
> log.info("i found object: " + x);
> end
>
>
>
> Exception executing consequence for rule "find with or" in tests:
> java.lang.ClassCastException: tests.bar cannot be cast to tests.foo
> at
> org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
> at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1283)
> at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1209)
> at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1442)
> at
> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:710)
> at
> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:674)
> at
> org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:230)
> at
> org.drools.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:278)
> at tests.DroolsTest.testStateless(DroolsTest.java:120)
> at tests.DroolsTest.runTest(DroolsTest.java:74)
> at tests.DroolsTest.main(DroolsTest.java:59)
> Caused by: java.lang.ClassCastException: tests.bar cannot be cast to
> tests.foo
> at
> tests.Rule_find_with_or_411ee1c99de54340945b2b707ad0a576DefaultConsequenceInvoker.evaluate(Unknown
> Source)
> at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1273)
> ... 9 more
>
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/ClassCastException-due-to-binding-tp402...
> Sent from the Drools: User forum mailing list archive at Nabble.com.
>
>
> ------------------------------
>
> Message: 2
> Date: Tue, 4 Jun 2013 16:33:11 +0100
> From: Michael Anstis <michael.anstis(a)gmail.com>
> Subject: Re: [rules-users] Setting a value in LHS
> To: "stephen.masters" <stephen.masters(a)me.com>, Rules Users List
> <rules-users(a)lists.jboss.org>
> Message-ID:
> <CAAG9P0uZO_-sskN_1V1uQFXzWuAxCosx=v+i+SVfZ0VHysQKjQ(a)mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> This would need to be provided by the tooling; I don't think it's something
> that's even remotely possible at runtime (unless you stored the field name
> in a Fact and used reflection on the RHS).
>
> That said (and you're going to guess my next comment) this is not provided
> in the guided editors. Depending on how complex your DSLs are and whether
> users need to combine DSL Sentences; IDK if a "cheat" works:
>
> [when]Do something with {field} and {value}=$f : Fact({field}=={value} then
> $f.{field} = {value}
>
> I've not tried it; nor know whether it fits your requirements.. but a hack
> worth trying?
>
>
> On 3 June 2013 17:40, stephen.masters <stephen.masters(a)me.com> wrote:
>
>> Hi folks,
>>
>> Is there a decent way to set a value in the LHS of a rule so that it's
>> available in the RHS?
>>
>> Reason being I have a DSL driving the guided rules editor which will pluck
>> out the value of a field, where the name of that field is driven by a drop
>> down menu enumeration.
>>
>> A change I now have would be a lot easier if I could assign a string to a
>> variable in the LHS, which could be read by the RHS. Otherwise I might need
>> to extend the RHS DSLs to include the same enumeration as the LHS. Which
>> looks a bit redundant for a business user wondering why the need to write
>> the same thing twice.
>>
>> Any thoughts?
>>
>> Steve
>>
>>
>>
>>
>> Sent from Samsung Mobile
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>
12 years, 6 months
ClassCastException due to binding
by bdolbeare
We have a need to support binds for conditional or elements so that we can
describe why a rule fired in the then clause of a rule. The following DRL
is a simple example of what we are trying to do. There are two versions of
our rule in the DRL:
*rule "WORKING: find with or"*: works but only because the first variable
we try to bind in the or expression is of type "target" which is a super
class of the other elements in the or expression.
*rule "BROKEN: find with or"*: causes a class cast exception when the
"bar" pattern is matched because the then clause tries to store the bar
object in handle "x" which it thinks is of type "foo".
Is there a way to define the object type for the bind variable?
Is there any other way to make something like this work?
package tests
import org.apache.log4j.Logger;
global Logger log
declare target
notreal : boolean
end
declare foo extends target
foovalue : String
end
declare bar extends target
barvalue : String
end
rule "insertdata"
when
then
insert(new foo(false, "a"));
insert(new bar(false, "b"));
end
rule "WORKING: find with or"
when
( or x: target(notreal)
x: foo(foovalue == "a")
x: bar(barvalue == "b")
)
then
log.info("i found object: " + x);
end
rule "BROKEN: find with or"
when
( or
x: foo(foovalue == "a")
x: bar(barvalue == "b")
)
then
log.info("i found object: " + x);
end
Exception executing consequence for rule "find with or" in tests:
java.lang.ClassCastException: tests.bar cannot be cast to tests.foo
at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1283)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1209)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1442)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:710)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:674)
at
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:230)
at
org.drools.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:278)
at tests.DroolsTest.testStateless(DroolsTest.java:120)
at tests.DroolsTest.runTest(DroolsTest.java:74)
at tests.DroolsTest.main(DroolsTest.java:59)
Caused by: java.lang.ClassCastException: tests.bar cannot be cast to
tests.foo
at
tests.Rule_find_with_or_411ee1c99de54340945b2b707ad0a576DefaultConsequenceInvoker.evaluate(Unknown
Source)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1273)
... 9 more
--
View this message in context: http://drools.46999.n3.nabble.com/ClassCastException-due-to-binding-tp402...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 6 months
Re: [rules-users] StatefulKnowledgeSession and multi-threaded processing
by pprasad
Thanks for your prompt reply. I am working on a fraud system for a bank and they have around 3 millions records.
All my data is loaded to redis and I can access the key using jedis. How do I insert redis hashmap to fact in one go. I do not want to iterate for every key and insert fact individually.
Is there a way to get the instance of redis hashmap in java and insert that hashmap as a fact.
Thanks and Regards
Pradeep Prasad
Date: Sun, 2 Jun 2013 22:08:32 -0700
From: ml-node+s46999n4024076h45(a)n3.nabble.com
To: pradeep_prasad(a)hotmail.com
Subject: Re: [rules-users] StatefulKnowledgeSession and multi-threaded processing
You can do it as per my knowledge. Only thing is you will access in drl from java code. I dont think it will be an issue. but what the reason for sending hashmap as fact, You should have a different way of sending facts. As per my observation no rule needs so much of data to make a decision. It should have name value parameters to make the decision.
Hope this helps.
thankskamal.
On Sun, Jun 2, 2013 at 9:59 PM, pprasad [via Drools] <[hidden email]> wrote:
Hi,
Is it possible to insert redis hashmap as it is as fact into rule engine. I am using Jedis from java to access jedis and drool rule engine.
Also, Is there a way to access redis hashmap from drl file.
Thanks,
Pradeep
If you reply to this email, your message will be added to the discussion below:
http://drools.46999.n3.nabble.com/StatefulKnowledgeSession-and-multi-thre...
To unsubscribe from StatefulKnowledgeSession and multi-threaded processing, click here.
NAML
If you reply to this email, your message will be added to the discussion below:
http://drools.46999.n3.nabble.com/StatefulKnowledgeSession-and-multi-thre...
To unsubscribe from StatefulKnowledgeSession and multi-threaded processing, click here.
NAML
--
View this message in context: http://drools.46999.n3.nabble.com/StatefulKnowledgeSession-and-multi-thre...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 6 months