KNIME Command Line Execution - ClassNotFoundException - sql-server

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"

Related

Java FX JAR File can not find SQL Server Driver

I fought for 8 hours yesterday getting my Java FX (11) Standalone JAR to work at all. I finally did, and now when I run it via java -jar myjar.jar (with path info for fx components), it at least "works" inasmuch as I can see my "own application's" error messages and message boxes lol.
This app needs to connect to SQL Server. It works FINE in IDE (IntelliJ). For JAR, I did not include the SQL Server driver as it is signed. No big deal - figure I'd just deploy it too and put it in the path. However, the JAR file can not "see" the driver (or the class - not sure) when run. Here is the info:
SQL Server driver is mssql-jdbc-8.2.2.jre11.jar
My connection Code is:
connection = DriverManager.getConnection(connectString); and connectString = "jdbc:sqlserver://localhost:1433;database=mydatabase;userName=myuser;password=mypword"
Again - this WORKS FINE in IDE. However, run from jar, it gets "java.sql.SQLException: No suitable driver found for jdbc:sqlserver://localhost:1433;database=mydatabase;userName=myuser;password=mypword"
I have put the mssql-jdbc-8.2.2.jre11.jar into the same directory as the jar. I have included it in the MANIFEST.MF with Class-Path: mssql-jdbc-8.2.2.jre11.jar and also tried it in a "lib" subdirectory from the jar file with Class-Path: /lib. Nothing Works! I just keep getting the "no suitable driver" error. The full manifest file looks like:
Manifest-Version: 1.0
Class-Path: /lib
Main-Class: com.product.Launcher
Here is the full call from command line that actually launches the app: java --module-path C:/Users/KMatson/Documents/JetBrains/openjfx-11.0.2_windows-x64_bin-sdk/javafx-sdk-11.0.2/lib/ --add-modules javafx.controls,javafx.fxml,javafx.graphics -jar myjar.jar This does run the app, but as soon as app tries to connect to SQL, I get the error.
Also tried the old-style Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver") to no avail even thought it should not be necessary, and isn't needed run from IDE.
This is driving me crazy and has taken WAY more time than it should. I'm new to all this, and hope it is something simple I am overlooking or unaware of. Any help MUCH appreciated.
OK - here is the (intermediate) answer that worked for me. Apparently, having the "--module path" declaration in the cmd line was overriding the Class-path in the MANIFEST somehow. Either that or something was - dunno - didn't think i had a "modular" project. I'm not building from Maven, and module-info is not active.
Anyway - I simply put the driver jar in the "module path" I use from cmd, and it worked. I'm now trying to figure out how to make this thing "double clickable" so i don't have to issue from cmd line or use a batch file.

How to fix SERVICE_PAUSED error on starting nssm server

So I need to run a custom server. It worked on other machines, but not on mine (all of them are on Windows).
My input:
nssm start custom-server
Error message:
custom-server: Unexpected status SERVICE_PAUSED in response to START control.
I tried to re-start it, but got the same message.
Use the following instructions to change I/O redirects:
nssm set [SERVICE_NAME] AppStdout [APP_PATH_INSTALL]\logs\service.log
nssm set [SERVICE_NAME] AppStderr [APP_PATH_INSTALL]\logs\service-error.log
Check the service log files to find the failure.
In my case, the failure was caused by a dependency on Python libraries.
As Garric15 states it is probably your install command.
This could be for example a StdOut redirect to a path / file that does not exist on your local machine.
Look in the Application event log for errors where the source is nssm around the time you installed the service.
The reason is because firewall is blocking the software which you are running as a service, start first software separately, it will ask you to add to firewall exclusions , then you can use it via nssm
Some scenario
App directory not provided or doesn't exist
nssm nssm set xyz-service AppDirectory "D:\Work\ShoppingKart"
File which is given for service may be corrupted (rebuild code)
The application trying to run is not proper or corrupted. Try to run without windows service once.
Program (.exe) file path not found (in this case look for the solution, or else give full path, if java not found even if it is there in env, just add full path)
I solved it by using no mws (Managed Windows Service?) release,
ex.
gogs_0.12.10_windows_amd64 works
gogs_0.12.10_windows_amd64_mws not working
The issue for me was there had been a Java update on my machine. The JAVA_HOME environment variable was now pointing to an invalid directory (i.e. the old Java version). Just needed to update the JAVA_HOME path and restart the solr services to fix it.
I was attempting to configure rclone as a windows 10 service. I fixed it including the rclone.conf archive inside the rclone folder.
In my case, the problem was that after the service was installed using nssm.exe, the program name was changed. This caused service to always go to paused state after start or restart the service, using either services.msc or nssm.exe command line.
Editing service nssm.exe startup parameters solved the problem for me.

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.

Getiing error message 'Failed Installing JBAS50SVC' whle running service.bat file in Windows 7

I need to run Jboss 7 as service.
Followed these steps :-
Copied my Jboss to C:\Program Files <86>
Downloaded Jboss-native-2.0.10-windows-x64-ssl and copied the contenst of bin catalog to %JBOSS_HOME%/bin
Changes done on service.bat as per link instructions
https://community.jboss.org/message/724488
Changed my dir location to my Jboss bin
and given command service.bat install
C:\Program Files \jboss7>bin>service.bat install
Failed installing JBAS50SVC
Access is Denied.
Service JBoss Application Server 7.1.1 installed.
I'm not able to rectify this problem .
It appears to be windows access issue.
Try the following:
Does the windows ID you are using have Administrator privileges? If no, get a Admin ID else if Yes, proceed to step 2.
Try to do the same but in some other drive (not c: )
UPDATE #1 : OP says he can not see the output of service.bat file
Follow the following steps
Open start menu
Search for "cmd"
Right click "cmd" and run as Administrator
type in following command
cd C:\Program Files \jboss7\bin
Type service.bat and observe the output
On a 2008 Windows Server this occurs because you're not running the command line as an administrator. Those of us who have spent considerable amounts of time on 2003 server, and others before that, keep forgetting that your logged in ADMIN level account does NOT get passed to the command line automatically like with previous versions of Windows.
With any additional errors, past this one, I would keep going back to the service.bat file and looking at the path statements, throughout that file, to ensure that they are all correct to reach what is correct for your installation.
Also, don't forget to create a log folder under standalone (unless you're doing a domain install). Failure to do that will also cause issues as well.
yoda

How to install Crystal Reports for .Net 3.5 Winforms application

We have a VB.Net Winforms (x86) application that uses the freely redistributable version of Crystal Reports. Although the application works fine on my test machine, when installing on a client's machine and trying to print a report from the application, the error: The system cannot find the file specified. File name: 'CrystalDecisions.CrystalReports.Engine ... is displayed.
The inno-setup includes the CR redistributable "CRRedist2008_x86.msi" which was installed by the client during the installation. (We also tried running the "CRRedist2008_x64.msi" but received an "unsupported processor type" error).
I have read about Merge Modules that are prerequisites for .NET 1/2 (VS 2002/2005), but cannot find any useful information related to .NET 3.5 and am wondering if these files are still required and how to package and deploy them if they are in fact needed.
Any guidance on how to resolve this installation issue is much appreciated.
Edit
The Inno-Setup contains the following command that checks to see if CR is installed and if not the MSI is launched from the final setup form:
[Run]
Filename: "{app}\CRRedist2008_x86.msi"; Description: "Crystal Reports"; Flags: nowait postinstall skipifsilent; Check: EnsureCrystalReports105Installed();
The problem is that you are not actually executing the MSI file. You can see this by running your installer with /LOG and reviewing the resulting log file.
This is because MSI files cannot be directly executed -- they're data files, not programs.
To resolve this, you need to run msiexec instead, passing the MSI file as a parameter; eg.
[Run]
Filename: {sys}\msiexec.exe; Parameters: "/i ""{app}\CRRedist2008_x86.msi"""; ...
You should review the command line parameters accepted by msiexec and properties accepted by the MSI file to see if you want to do something different, eg. running the install silently instead of interactively.
Also, running it as postinstall is fine if this component is optional for your application and it can gracefully handle it not being installed. If this is not the case then you should treat it as a prerequisite instead and always install it via PrepareToInstall.

Resources