Michael, Thank you for your reply. When I use the "package test" line (or whatever other package declaration) it gives the before mentioned errors. It only works when I use "package vdberg.CarsXGC.ejbcontainer.domain" which is an external package containing the domain objects (such as Situation, Element and others). Each consequence creates one or more traffic related messages or object control such as sending an email to police, firebrigade or switching on a traffic sign (which is handled in another part of the system)
The "rule engine related" classes and drl are in "vdberg.rules" the messages are in package "vdberg.rules.advice" when I use one of these packages for my drl, it will not work. I agree that the package declaration should be in the "vdberg.rules..." but it clashes with the import. With the "funny package patch" it works, but it gives me a strange feeling that something is wrong. I already tried to import classes from another packages (vdberg.CarsXGC.webcontainer.services) and it seems to work without problems. The funny thing is that the error message states "Rule Compilation error The import vdberg.CarsXGC cannot be resolved" It only mentions a part of the path of the package. As mentioned, it works for now, I will focus on defining the "traffic rules" and keep you informed! Thanks, Leo van den Berg University of Valencia - LISITT P.S. Are you interested in using the resulting "Traffic Rules" for a possible Drools tutorial? -----Mensaje original----- De: Michael Neale [mailto:[EMAIL PROTECTED] Enviado el: miƩrcoles, 26 de abril de 2006 1:52 Para: [email protected] Asunto: Re: [drools-user] I am confused so package test - is OK But package vdberg.CarsXGC.ejbcontainer.domain - is not?? Could be some freak clashing of packages, can you confirm? I am not sure if I would use the exact same package for the rules as for the classes anyway - better to have "rules" in it somewhere, but in theory, it should work. Good to hear that its working well for you ! On 4/25/06, Leo van den Berg <[EMAIL PROTECTED]> wrote: > > Dear user group, > > I have a question about the use of the package statement in Drools (3). > The application is for testing specific traffic situations (lost cargo, > accidents etc.) The traffic situation are send through JMS to the > application and at reception asserted to the workingmemory and the rules > are fired. > > > I am getting errors at the moment I try to use the package definition as > stated below. It gives the following error; > Rule Compilation error The import vdberg.CarsXGC cannot be resolved The > import vdberg.CarsXGC cannot be resolved vdberg.CarsXGC cannot be > resolved to a type Element cannot be resolved to a type Element cannot > be resolved to a type vdberg.CarsXGC cannot be resolved to a type > > When I change to the second package statement everything works as > expected. I don't understand the relation between the package > declaration and the import. The jar containing the two classes is on the > classpath. Is there something I am overlooking.. > > package test > /** package vdberg.CarsXGC.ejbcontainer.domain **/ > > import java.lang.Long > import java.lang.String > import vdberg.CarsXGC.ejbcontainer.domain.Situation > import vdberg.CarsXGC.ejbcontainer.domain.Element > import vdberg.rules.advice.AccidentManagementAdvice > import vdberg.rules.advice.IncidentManagementAdvice > import vdberg.rules.advice.AdviceSender > > rule "CheckAccident" > when > situation: Situation(actionNeeded == true ) > eval( (( Element ) > situation.getElements().get(0)).getDataObjectCode().equalsIgnoreCase("AC > C") ) > then > String id1 = " warn all emergency organisations"; > String alarm = "Accident"; > AccidentManagementAdvice advice = new > AccidentManagementAdvice(alarm, id1, situation); > AdviceSender.sendAdvice( advice ); > End > > Leo van den Berg > University of Valencia > Spain > > P.S. The application works great (with the second package statement), I > can add and change all kind of traffic situations changing only the rule > file, it's great to use Drools, Thanks! > > > > etc.. > >
