NodeView instantiation failed after reloading workflow

#1

Hi,

The nodeView works fine when I executes the NodeModel directly. However, I get one exception with loading NodeView. It says

View instantiation failed: null

I track down the codes and find out the related parameters passed from NodeModel are null. Those parameters are :

  1. Input PortObject []
  2. Result OutputPortObject []

So my questions are, how to pass those parameters to NodeView?

  • One possible solution could be to re-execute the NodeModel, and get refresh NodeView again. But how to trigger this re-excution while we already have the result in the stored workflow?
  • Another solution is to get the Input PortObject[] and OutputPortObject[] in NodeView or NodeFactory, but how?

Regards
Kefang

0 Likes

#2

One similar situation is to show the view for Output PortObject[] while the Input PortObject[] is necessary to show.
It works fine if we get the View directly after executing node. But I couldn’t get the View for Output PortObject[] when reopening the workflow with executed state.

0 Likes

#3

Hi Kefang,

Can you post a link to your github with a node that has this issue? Then I can take a look at this problem.

best,
Gabriel

2 Likes

#4

Hello, @gab1one,

Thanks very much!! Really kind of you !
One example of the the NodeView is
TesterCCNodeView
It gets the Input PortObject[] from NodeModel

AcceptingPetriNet anet = nodeModel.getNetPO().getANet();
XLog log = nodeModel.getLogPO().getLog();

After closing and reopening the workflow, TesterCCNodeView couldn’t generate the graph since the Input PortObject[] are null.

The test workflow looks like this,

Regards
Kefang

1 Like

#5

Hi Kefang,
I tried to import your project into my eclipse installation, but encountered a bunch of problems related to mixed up version numbers and missing dependencies. I was able to fix the first issue, see this PR: https://github.com/pm4knime/pm4knime-development/pull/2
But you still need to locate and add the jar containing the type com.fluxicon.slickerbox.factory.SlickerFactory to the project for it to be buildable.
Once that is done I can take another look at the project.

best,
Gabriel

0 Likes

#6

Hi @gab1one,

The first version stuff is because I have changed some version partially. Have done it in the local version but not pushed to github.
(If I could ask further, how did you change version?? I did it manually, I wonder if it can be changed automatically?? )

Secondly, the problem about com.fluxicon.slickerbox.factory.SlickerFactory is due to the absent of the library folder which is not uploaded in github. Because they are so many jars in need, so I kept them in local. But as I tested so far, there is no conflict with the library.

Anyway, what I want to know is the general solution about the accessing Input PortObject[] and Output PutObject[] in NodeView.

Best
Kefang

0 Likes

#7

Hi Gabriel,

have uploaded the necessary jars of lib in github, have a look at this please.

Kefang

0 Likes

#8

I used some command line tools to search all occurrences of the old version string and replace them with the new one.

I took a look at your code and found a solution, as you are using the portobjects in your view, your NodeModel needs to implement the PortObjectHolder interface. It defines methods for restoring the port objects, take a look at the following example on how to implement them.

public class TesterCCNodeModel extends NodeModel implements PortObjectHolder {

// Other implementation 

@Override
public PortObject[] getInternalPortObjects() {
	return new PortObject[] {logPO, netPO};
}

@Override
public void setInternalPortObjects(PortObject[] portObjects) {
	logPO = (XLogPortObject) portObjects[0];
	netPO = (PetriNetPortObject) portObjects[1];
}
}

best,
Gabriel

1 Like

#9

Hi, Gabriel,

Thanks for your reply. Before I will try it later, additonal questions are :

  • does the interface PortObjectHolder work for Input PortObject [] as well as Output PortObject[]?? Or only Input PortObject[]
  • Does any serialization happen in those methods?

Regards
Kefang

0 Likes

#10

Hi Kefang,

  • These methods are called after execution, so you could either set them to the input or output ports, it usually makes sense to define the node view on the outputs of a node. In your case I would set the internal port objects to be the node outputs.
  • You do not to take care of the serialization, KNIME-AP will take of this for you. So yes it happens, but you do not neet to worry about it.

best,
Gabriel

1 Like

#11

Toll!! Thanks you a lot!!
Kefang

1 Like