Am executing a jar file in remote server using jenkins job build step through publish over ssh.
Input build parameters for the job,say list - a,b,c,d,e
Execution command for publish over ssh -
cd /myjarfilepath
for input in $list
do
java -Xmx1024m -cp myApp.jar com.CommandLineRunner $input
done
job fails with error
ERROR: Exception when publishing, exception message [Exec timed out or was interrupted after 120,000 ms]
It runs successfully for one input. Say if it fails for input b then it gets terminated without executing the jar for c,d,e. I want execute the jar for all the inputs available.
Any suggestions will be appreciated!
Thanks.
Yes this is because of default timeout set to=120000. By updating transfers->Advanced->Exec Timeout(ms). I was able to build for all in loop successfully.
Related
I would like to run a jar file using a robot framework test suite, because this test-case is to be included among other test cases.
When the jar is run from the cmd, it produces the expected output, which can take 10 minutes, and then it ends.
My issue is that I'm not capable to detect when the execution of the jar is finished. I tried several keywords combination, in the last attempt I used the keyword Process Should Be Stopped, as shown below, and the result is that the process is always running.
One of my doubts is: which process is running, java? or the execution of the jar?
*** Settings ***
Library Process
Library OperatingSystem
Suite Setup log running on ${properties.hostname}
Suite Teardown Terminate All Processes kill=True
Variables C:/Users/theUser/Desktop/CheckOutRegression/Regression/RegressionScripts/config/properties.py
*** Test Cases ***
Check jar execution
${data}= Start Process java -jar da-1.0-SNAPSHOT.jar importFile1.json importFile2.zip cwd=${properties.pathToScripts} alias=myProc
${wait}= Wait Until Keyword Succeeds 10x 60s Process Should Be Stopped myProc
Log ${wait}
${result}= Get Process Result myProc
Log ${data.stdout}
Do you know how I can check that the execution of the jar file is finished?
I am using a War file to deploy my application in Xampp. The thing is that since I update the code multiple times I need to replace the war file and restart the Apache, tomcat services. I thought of using a batch file for this to save time.
I'm doing the following 3 steps to deploy a war file.
1) Stop Apache & Tomcat services.
2) Delete existing war file and it's corresponding folder.
3) Start Apache & Tomcat services.
Batch Script..
echo "+++Deploy source in $PWD+++"
echo "+++ Shutting down tomcat ..."
call apache_stop.bat
call catalina_stop.bat
timeout 5 > NUL
echo "+++ Installing new war ..."
DEL "C:\xampp\tomcat\webappss\flsv2*"
xcopy /s C:\Users\Hp\git\flsv2-lucy\build/flsv2.war C:\xampp\tomcat\webapps
echo "+++ Starting up tomcat ..."
call apache_start.bat
call catalina_start.bat
timeout 5 > NUL
Unfortunately the above code is not working. Whenever I run the above script from the xampp folder I'm getting an error message in cmd prompt..
Error Message...
C:\xampp>deploy_local.bat
C:\xampp>echo "+++Deploy source in $PWD+++"
"+++Deploy source in $PWD+++"
C:\xampp>echo "+++ Shutting down tomcat ..."
"+++ Shutting down tomcat ..."
C:\xampp>call apache_stop.bat
pv: No matching processes found
Mysql shutdowm ...
pv: No matching processes found
"+++ Starting up tomcat ..."
C:\xampp>
Where am I going wrong??
There are a few things that strike my eye:
$PWD is linuxstyle. Use %cd% in Windows batch files for the same thing.
Maybe you want to add #echo off as first line in your script to prevent the double echo-ing of each line to console.
The error message "pv: No matching processes found" comes from apache_stop.bat. You need to trace/debug that script for further details. (You might want to add a #echo on in the first line to get every output).
Your output shows no sign of the deleting operations ("Installing new war"), I wonder why but suspect the errors popping up from apache_stop.bat. However, the output from the "Starting up tomcat" is there. Is the delete part working as expected? Do files get deleted?
Hint: If you use del with wildcards (*) you can/need to specify the /Q switch to prevent the confirmation prompt. See del /? on the command line for details.
Also on del, you might want to use *.* to get "any filename followed by any extension". Currently with the single asterisk the del command is looking for filenames "beginning with flsv2 with no extension". The asterisk wildcard is handled differently by Unix/Linux and Windows.
Recommendation: The xcopy command should have the paths quoted (mandatory if your paths contain spaces).
Facing the below error when running the filewatcher job. File that is being watched is already in place.
ctmfw /amex/RSM_1099CTEST.txt CREATE 0 1800 10 3 0 N 0001 2359 NO_MIN_AGE NO_MAX_AGE
/opt/bmc/controlm/cmagentd/ctm/runtime/CMD.0000ctkt_002: line 2:
ctmfw: command not found
Can someone help me identify the cause of this issue.
Thanks in Advance!
The ctmfw command is provided by Control-M/Agent component. You must validate that you are running that Job on a server where a Control-M Agent is installed. In addition, it must be executed with the operating system user under which the agent was installed or, with a user who has execution privileges over the ctmfw utility.
I consulted here and here but could not get my problem solved.
When I type this on terminal /opt/glassfish4/glassfish/bin/asadmin start, I get the following result:
Remote server does not listen for requests on [localhost:4848]. Is the server up?
Unable to get remote commands.
Closest matching local command(s):
restart-domain
restart-local-instance
start-database
start-domain
start-local-instance
Command start failed.
Similarly, when I type this /opt/glassfish4/glassfish/bin/asadmin --port 5656 start-domain, I get
java.io.IOException: Couldn't get lock for /opt/glassfish4/glassfish/domains/domain1/logs/server.log
at java.util.logging.FileHandler.openFiles(FileHandler.java:389)
at java.util.logging.FileHandler.<init>(FileHandler.java:287)
at com.sun.enterprise.admin.launcher.GFLauncherLogger.addLogFileHandler(GFLauncherLogger.java:98)
at com.sun.enterprise.admin.launcher.GFLauncher.setup(GFLauncher.java:191)
at com.sun.enterprise.admin.servermgmt.cli.StartDomainCommand.createLauncher(StartDomainCommand.java:220)
at com.sun.enterprise.admin.servermgmt.cli.StartDomainCommand.executeCommand(StartDomainCommand.java:117)
at com.sun.enterprise.admin.cli.CLICommand.execute(CLICommand.java:321)
at com.sun.enterprise.admin.cli.AdminMain.executeCommand(AdminMain.java:360)
at com.sun.enterprise.admin.cli.AdminMain.doMain(AdminMain.java:298)
at org.glassfish.admin.cli.AsadminMain.main(AsadminMain.java:56)
Waiting for domain1 to start .Error starting domain domain1.
The server exited prematurely with exit code 1.
Before it died, it produced the following output:
Launching GlassFish on Felix platform
Exception in thread "main" java.lang.RuntimeException: the domain directory is not writable.
at com.sun.enterprise.glassfish.bootstrap.MainHelper.verifyDomainRoot(MainHelper.java:244)
at com.sun.enterprise.glassfish.bootstrap.MainHelper.findInstanceRoot(MainHelper.java:347)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:78)
at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:54)
Command start-domain failed.
I sense there is something problem in path /opt/glassfish4/glassfish/bin/asadmin. I am working on my first JSF web application and cannot run glassfish server. I am using Netbeans and ubuntu 13.10.
Can anyone show me the way?
Thank you!
The error messages
java.io.IOException: Couldn't get lock for
/opt/glassfish4/glassfish/domains/domain1/logs/server.log
and
Exception in thread "main" java.lang.RuntimeException: the domain
directory is not writable.
indicate that the user account you use to start the server doesn't have write permissions in your Glassfish domain folder.
To solve the problem either change the permissions or start the asadmin command with a user who has sufficient permissions.
If this doesn't solve the problem, there may be another process which has a lock on your server.log file, but I guess you would have noticed that. To make sure you can run
lsof /opt/glassfish4/glassfish/domains/domain1/logs/server.log
to see if any process is using the file.
See also:
Failed to start glassfish server because Couldn't get lock for /opt/glassfishv3/glassfish/domains/domain1/logs/server.log
I have the following script where I call a java program that writes a YAML output to Strandard output stream, and that is echoed (Simple).
#!/bin/bash
echo `/usr/lib/jvm/jre/bin/java -jar /etc/puppet/enc/enc.jar $1`
I have the above script in file/etc/puppet/enc/javaEnc.sh When I execute this providing node name as argument I get the following output.
---
classes:
class1:
class2:
The problem is, on the agent node, I get the error message
err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find node 'node-agent-1'; cannot compile
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run
I have found that the script does not execute (or rather my java program is not called, don't know why) - In my java program I write the output to a file in addition to doing a System.out.print.
I have a another script where I read the file (data.yaml) that contains the same data as I mentioned as output and writes it to output stream by following script.
#!/bin/bash
cat "/etc/puppet/enc/data.yaml"
When this script is mentioned against external_nodes, it works fine, the puppet agent configures itself. Can I please get an idea where I am getting it wrong.? The java program actually queries some external resources and classifies the classes and produces the output - it takes around 10 seconds to get this done. Could this be a problem ? I have seen ruby and python solutions - couldn't get them to work either. I would like it done with Java most preferably.
In my puppet.conf file I have the following.
[master]
node_terminus = exec
external_nodes = /etc/puppet/enc/javaEnc.sh