Scheduled Event not successful

4
I have an event that retrieves some data from a different system using olap connection - I know that the microflow and java-action work because when attached to a button the query runs successfully and imports data into the mendix system. However when I run a scheduled event with the same microflow that calls the same java action it never completes. I tried to use eclipse for debugging and it seems to fail on the commit line: Core.commit(this.getContext(),ticket.getMendixObject()); -> it says that local variables are unavailable solution As identified by Achiel there is no user during a scheduled event so i created a microflow checking whether there is a currentuser before executing the java action. In case of an event I am retrieving a user which I created specificly for this one purpose.
asked
4 answers
4

What does

audittrail.log.CreateLog.<init>(CreateLog.java:36)

do? I mean, what does this line of code (line 36) do exactly? Can you post some code?

Edit to respond to extra answer by Karol: You're getting a nullpointer because you're executing it from an environment where there is no user. To be exact:

this.userObject = this.context.getSession().getUser()

returns null, because a scheduled event has no user. So when you try calling getMendixObject() on that it will cause a nullpointer, which in turn causes your stacktrace.

answered
4

I don't really understand why your scheduled event isn't working. But i can help you with your eclipse problem.

The reason why eclipse gives that message while debugging is because the modeler/XAS has compiled your code. Eclipse can only understand his own compiled code.
The workaround is, start your project from eclipse as usual. But before you execute your flow, you have to clean your project ( menu item project / clean ). This triggers eclipse to re-compile all java.
This way eclipse is the last one who compiled your action and you can debug it as usual.

answered
0

usually when I run the microflow/java-action via button and get to the commit line in eclipse and select 'step over' (F6) it continues on to the next line of code - when debugging the scheduled event it doesnt continue on to the next line of code but steps through the line - going through thread[pool-3-thread#] ... kind of gets stuck somewhere there

I also get this stack trace in the consol log:

answered
0

this.userObject = this.context.getSession().getUser().getMendixObject();

its in the constructor:

public CreateLog(IMendixObject inputObject, IMendixObject logObject, IContext context){

    this.inputObject = inputObject;
    this.logObject = logObject;
    this.context = context;
    this.userObject = this.context.getSession().getUser().getMendixObject();



    logObject.setValue(this.context, Log.MemberNames.DateTime.toString(), new Date());
    logObject.setValue(this.context, Log.MemberNames.Time.toString(), this.parseTime(new Date()));
    logObject.setValue(this.context, Log.MemberNames.LogObject.toString(), inputObject.getType());
    logObject.setValue(this.context, Log.MemberNames.Log_User.toString(), userObject.getId());
    logObject.setValue(this.context, Log.MemberNames.ObjectID.toString(), ""+ inputObject.getId().getObjectStoreId());
}
answered