0

when i modified the default constructor function of class, then i created a new object in drl file.The error occured,like this: the source attachment does not contain the source for file AbstractWorkingMemorry.class

the code is:

public static class Message {

    public static final int HELLO = 0;
    public static final int GOODBYE = 1;

    private String message;

    private int status;

    public String getMessage() {
        return this.message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public int getStatus() {
        return this.status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    Message(String message, int status){
        this.message = message;
        this.status = status;
    }
}

the drl file content:

rule "init"
    when
        eval(true);
    then
        Message message = new Message("s", 1);
        message.setMessage("Hello Xiaodong");
        message.setStatus(Message.HELLO);

        insert(message); 
end

How to deal with the problem?

虫子樱桃
  • 102
  • 6
  • `AbstractWorkingMemory` is in drools-core, not knowledge-api (because it's not part of the public API). But I don't see why you 'd need the source file of it or how your code could trigger that sort of exception. – Geoffrey De Smet Jul 31 '12 at 11:54

1 Answers1

0

Either make your Message constructor public:

public Message(String message, int status){
    this.message = message;
    this.status = status;
}

and import Message in your DRL and make it a non-static class.

Or start your DRL by declaring that it's in the same package as Message and make it a non-static class.

Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120