Node cannot be created

Hi, I confronted one error when I developed customized node in Eclipse.
Node cannot be created due the following reason: XXXXX/MyParameter. which is set into null as one class attribute in NodeModel at first, and configured later by using information from Dialog.

When I debug it, I can not step into NodeModel, it goes into exception procedure. so no useful information returned about MyParameter.

My questions come,

  1. what kind of reasons to make a node not created with respect with object attributes??
  2. why the debug failed in Eclipse?? Although there are information in KNIME Error Log, says FrameworkEventError, detail in belowā€¦But when it concerns to other nodes, it works. Then I think the frame is fine, right??

What should I do to find out the problems??

Sincere Regards
Kefang

Some copy from KNIME Error Log:
eclipse.buildId=unknown
java.version=1.8.0_191
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments: -product org.knime.product.KNIME_PRODUCT
Command-line arguments: -product org.knime.product.KNIME_PRODUCT -data /home/dkf/ProcessMining/programs/KNIME_Development/ā€¦/runtime-KNIME -dev file:/home/dkf/ProcessMining/programs/KNIME_Development/.metadata/.plugins/org.eclipse.pde.core/KNIME Analytics Platform/dev.properties -os linux -ws gtk -arch x86_64 -consoleLog

org.knime.workbench.ui
Error
Thu Feb 28 14:50:03 CET 2019
FrameworkEvent ERROR

org.osgi.framework.BundleException: Could not resolve module: org.knime.workbench.ui [223784]
Another singleton bundle selected: osgi.identity; type=ā€œosgi.bundleā€; version:Version=ā€œ3.7.0.v201809260727ā€; osgi.identity=ā€œorg.knime.workbench.uiā€; singleton:=ā€œtrueā€

at org.eclipse.osgi.container.Module.start(Module.java:444)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1550)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

Have you tried configuring a breakpoint for NullPointerException (caught and uncaught) and seeing if that throws anything up? You will almost certainly get a few spurious ones during the startup but it may also show you somewhere where your parameter is being accessed before you are expecting.

I dont hold out a huge amount of hope for this though, as the FrameworkException looks like something different is going wrong

Steve

Hi, Steve,

Before I set it into Null for one of my parameter, I couldnā€™t step into the NodeModel, it jumped already into the bug. Then I changed some library which relates to my parameter, it steps into NodeModel class, and everything begins to work.

I wonder if there is some errors with java link, which I can debug into the class. Although, in Eclipse there is no sign for this error.

A reason with my side for node cannot be created might be ā€“ The class for NodeModel is not well created(but the error is hidden from Eclipse IDE)ā€¦
The other reasons are ??

Kefang

Hi @KFDing,

It seems like there was a problem with the dependencies of your project, that would explain the behavior. Maybe the framework could not load the class of your parameter during runtime, so it failed.
Is the node correctly created now or are you still having issues?

best,
Gabriel

Hi, Gabriel,

Do you mean framework for KNIME, not the Eclipse Framwork?? After the dependency changed, the Node can be created in KNIME, but in Error Log, one view of KNIME, there are still the same errors shown about the FrameworkEventError.

Kefang

hi, @s.roughley
When you mentioned, NullPointerException, where and how to set this?? In NodeFactory??

OK, in Eclipse, if you are not already in the ā€˜debugā€™ perspective goto Window -> Perpsective -> Open Perspective and look for Debug. You should then have a view with tabs for Variables and Breakpoints:

If NullPointerException is in the list, just tick next to it, otherwise click on the button indicated, and you should be able to find it:

image

Click on it, making sure the two check boxes at the bottom are ticked.

Then start up KNIME from eclipse in debug mode.

Steve

1 Like

Is the library you changed another eclipse project in your workspace, or are you including it as a .jar file in a lib folder in the project with the node?

If it is another workspace project, make sure you have it configured as a required dependency - otherwise the Eclipse classloader loads plugins in a pretty much random order, and so sometimes the dependency might load first, and you are OK, and other times it might load later, and you are not OK.

Steve

1 Like

@Vernalis

thanks at first. I use the debug mode but never used the Exception Caught in breakpoint. Great to know it!! :clap::clap::clap:

But the library, it is generated from another project and then put it into use manually. I think I put the same .jar twice, one is to lib folder, one is for the reference path in Build Configuration. So, according to the loader mechanism of Eclipse, it is better that I always put my /*.jar into lib folder??

Kefang

I think put it in /lib, and make sure it is included in the classpath section of the Runtime tab, and also that your lib folder is included in both source and binary builds, and in the ā€˜extra classpath entriesā€™ part of the build

Steve

1 Like

One more exception related to dependency of the *.jar file import.

ERROR KNIME-Worker-1 Node
Execute failed: Found interface org.processmining.plugins.petrinet.replayresult.PNRepResult, but class was expected

I checked online and found out the explanation quite good in this link General Situation In Jave
But I donā€™t know how to solve the problems. It is due to the loading mechanism of KNIME, or it is because of the imported *.jar file??

Regards
Kefang

From that link.,

This is a common occurence if you had a different version of a jar file on the compile time classpath than on the runtime classpath.

I would guess that maybe Eclipse is finding an two versions of the jar in different places? Not an error Iā€™ve ever seen though, so thatā€™s about as good as I can do

Steve

Jap,

The reason is found, but the solution is unclear. How to know which versions they are and how to find the location of the two version files in jar??

:thinking::thinking::thinking:

I checked the content of jar files, they have the related classed listed bellow.

The problem is already solved!!
The cause::
the library dependency on the external *.jar side. It is due to the dependency in chaos with some jar files. The error is not on KNIME side.

The solution:

  1. Obtain the right version of jar files
  • To check the files in jar, no easy way, use the command jar tf *.jar | grep XXX.
  • To check the version, use unzip -p file.jar | head
  1. inform the responsible people for those jar files development and update the *.jar files.

  2. Clean the cache of .ivy dependency to build the new version
    sometimes ivy donā€™t refresh the downloaded jar files, at least with me. So go to the cache, delete it, recompile to get the new versions.

Best
Kefang

2 Likes