external jar / Class path problem in custom node.

I'm trying to invoke the java GATK tool ( https://www.broadinstitute.org/gatk/ ) from a custom node in knime. 

I put the jar of GATK in another plugin and I added it as a dependency of my node-plugin.

I can see the plugin-icon in the knime workbench, I can drag the icon into my workflow etc...

But when GATK is invoked, I think GATK tries to find a sub-program using java annotations in its own jar and cannot find it.

code in my NodeModel.execute():

    		org.broadinstitute.gatk.engine.CommandLineGATK instance=
    				 new org.broadinstitute.gatk.engine.CommandLineGATK();
    	final String args[]={"-T","SelectVariants"};
    	org.broadinstitute.gatk.engine.CommandLineGATK.start(instance, args);



org.broadinstitute.gatk.utils.exceptions.UserException$MalformedWalkerArgumentsException: Invalid command line: Malformed walker argument: Could not find walker with name: SelectVariants
	at org.broadinstitute.gatk.utils.classloader.PluginManager.createByName(PluginManager.java:285)
	at org.broadinstitute.gatk.engine.GenomeAnalysisEngine.getWalkerByName(GenomeAnalysisEngine.java:335)
	at org.broadinstitute.gatk.engine.CommandLineExecutable.getArgumentSources(CommandLineExecutable.java:210)
	at org.broadinstitute.gatk.utils.commandline.CommandLineProgram.start(CommandLineProgram.java:205)
	at org.broadinstitute.gatk.utils.commandline.CommandLineProgram.start(CommandLineProgram.java:155)
	at mypackage.test.TestNodeModel.execute(TestNodeModel.java:84)
	at org.knime.core.node.NodeModel.execute(NodeModel.java:719)
	at org.knime.core.node.NodeModel.executeModel(NodeModel.java:563)
	at org.knime.core.node.Node.invokeFullyNodeModelExecute(Node.java:1141)
	at org.knime.core.node.Node.execute(Node.java:933)

Is there a way to set fix this, changing the classloader ? changing the way the plugin(s) is/are packaged ?

Hard to say what's going on here. My guess would be that the GATK library is making some assumptions about the classpath/classloaders that are not true in an OSGi environment. A bit of debugging in the GATK calls should give you the answer.