MQ Trigger to execute batch file - batch-file

My scenario is the stop and start message flows using batch file, where I have mqsi commands. When I execute the batch file manually, I am able to stop and start the flow. When I try to execute the batch file using the trigger enabled on one particular queue, I get the following error,
C:\Program Files\IBM\MQSI\7.0\bin>mqsistopmsgflow DISSERTATION_MS -e WITH_WATCHDOG -m WITH_WATCHDOG.MainFlow_Webservice_With_WatchDog Exception in thread "main" java.lang.NoClassDefFoundError: com.ibm.broker.config.util.MessageFlowControl
Caused by: java.lang.ClassNotFoundException: com.ibm.broker.config.util.MessageFlowControl
at java.net.URLClassLoader.findClass(URLClassLoader.java:434)
at java.lang.ClassLoader.loadClass(ClassLoader.java:653)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:358)
at java.lang.ClassLoader.loadClass(ClassLoader.java:619)
Could not find the main class: com.ibm.broker.config.util.MessageFlowControl. Program will exit.
I am not sure, where I am doing mistake. Request your help on this. Thanks.
Regards,
Jeevan

Related

flink job submission org.apache.flink.runtime.messages.FlinkJobNotFoundException: Could not find Flink job

Getting the following flink job submission error,
#centos1 flink-1.10.0]$ ./bin/flink run -m 10.0.2.4:8081 ./examples/batch/WordCount.jar --input file:///storage/flink-1.10.0/test.txt --output file:///storage/flink-1.10.0/wordcount_out
Job has been submitted with JobID 33d489aee848401e08c425b053c854f9
------------------------------------------------------------
The program finished with the following exception:
org.apache.flink.client.program.ProgramInvocationException: The main method caused an error: org.apache.flink.runtime.rest.util.RestClientException: [org.apache.flink.runtime.rest.handler.RestHandlerException: org.apache.flink.runtime.messages.FlinkJobNotFoundException: Could not find Flink job (33d489aee848401e08c425b053c854f9)
....
Caused by: java.util.concurrent.CompletionException: org.apache.flink.runtime.messages.FlinkJobNotFoundException: Could not find Flink job (33d489aee848401e08c425b053c854f9)
Caused by: org.apache.flink.runtime.messages.FlinkJobNotFoundException: Could not find Flink job (33d489aee848401e08c425b053c854f9)
at org.apache.flink.runtime.dispatcher.Dispatcher.getJobMasterGatewayFuture(Dispatcher.java:776)
at org.apache.flink.runtime.dispatcher.Dispatcher.requestJobStatus(Dispatcher.java:505)
... 27 more
]
logs from the taskmanger nodes: saying the file not found.. Is the correct way of pointing files in a flink cluster setup.
2020-03-19 13:15:29,843 ERROR org.apache.flink.runtime.operators.BatchTask - Error in task code: CHAIN DataSource (at main(WordCount.java:69) (org.apache.flink.api.java.io.TextInputFormat)) -> FlatMap (FlatMap at main(WordCount.java:84)) -> Combine (SUM(1), at main(WordCount.java:87) (1/2)
java.io.IOException: Error opening the Input Split file:/storage/flink-1.10.0/test.txt [0,19]: /storage/flink-1.10.0/test.txt (No such file or directory)
at org.apache.flink.api.common.io.FileInputFormat.open(FileInputFormat.java:824)
at org.apache.flink.api.common.io.DelimitedInputFormat.open(DelimitedInputFormat.java:470)
how to troubleshoot the above error, what to check , very less clues in the flink logs
The reason why is happening is because you are submitting a job across a distributed cluster and the location you have specified is perhaps only accessible by Job manager or machine from where you have submitted your job. However, actual program and Job execution takes place in Task Manager. Better approach for this would be by specifying a location which is accessible by all the nodes, may be HDFS or NFS.

Execute a Workflow KNIME with a 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.

Error while creating web service using apache CXF wizard

I am creating a web service through the apache CXF. but while i proceed(before the wsdl gets created), i receive the following error
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/cxf/tools/java2wsdl/JavaToWSDL
This seems like the java2ws.bat file has some error.
The statement in the bat file is
"%JAVA_HOME%\bin\java" -Djava.endorsed.dirs="%CXF_HOME%\lib\endorsed" -cp "%CXF_JAR%;%TOOLS_JAR%;%CLASSPATH%" -Djava.util.logging.config.file="%CXF_HOME%\etc\logging.properties" org.apache.cxf.tools.java2ws.JavaToWS %*
It seems like at Run time,jvm is not able to find the CXF.jar.I added it in the classpath but still the same error
please help me to solve the issue
The problem arises while creating JVM. You can refer : Java Refuses to Start - Could not reserve enough space for object heap
It solved my problem.

How to run command in windows batch Command in jenkins

I am trying to run a command in Jenkins under build step of running commands in Execute windows batch command.
I wrote dir to run as a command
and when the job runs in Jenkins which is triggered by a change in content of a file following error is shown
[FSTrigger] Triggered by a change to a file (log)
Building in workspace C:\Users\Pankaj\.jenkins\jobs\convert File to text form\workspace
FATAL: null
java.util.NoSuchElementException
at java.util.TreeMap$PrivateEntryIterator.nextEntry(Unknown Source)
at java.util.TreeMap$EntryIterator.next(Unknown Source)
at java.util.TreeMap$EntryIterator.next(Unknown Source)
at java.util.TreeMap.buildFromSorted(Unknown Source)
at java.util.TreeMap.buildFromSorted(Unknown Source)
at java.util.TreeMap.buildFromSorted(Unknown Source)
at java.util.TreeMap.buildFromSorted(Unknown Source)
at java.util.TreeMap.buildFromSorted(Unknown Source)
at java.util.TreeMap.buildFromSorted(Unknown Source)
at java.util.TreeMap.putAll(Unknown Source)
at hudson.EnvVars.<init>(EnvVars.java:82)
at hudson.EnvVars$GetEnvVars.call(EnvVars.java:207)
at hudson.EnvVars$GetEnvVars.call(EnvVars.java:205)
at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
at hudson.EnvVars.getRemote(EnvVars.java:202)
at hudson.model.Computer.getEnvironment(Computer.java:837)
at hudson.model.Run.getEnvironment(Run.java:1883)
at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:836)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:75)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:58)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:710)
at hudson.model.Build$RunnerImpl.build(Build.java:178)
at hudson.model.Build$RunnerImpl.doRun(Build.java:139)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:480)
at hudson.model.Run.run(Run.java:1434)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:239)
Please see to this issue.
I don't think that you need to install Jenkins as a Windows service to execute a batch command as a build step. What might be an issue is that on Windows, commands such as dir are internal to the command interpreter (i.e. cmd.exe). In short, it means that in a Java program you cannot simply run the internal dir command using the java.lang.Runtime.exec("dir") method because there is no such a program as dir.exe (on your PATH). What you should do is execute the command interpreter itself and specify the internal command as a parameter, i.e. java.lang.Runtime.exec("cmd /C dir").
Having that said and being aware that Jenkins is a Java application, it's better to use cmd /C dir instead of just typing dir in Jenkins' job configuration. Internally, Jenkins might use some 3rd pary libraries for executing external processes, such as Apache Commons Exec (see http://commons.apache.org/exec/), which hide the details between internal command(s) and "normal" commands, but from my experience it's not the case for all releases - especially the old ones.
Answer to this question:
Actually i haven't installed Windows as a service in Jenkins. So for this we need to go to "manage Jenkins" and then click on "windows as a service".I.e Installing Jenkins as a windows service.

batch file execution of jar error - Could not find the main class

My intent is to give a batch file that executes a jar of a java application/tool to functional analysts team who do not know java. When I execute the batch file, I get the below error.
Any help is highly appreciated.
How to debug to find out if the issues is in main() which takes care of loading log4j and config files?
Exception in thread "main" java.lang.NoClassDefFoundError: x.y.XYZClass Caused by: java.lang.ClassNotFoundException: x.y.XYZClass at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: x.y.XYZClass
. Program will exit.
This what I did so far:
I packaged an application using Maven with the following directory structure:
bin/run.bat
lib/application.jar and other jars that it depends on
config.properties
log4j.xml
jar manifest file content:
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By:
Build-Jdk: 1.6.0_20
Main-Class: x.y.XYZClass
Class-Path: vn.jar pn.jar
run.bat content:
java -cp .;../lib/application.jar x.y.XYZClass -Dconfig.properties.name=../config.properties -Dlog4j.configuration=../log4j.xml
I execute run.bat from command line from bin folder.
XYZClass main() does the following:
loads log4j.xml and config.properties and does other stuff.
Verify that the XYZClass exists inside application.jar, in the correct directory. From the bin directory, run the command:
jar tvf ../lib/application.jar.
The output should resemble:
META-INF/
META-INF/MANIFEST.MF
x/
x/y/
x/y/XYZClass.class
Also, since you've created an executable jar (by specifying Main-Class in your manifest), you should be able to run it with: java -jar ..\lib\application.jar

Resources