trouble adding newline to DSL
by Matt Geis
Hi,
I'm having a really strange scenario. I have a DSL entry that I need to expand onto two lines. When I write it as plain DRL, on a single line, the rule fails. When I separate it into two lines, it passes. The problem is that I'm having issues getting my DSL to insert a newline char into the drl it generates and split my resulting rule into two constraints.
Here's what I want to do... (assume the '\n actually works)
[condition][]offer with code "{offer}" and no accounts present where {constraints}=rd: RuleData(offerId == "{offer}", uc : userContext) \n not ( Account(where {constraints}) from uc.accounts)
if you put the value into a DRL rule like this, it works:
rd: RuleData(offerId == "{offer}", uc : userContext)
not ( Account(where {constraints}) from uc.accounts)
put it in like this... it fails
rd: RuleData(offerId == "{offer}", uc : userContext) not ( Account(where {constraints}) from uc.accounts)
I know that in a regex, the backslash is special, just as it is in replacement strings in Matcher.replaceAll(). What I can't figure out is how to split that line. I've tried 1, 2, 3, 4... up to 8 backslashes, and nothing works. I either get an assertion failed at the end of my test, or I get "unrecognized token" on the \ or the n .
Can someone point me in the right direction? Or, just tell me how to make the rule work all one one line!
Thanks in advance,
Matt
17 years, 6 months
Can't test drools-insurance with BRMS 4.0.7
by Fred Machin
Hi,
I can't get drools-insurance to work with the latest Drools BRMS 4.0.7. I
followed the installation instructions in the drools doc, got the
drools-insurance from SVN (trunk), installed the repository in BRMS, but
when I test it, i get the following error :
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.acme.insurance.test.SupplementalInfoTest
RuleAgent(insuranceconfig) INFO (Fri Jun 06 11:37:24 CEST 2008): Configuring
wit
h newInstance=true, secondsToRefresh=30
RuleAgent(insuranceconfig) INFO (Fri Jun 06 11:37:24 CEST 2008): Configuring
pac
kage provider : URLScanner monitoring URLs:
http://localhost:8080/drools-jbrms/
org.drools.brms.JBRMS/package/org.acme.insurance.base/InsuranceDemo
RuleAgent(insuranceconfig) EXCEPTION (Fri Jun 06 11:37:25 CEST 2008): null.
Stac
k trace should follow.
java.io.EOFException
at java.io.DataInputStream.readInt(Unknown Source)
at java.io.ObjectInputStream$BlockDataInputStream.readInt(Unknown
Source
)
at java.io.ObjectInputStream.readInt(Unknown Source)
at
org.drools.common.DroolsObjectInputStream.readInt(DroolsObjectInputSt
ream.java:517)
at
org.drools.common.DroolsObjectInputStream.readStreamHeader(DroolsObje
ctInputStream.java:204)
at
org.drools.common.DroolsObjectInputStream.<init>(DroolsObjectInputStr
eam.java:142)
at
org.drools.util.DroolsStreamUtils.streamIn(DroolsStreamUtils.java:181
)
at
org.drools.util.DroolsStreamUtils.streamIn(DroolsStreamUtils.java:150
)
at
org.drools.agent.HttpClientImpl.fetchPackage(HttpClientImpl.java:47)
at org.drools.agent.URLScanner.readPackage(URLScanner.java:139)
at org.drools.agent.URLScanner.getChangeSet(URLScanner.java:111)
at
org.drools.agent.URLScanner.loadPackageChanges(URLScanner.java:90)
at org.drools.agent.RuleAgent.checkForChanges(RuleAgent.java:330)
at org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:298)
at org.drools.agent.RuleAgent.configure(RuleAgent.java:284)
at org.drools.agent.RuleAgent.init(RuleAgent.java:208)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:176)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:148)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:216)
at
org.acme.insurance.web.InsuranceSessionHelper.loadRuleBaseFromRuleAge
nt(InsuranceSessionHelper.java:26)
at
org.acme.insurance.web.InsuranceSessionHelper.getSession(InsuranceSes
sionHelper.java:17)
at
org.acme.insurance.test.SupplementalInfoTest.setUp(SupplementalInfoTe
st.java:23)
at junit.framework.TestCase.runBare(TestCase.java:125)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.jav
a:210)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTes
tSet(AbstractDirectoryTestSuite.java:135)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(Ab
stractDirectoryTestSuite.java:122)
at org.apache.maven.surefire.Surefire.run(Surefire.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(Su
refireBooter.java:225)
at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.j
ava:747)
Tests run: 5, Failures: 0, Errors: 5, Skipped: 0, Time elapsed: 0.432 sec
<<< FA
ILURE!
Running org.acme.insurance.test.DriverTest
Tests run: 8, Failures: 0, Errors: 8, Skipped: 0, Time elapsed: 0.033 sec
<<< FA
ILURE!
Running org.acme.insurance.test.DriverAdditionalInfoTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.011 sec
<<< FA
ILURE!
Running org.acme.insurance.test.InsuranceCalculateTest
Tests run: 3, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 0.016 sec
<<< FA
ILURE!
Results :
Tests run: 17, Failures: 0, Errors: 17, Skipped: 0
[ERROR] There are test failures.
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 23 seconds
[INFO] Finished at: Fri Jun 06 11:37:25 CEST 2008
[INFO] Final Memory: 4M/13M
[INFO]
------------------------------------------------------------------------
The trunk version of drools insurance depends on drools 5.0.0-SNAPSHOT. If I
downgrade it to 4.0.7, i get a kind of Serialization exception :
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.acme.insurance.test.SupplementalInfoTest
RuleAgent(insuranceconfig) INFO (Fri Jun 06 11:51:56 CEST 2008): Configuring
wit
h newInstance=true, secondsToRefresh=30
RuleAgent(insuranceconfig) INFO (Fri Jun 06 11:51:56 CEST 2008): Configuring
pac
kage provider : URLScanner monitoring URLs:
http://localhost:8080/drools-jbrms/
org.drools.brms.JBRMS/package/org.acme.insurance.base/InsuranceDemo
RuleAgent(insuranceconfig) EXCEPTION (Fri Jun 06 11:51:57 CEST 2008):
org.drools
.rule.VariableRestriction$VariableContextEntry; local class incompatible:
stream
classdesc serialVersionUID = 4315261080934628448, local class
serialVersionUID
= -2458845645553055486. Stack trace should follow.
java.io.InvalidClassException:
org.drools.rule.VariableRestriction$VariableConte
xtEntry; local class incompatible: stream classdesc serialVersionUID =
431526108
0934628448, local class serialVersionUID = -2458845645553055486
at java.io.ObjectStreamClass.initNonProxy(Unknown Source)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at java.util.ArrayList.readObject(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readArray(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at java.util.HashMap.readObject(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at
org.drools.rule.PackageCompilationData.readExternal(PackageCompilatio
nData.java:149)
at java.io.ObjectInputStream.readExternalData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at org.drools.rule.Package.readExternal(Package.java:176)
at java.io.ObjectInputStream.readExternalData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at
org.drools.agent.HttpClientImpl.fetchPackage(HttpClientImpl.java:59)
at org.drools.agent.URLScanner.readPackage(URLScanner.java:138)
at org.drools.agent.URLScanner.getChangeSet(URLScanner.java:110)
at
org.drools.agent.URLScanner.loadPackageChanges(URLScanner.java:88)
at org.drools.agent.RuleAgent.checkForChanges(RuleAgent.java:330)
at org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:298)
at org.drools.agent.RuleAgent.configure(RuleAgent.java:284)
at org.drools.agent.RuleAgent.init(RuleAgent.java:208)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:176)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:148)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:216)
at
org.acme.insurance.web.InsuranceSessionHelper.loadRuleBaseFromRuleAge
nt(InsuranceSessionHelper.java:26)
at
org.acme.insurance.web.InsuranceSessionHelper.getSession(InsuranceSes
sionHelper.java:17)
at
org.acme.insurance.test.SupplementalInfoTest.setUp(SupplementalInfoTe
st.java:23)
at junit.framework.TestCase.runBare(TestCase.java:125)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.jav
a:210)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTes
tSet(AbstractDirectoryTestSuite.java:135)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(Ab
stractDirectoryTestSuite.java:122)
at org.apache.maven.surefire.Surefire.run(Surefire.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(Su
refireBooter.java:225)
at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.j
ava:747)
Has anyone succeeded in testing drools-insurance with BRMS 4.0.7?
Thanks
Regards,
Fred
17 years, 6 months
Re: [rules-users] Can't test drools-insurance with BRMS 4.0.7
by BrycePC
Hi,
I am currently getting the same error when trying to run insuranceDemo,
using the latest versions of components. Have you had any success since in
getting this working? It looks to me like the drools engine can't read the
repository built within BRMS, from the imported repository_export.xml...?
Regards,
Bryce
Phread wrote:
>
> Hi,
>
> I can't get drools-insurance to work with the latest Drools BRMS 4.0.7. I
> followed the installation instructions in the drools doc, got the
> drools-insurance from SVN (trunk), installed the repository in BRMS, but
> when I test it, i get the following error :
>
>
> -------------------------------------------------------
> T E S T S
> -------------------------------------------------------
> Running org.acme.insurance.test.SupplementalInfoTest
> RuleAgent(insuranceconfig) INFO (Fri Jun 06 11:37:24 CEST 2008):
> Configuring
> wit
> h newInstance=true, secondsToRefresh=30
> RuleAgent(insuranceconfig) INFO (Fri Jun 06 11:37:24 CEST 2008):
> Configuring
> pac
> kage provider : URLScanner monitoring URLs:
> http://localhost:8080/drools-jbrms/
> org.drools.brms.JBRMS/package/org.acme.insurance.base/InsuranceDemo
> RuleAgent(insuranceconfig) EXCEPTION (Fri Jun 06 11:37:25 CEST 2008):
> null.
> Stac
> k trace should follow.
> java.io.EOFException
> at java.io.DataInputStream.readInt(Unknown Source)
> at java.io.ObjectInputStream$BlockDataInputStream.readInt(Unknown
> Source
> )
> at java.io.ObjectInputStream.readInt(Unknown Source)
> at
>
--
View this message in context: http://www.nabble.com/Can%27t-test-drools-insurance-with-BRMS-4.0.7-tp176...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 6 months
MSB Example
by Steven Núñez
Greetings Drools Users,
Does anyone have, or know of, an example of using drools, fronted by a MDB?
A stateful example would be fantastic, but any example welcome. I'm under a
very tight deadline, and would like to leverage anything that's already been
done to speed things up. Production quality not required; I just need to
prove it will work.
Regards,
- Steve
--
Level 3
85 Macquarie Street
Hobart TAS 7000
Australia
Phone: +61 3 6270 2276
Mobile: +61 4 0096 4240
Fax: +61 3 6270 2223
http://illation.com.au
17 years, 6 months
The Eclipse JDT Core jar is not in the classpath
by Christopher.Mathrusse@sybase.com
I'm using JBoss Rules 4.01 with Spring 2.5 and I'm utilizing the JSR-94
interfaces provided by Spring Modules. When deploying my application I
receive the error:
The Eclipse JDT Core jar is not in the classpath
I've searched through the postings and found that setting the compiler to
drools.dialect.java.compiler should resolve the issue but I am having
trouble figuring out where to set this property on the JSR_94 interfaces.
I've tried passing a Map into
ruleAdministrator.getLocalRuleExecutionSetProvider(providerProperties);
with the following specified in my Spring configuration:
<prop key="drools.dialect.java.compiler">JANINO</prop>
but I believe the initialization occurs long before this point.
I've also tried dropping into the applications WEB-INF/lib directory a
copy of the jasper-compiler-jdt.jar into the WEB-INF/lib directory, which
should satisfy the dependency, but it didn't seem to resolve the issue. I
would prefer it if there was some way of setting this property without
having to use the JDT libraries.
I saw that I can provide system properties to make Drools aware of the req
uested compiler setting but this is not really an option as I am running
inside of a J2EE container and I am unable to modify the settings that are
provided to the application server. Is there a default location in the
classpath that Drools looks for a properties file that I can specify these
values? Or better still, is there a way that I can supplied them to the
JSR-94 interfaces to ensure proper initialization?
Thanks very much for the help.
Chris
17 years, 6 months
java.lang.StackOverflowError when serializing a RuleBase.
by Pedro Costa
Hi All,
When we try to serialize a RuleBase in a Remote EJB Call We are getting a
java.lang.StackOverflowError.
This problem only happens in HPUX, in local dev in windows works fine!
I have no idea why or what is the problems...
Any Ideas?
Thanks in advance for any help.
regards,
Pedro Costa.
java.lang.StackOverflowError
at sun.reflect.GeneratedMethodAccessor225.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:917)
at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1339)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
... LOTS ....
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
at
org.drools.common.AbstractRuleBase.doWriteExternal(AbstractRuleBase.java:195)
at
org.drools.reteoo.ReteooRuleBase.writeExternal(ReteooRuleBase.java:138)
at
java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1310)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1288)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
17 years, 6 months