in my node, I want to apply the KNIME random forest learner algorithm on my data, but when I try to import for example the TreeEnsembleLearnerConfiguration in the package org.knime.base.node.mine.treeensemble2.node.learner, I get an error saying ‘Access restriction: The type ‘TreeEnsembleLearner’ is not API’. Is it not intended by KNIME to access the random forest learner algorithm or am I doing something wrong? Also, when I modify the access rule in the treeensemble2.jar, when loading the node, I receive an error 'loader constraint violation: loader (instance of org/eclipse/osgi/internal/loader/EquinoxClassLoader) previously initiated loading for a different type with name “org/knime/base/node/mine/treeensemble2/node/learner/TreeEnsembleLearnerConfiguration” '. Thank you in advance.
yes, the package org.knime.base.node.mine.treeensemble2.node.learner is not officially exported.
Your second problem indicates that the plugin exists multiple times, and one tries to load the non-exported classes of the other.
Do you import the jar outside of the target platform?
yes, I import the jar outside of the target platform, as I thought it would be the only way to circumvent the restriction access and it worked on a previous implementation of mine. When I remove the classpath entry and the .jar from my build path, I get the expected ClassNotFoundException. Is there a way to use the methods in org.knime.base.node.mine.treeensemble2.node.learner without importing the .jar?
thank you, this resolved my problems while I am developing. Can you think of any long term solution though? Because this should make my node undeployable since every standard distribution of the treeensemble methods can’t be accessed by my node, right?
Anyways, thank you guys for all the help, now I can continue to work.
first of all, thank you so much for doing this! I am again and again surprised at the helpfulness we receive in this forum.
So far, I accessed classes in following packages: (org.knime.base.node.mine.treeensemble2.) node.predictor, learner, node.learner, sample.row;
We are happy to help , regarding your node development I want to advise you to be careful with depending on implementation details of nodes that you do not control yourself. If at a future date, this code is refactored, your nodes will break. So it might be advisable for you to just copy the classes you need instead of relying on them. The only case where you need to use the classes from the treeensemble plugin are those, where you want to interact with its nodes, for example the port type (the problem you encountered in October).