I am having trouble to deserialize JSON in KNIME but the same code works outside KNIME in a unittest.
The design is fairly simple. An interface EnvironmentManager with a single getEnvironment method that prepares an environment where to run a model. This interface is implemented by,
ExistingEnvironmentManager if the directory already exists and only this directory is kept (does nothing)
ArchivedEnvironmentManager if the resources are contained in a zip archive and need to be extracted to a temporary folder
FilesEnvironmentManager: if the resources are hand picked by the user and put together in a temporary folder as environment.
In my workflow, the environment of a model stored in a JSON file in the port object looks like:
This snippet throws InvalidTypeIdException with message
Could not resolve type id āde.bund.bfr.knime.fsklab.nodes.environment.ArchivedEnvironmentManagerā into a subtype of [simple type, class de.bund.bfr.knime.fsklab.nodes.environment.EnvironmentManager]: no such class found
This sounds similar to an issue Iāve had a few years ago (so a bit hazy on the details). I think my issue was caused by OSGi classpaths and Jackson not having access to the classes provided in another plugin which are provided by a different ClassLoader(?).
Sorry itās not more helpful but maybe a pointer in the right direction?
The out of KNIME test that works is still using an OSGi dependency for jackson?
That to me would indicate itās not inherently an issue through loading in different OSGi plugins then unless this is handled different for the test code.
Iād be tempted to test out quickly deploying jackson libs manually into your plugin doing the deserialisation just to double check though.
You can test the eclipse dependency resolution / classloading if your run the unit test as a Junit plug-in test. That is an option that should be available to you in the run as context menu.