The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

bato (12) [Avatar] Offline
#1
I’ve encountered problems with Drools Script from Listing 14.9. - alerts.drl

rule "weekdays are high priority"
   calendars "weekday"
 when
   $alert : Alert()
 then
   $alert.setSeverity"HIGH")
end

rule "weekends are low priority"
  calendars "weekday"
when
  $alert : Alert()
then
  $alert.setSeverity("LOW")
end


When I try to start mule application the following error message is thrown:

ERROR 2015-10-06 15:15:27,027 [main] org.mule.module.launcher.application.DefaultMuleApplication: null
org.mule.api.config.ConfigurationException:
Errors while parsing ruleset defined in file alerts.drl : [10,3]: [ERR 101] Line 10:3 no viable alternative at input 'calendars' in rule "weekdays are high priority"[19,2]: [ERR 101]
Line 19:2 no viable alternative at input 'calendars' in rule "weekdays are high priority" in rule "weekends are low priority"

When these rules are commented out the scrip works fine.
Have someone any idea what cause this error?

My environment is :
Anypoint Studio 5.3.0
Mule ESB and Integration Platform
Version: 3.7.0 Build: 725cbc8a
JDK: 1.8.0_05 (mixed mode)
OS: Windows 7 - Service Pack 1 (6.1, amd64)
David Dossot (233) [Avatar] Offline
#2
Mule in Action Ed2 source code has been tested against version 3.4.0. It is possible some examples do not work with version 3.7.0.

For the sake of investigations, can you try installing a 3.4.x runtime in Studio and run the example against it?
bato (12) [Avatar] Offline
#3
Mule console
[ 21 KB ]
I got the same behavior with CE 3.4.0 and java 1.6.33. I attached Mule configuration file and drools script, perhaps I overlook something. I proceed as follows: In AnypointStudio create a new Mule project and add attached files.
The project structure is simple:
+---main
| +---api
| +---app
| | mia2.xml
| | mule-app.properties
| | mule-deploy.properties
| |
| +---java
| | \---com
| | \---prancingdonkey
| | \---domain
| | Alert.java
| |
| \---resources
| alerts.drl
|
\---test
+---java
| \---com
| \---prancingdonkey
| MessageRoutingWithDroolsTest.java
|
\---resources
log4j.properties
David Dossot (233) [Avatar] Offline
#4
There should be a
src
directory at the root.

Did you use the functionality for importing a Mule Maven project?
bato (12) [Avatar] Offline
#5
Hi David
I don’t use maven for this project.
Src folder exists, the root of above listing is src folder.
When two rules with 'calendar' function are commented out everything works fine.

I proceed as follows:

1. In AnypointStudio create a new Mule project
2. add following files from the book source code
- chapter05\src\main\java\com\prancingdonkey\domain\Alert.java
- chapter05\src\main\resources\alerts.drl
3. Customize mia2.xml (see above attached file Mule configuration )
4. Start mule application. Run>Run As>Mule Aplication

the error message is thrown
David Dossot (233) [Avatar] Offline
#6
If you don't import as a Maven project, you need to make sure that:
src/main/java
src/main/resources
src/test/java
src/test/resources

are all configured as source folders on the build path.

Is this the case?
bato (12) [Avatar] Offline
#7
Mule Project
[ 11 KB ]
Yes everything is in place. See attached Mule Project
David Dossot (233) [Avatar] Offline
#8
Yes, everything looks in order. I'm sorry, I don't know why this doesn't work anymore :'(