Execute a Workflow KNIME with a Batch file - batch-file

I would like to execute a workflow KNIME with a Batch file but i have an error :
ERROR KNIME-Worker-2 Call Local Workflow Execute failed : java.lang.NullPointerException
My workflow knime work well on Knime but i don't know why I have this error.
This is my Batch file :
"C:\Program Files\KNIME\knime.exe" -nosave -consoleLog -noexit -nosplash -reset
-application org.knime.product.KNIME_BATCH_APPLICATION
-preferences="C:\Users\Admnistrator\Desktop\KNIME_Preferences.epf"
-workflowDir="C:\Users\Admnistrator\knime-workspace\SPC_SIMTest"
Knime report Java :
Java was started but returned exit code = 4
I'm not find solution. Can you help me ?

If you run the command without options, e.g. eclipsec.exe -consoleLog -noexit -nosplash -launcher.suppressErrors -application org.knime.product.KNIME_BATCH_APPLICATION
then you will see a list of the available options and the java return codes. In particular, return code 4 indicates if an error during execution occurred
Often this sort of problem can be fixed by openning the workflow in the KNIME desktop, checking for any errors, reset the workflow and save it again, as an error during loading (e.g partially executed loops to pick a common one) could cause problems. Then try re-loading the workflow in the KNIME desktop and check no errors during load are recorded during the console. Also, adding the option --launcher.suppressErrors to your command line can sometimes avoid issues like this.

Related

KNIME Command Line Execution - ClassNotFoundException

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:
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
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"

Jenkins parameter is getting replaced by a white space

I have a parameterized build (copied from an existing job) in Jenkins. While building, my parameter is getting replaced by a white space. Here I am sharing what I have.
Parameter Name: BuildDate (I tried using %% and ${} but no luck)
Windows batch command:
copy \\Network_drive\dir1\dir2\dir3%BuildDate%\filename*.zip .
Output from Jenkins console:
c:\jenkins\workspace\my_build_job_name>copy \\Network_drive\dir1\dir2\dir3\ \filename*.zip .
\\Network_drive\dir1\dir2\dir3\ \filename*.zip
The system cannot find the path specified. 0 file(s) copied
c:\jenkins\workspace\my_build_job_name>exit 1
Build step 'Execute Windows batch command' marked build as failure
Notifying upstream projects of job completion Finished: FAILURE*
Note: We have a Windows/Linux mixed environment. Whenever we want to run shell scripts, we use Cygwin, batch should directly run.
Finally it turned out that one of the parameters was not populating due to hitting "rebuild last". Re-running the whole pipeline did it work. I still wonder why it was not populating but its all hood now!!!

Jenkins/Windows - Launch TestNG suite from .bat

Stackoverflow helped me a lot to reach that point but now I'm completely stuck, here is my problem :
I'm currently developing several tests to check a website. I code with Java in Eclipse, using testNG plugin with ReportNG for report, all of this using Windows 7 pro.
My tests work, and my report is well generated, so now I have to put it on Jenkins for my company so they will run my tests every X hours.
In order to launch my tests, I have made a file, named Run.bat, which runs the Java code, I tested it and it works, here is the code :
Run.bat
set classpath=blex_test_v1\bin;blex_test_v1\lib\*
java org.testng.TestNG blex_test_v1\blex_test_v1.xml
I now try to launch the tests on Jenkins, creating a new job and configuring it with the build section :
Run.bat
And this is my problem, I've tried everything (relative path, only the name of the file etc...) I always get this error :
java.io.IOException: Cannot run program "cmd" (in directory "/var/jenkins_home/jobs/blex_functional_test/workspace"): error=2, No such file or directory
So I checked the Jenkins workspace but my Run.bat is in it :
Workspace
I have read that Jenkins is in Linux so it might cause problem with bat files, so I tried to create a script but I didn't succeed either ..
So my question is : How can I run my test on Jenkins using my file Run.bat ? What am I doing wrong here ?
Thanks a lot !
Finally I can add an answer :
Jenkins is installed on a Unix machine so you can't run a bat file, it has to be a bash script.
To create a bash script, refer here.
Then you have to make sure that the plugin Xvfb is installed (and works) on the computer where Jenkins is installed.
I use testNG with reportNg and it doesn't work with the last firefox version so you I use firefox v34.0.5 and this version must be installed also on the Jenkins computer.
If you want to open the report after the execution, install another plugin and configure it (report HTML or something like that)
God it took me about a week but it's good to see it working !

Unable to do a simple rename file in ReleaseManagement during deployment

I have a problem that has been bugging me.
I have a Visual studio 2013 solution that goes through Release management.
One of the release steps in Release management is running a simple batch file using the Actions -> SxSBatchCommand tool. This is a custom action that simply executes a batch file and the batch file executes a simple rename that goes like this:
rename "$(currentDir)\project.ev1.app.config" "project.exe.config"
Which basically takes a specific app.config and applies it in the deployed directory as the main config.
All this works well but because I don't like all the batch files in my project, I decided to delete them and to use the WindowsOS -> Rename File or folder tool
So I deleted the SxSBatchCommand and added the "Rename File or Folder" with parameters:
FileFolderName: project.ev1.app.config
DestinationName: project.exe.config
I also tried:
FileFolderName: $(currentDir)\project.ev1.app.config
DestinationName: project.exe.config
This failed during deployment with the message:
The following command failed with the exit code '1' : powershell -command ./ManageWindowsIO.ps1 -Action Rename -FileFolderName 'project.ev1.app.config' -DestinationName 'project.exe.config'
Any ideas why such a simple command wouldn't be working?
Thanks
Can you run this exact command in powershell console ? You can also click on the button next to the command in the release log to grab a better detaild log whith explanation what went wrong .
The file could be in use , or without proper permissions for modification , you can look for the agent's logs in the target machine .
By the way if you are trying to make a file changed to the name of a configuration file for a win service or want to use transformation in a non web application you can use slow cheetah to accomplish it .

Execution of CodedUI tests on Remote machine without using the TestAgent/Controller

I have few Ordered tests which I execute locally using the VSTEST.CONSOLE.EXE In a batch file. I want to launch this batch file from remote system on about 15 VMs. I have the desktop active on all the VMs and user under which these test cases need to be executed are also same as the user logged in. When I try to execute the batch file using the PSExec it throws an error and dosent launch the tests the error shown is as below
C:\TestRunningFolder>vstest.console.exe C:\BuildsFolder\BVTTests.orderedtest /Settings:C:\BuildsFolder\QuestCodedUI.testsettings /Logger:trx
Microsoft (R) Test Execution Command Line Tool Version 12.0.30723.0
Copyright (c) Microsoft Corporation. All rights reserved.
starting test execution, please wait...
Warning: Warning: Test Run deployment issue: The assembly or module 'UiaComWrapp
r' directly or indirectly referenced by the test container 'c:\BuildsFolder\questcodedui.dll' was not found.Error: Test host process
exited unexpectedly.
Error: Failed to queue test run 'testuser#RemoteMachine 2015-05-14 15:57:49':
Unable to start the agent process.
Please let me know how can I execute the CodedUI tests on remote machine without using the TestAgent/Controller. Is it possible Via WMI ?. Anyone tried and succeeded please let me know.
Update : I was able to get past this issue by copying the required files in the folder. Now I am trying to launch the CodedUI tests using the PSExec.exe on remote system. I have remote desktop active and when I try to launch the batch file using the command line and it just gives me a message as shown below. PSEXEC.EXE \RemoteMachinename -i "c\users\testuser\desktop\Runtests.bat" when I do that it returns with error code 1 and tests are not started yet. I tried searching for solution I couldn't find anything that is usefull.
For the above mentioned scenario, please copy all the dependency dll (eg : Microsoft.Visualstudio.Qualitytools.CodeduiTest etc.) to the folder where your build dll (projectname.dll) file is copied. Make sure that you are using correct version of vstest that supports the version of the VS you are using. For example, if your code is builded using VS 2015, you have to use vstest.console.exe that comes with Test Agent 2015/Test Agent 2013 Update 5. This trick worked for me. Please let me know whether this works for you. Regards.

Resources