0

I'd like to schedule a KNIME workflow. The workflow does its job very good as long as I start it from the KNIME GUI application. When I execute the same workflow via command line, java complains that com.microsoft.sqlserver.jdbc.SQLServerDriver could not be found (ClassNotFoundException).

I invoke it via:

"D:\Progamme\KNIME\knime.exe" -nosplash -application -consoleLog org.knime.product.KNIME_BATCH_APPLICATION  -preferences="absolutepathto\preferences.epf" -workflowDir="absolutepathto\workflow"

Since the error message signals missing content in the java CLASSPATH I also tried to add the parameters

-vmargs -classpath .;"absolutepathto/sqljdbc42.jar"

But still I earn a java slap, pointing to the same error...

I also tried to run the command from within the knime.exe's directory and I also tried to add the JAR file to Preferences -> Java -> Build Path -> Classpath Variable / User Libraries (referenced via the -preference argument). But that had no effect.

Did anybody face the same problems? Maybe with other third party JARs?

It is all about a Database connector that is configured like this: enter image description here Does the integrated security maybe force a misleading error?

System spec: KNIME 3.2.2 on Windows Server 2008 R2

Update - extract from preferences file

/configuration/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
/configuration/org.eclipse.ui.ide/MAX_RECENT_WORKSPACES=10
/configuration/org.eclipse.ui.ide/RECENT_WORKSPACES=<list of some workspaces>
/configuration/org.eclipse.ui.ide/RECENT_WORKSPACES_PROTOCOL=3
/configuration/org.eclipse.ui.ide/SHOW_RECENT_WORKSPACES=false
/configuration/org.eclipse.ui.ide/SHOW_WORKSPACE_SELECTION_DIALOG=true

Is there maybe a problem due to the fact that it is a shared KNIME instance among several users and the command line execution does not know which workspace has to be chosen? Is the workspace somehow needed and why?

Partial Solution: I finally managed it but I don't know exactly why it works now. What I did was to load a fresh portable version of KNIME and ran the same commands only changing the executable path to the new portable version. Before that I started the portable version once to set the workspace directory and register the database driver in preferences dialog and .ini file, nothing else, same configuration so far as the shared KNIME instance. What I am really wondering abpout is that from now on the commands are also working with the shared KNIME instance. I really don't know what caused the change that let KNIME find the driver class.

Info Because I encountered a few more problems within shared environment in KNIME command line mode, that led to undeterministic execution results, I wrote a little .NET library. This gives me more flexibility/control over the workflow execution (which returncodes and error messages occured and so on). You can find it here if you're interested: KnimeNet

stev-e
  • 436
  • 6
  • 15
  • Does your workflow dir and preferences point to the same workspace during GUI and batch execution? I think the same preferences should be loaded as KNIME registers the database drivers. – Gábor Bakos Jan 20 '17 at 18:43
  • Hi Gábor, I'm not really sure if I really got the point. How do I point KNIME to a specific workspace during command line execution? I added some lines from my preferences file concerning the workspace. – stev-e Jan 21 '17 at 11:15
  • I think you can use the `-data` option to specify the workspace containing the preferences. Though that probably should not be shared among different KNIME processes. Maybe the preferences you have exported from the workspace do not contain the JDBC driver settings? (The content you pasted does not seem to refer to them.) – Gábor Bakos Jan 21 '17 at 17:11

1 Answers1

0

I took a very minimal approach:

cd "C:\Program Files\KNIME"
.\knime -nosplash -noexit -consoleLog -reset -application org.knime.product.KNIME_BATCH_APPLICATION -workflowFile="D:\Work\Knime Workflows\Output\CMD_Test.knwf" -preferences="D:\Work\Knime Workflows\Output\CMD_Test.epf"
Debayan
  • 572
  • 6
  • 16