I have jenkins on jetty on test server (ubuntu 12.04) and I need stop/start tomcat before deploy my war file.
I can start tomcat over ant with target:
<target name="tomcat-start">
<java jar="${tomcat.home}/bin/bootstrap.jar" fork="true" >
<jvmarg value="-Dcatalina.home=${tomcat.home}"/>
</java> </target>
But if I check /etc/init.d/tomcat6 status i see "* Tomcat servlet engine is not running."
How to stop start tomcat service in ubuntu using ant?
here is the link startup & shutdown tomcat. This will be helpful.
http://fugoconsulting.wordpress.com/tag/startup-and-shutdown-of-tomcat-in-ubuntu/
Related
Our product is using Jetty to deploy a webapp in which we are triggering the jetty using the ant build target like below
<exec executable="**/jetty.sh" failonerror="true">
<env key="JETTY_CONF" value="***/jetty.conf"/>
<env key="JETTY_LOGS" value="${logs}"/>
<env key="JETTY_PID" value="${logs}/jetty.pid"/>
<env key="TMPDIR" value="${tmp.dir}"/>
<!-- location where jetty will extract the war -->
<env key="JAVA_OPTIONS"
value="-server -d64 ${heapOptions} ${gcOptions} ${sslOptions} ${debugFlags} -Dsettings.path=${settings.path} -Dlog4j.configuration=file:///${xmlFile} -Djetty.secure.port=${*} -Dapp.dir=${*} -Drs.data.dir=${*} -Disutest=${isutest} -Disftest=${ftest} -Disrtest=${rtest} -Disrtestlocal=${rtestlocal} -Dlogs.dir=${logs.dir} -Ddist.dir=${*()} "/>
<env key="JAVA" value="${JAVA_HOME}/bin/java"/>
<arg value="${com}"/>
</exec>
In this I am wondering if the -Dlog4j.configuration=file:///${xmlFile} is it for the Jetty to configure the logs or is it webapp specific .
If it is for jetty to configure log4j I do not see any log4j related libraries in jetty. So, need a little clarification on this.
from Jetty 1.0 thru 9.0 Jetty used an in-house Logging Facade, that wrote to STDERR (System.err), with an optional configuration to use slf4j (since Jetty 6.0).
From Jetty 10.0 on-wards Jetty uses the slf4j logging facade (and has it's own jetty-slf4j-impl that writes to STDERR/System.err).
Not once has Jetty depended on or shipped with log4j.
If you see log4j in your configuration, it's something that you (or your predecessors) have added on top of Jetty.
I am using ANT parallel task to timeout after starting a server. At the timeout ant returns build failure. I want build to be successful after timeout seconds. Please find the below code.
<target name="tomcat-start">
<parallel threadCount="1" timeout="30000" failonany="true">
<sshexec host="10.0.19.47"
trust="true"
username="${server_username}"
password="${server_password}"
command="nohup java -jar /home/techteam/TravelSecure-deployments/DTCMWS_TravelSecure-0.0.1-SNAPSHOT.jar & disown" />
<echo> Microsite service started successfully. Please wait for service to start running</echo>
</parallel>
</target>
I am trying to integrate Sonar task in Ant build in Eclipse. SonarQube server is running successfully at the default port on localhost. On opening "http://localhost:9000/" in browser, SonarQube web interface is successfully opening.
Problem is when I am running Sonar task from Ant build file it is giving error "org.sonar.runner.impl.RunnerException: Unable to execute Sonar". That's it. No stacktrace is logged on console.
The sonar task in ANt build is defined as below:
<target name="sonar" depends="jcompile">
<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
<classpath path="<PathToAntPlugin>/lib/sonar-ant-task-2.2.jar" />
</taskdef>
<property name="sonar.projectDescription" value="Example application using Ant and Jacoco" />
<property name="sonar.sources" value="${basedir}/src" />
<property name="sonar.host.url" value="http://localhost:9000"/>
<property name="sonar.surefire.reportsPath" value="${reports.junit.xml.dir}" />
<property name="sonar.core.codeCoveragePlugin" value="jacoco" />
<property name="sonar.jacoco.antTargets" value="run-tests" />
<property name="sonar.projectKey" value="<PathToMyProject>" />
<property name="sonar.projectVersion" value="1.0" />
<sonar:sonar xmlns:sonar="antlib:org.sonar.ant"/>
</target>
Other details:
SonarQube Server 4.5,
sonar-ant-task-2.2.jar,
JDK 1.6.0_21,
Eclipse Kepler
Is there any comptability issue between the jdk, eclipse, sonar server or sonar ant jar? Is there any way to find the detail logs in order to debug the issue?
Apart from above issue, I am having other issue. When I am installing SonarCube plugin in eclipse, in Windows ->Preferences SonarCube is not coming. However, in installed software list in Eclipse it is listed. I have tried to run eclipse with -clean option but no success. Please let me know what could be the problem?
When we are running the build file from eclipse it is not giving full stack trace on console in some cases. Try to run the build file from the command prompt.
For example:
Open command prompt window and go to eclipse ant bin directory path(In my system it is C:\eclipse\plugins\org.apache.ant_1.9.6.v201510161327\bin) and from here run your build file using ant command.
C:\eclipse\plugins\org.apache.ant_1.9.6.v201510161327\bin>ant -buildfile [path_of_build_file]\build-test.xml
I know I am late, but this is to help who visits this with same problem
For the missing preferences, the Installation FAQ of Sonar says to do a restart with -clean argument.
I have an Ant script which is used to deploy my application on two different machines at a time. With the local machine i do not have a problem, but when it comes to the remote machine, I want to check if Jboss is up or not. If it is up then I want to shut it down but if it is not then nothing should be done. I tried to do this by keeping the attribute of <sshexec> as failonerror="on". This works well when the Jboss is already down and the shutdown command only gives some errors. But the real problem that i faced was when Jboss was running and when the shutdown command was executed, it did not shutdown properly and gave some error. It is in these situations that I want to stop my build script and let the user know that there is something wrong with Jboss on the other machine and it needs to be looked at.
The target code for stopping the remote Jboss is
<target name="stopRemoteJboss" description="Stops Remote Instance of Jboss">
<echo message="Stopping Remote Jboss" />
<sshexec trust="true" host="${jboss.remote.host}" username="${jboss.remote.username}" password="${jboss.remote.password}" command="${jboss.remote.home}/bin/shutdown.sh -S" port="${jboss.remote.port}"/>
</target>
After a short check, I've found following, maybe you could reuse/or use as an inspiration for your script: http://shrubbery.homeip.net/c/display/W/Starting+JBoss+with+ANT
The relevant part for you seem to be:
<java jvm="#{jdkHome}/bin/java"
classname="org.jboss.Shutdown" fork="true" failonerror="false" resultproperty="shutdown.rc">
<arg line="-s jnp://#{bindAddr}:#{jnpPort}"/>
<classpath>
<pathelement path="#{jbossInstallDir}/bin/shutdown.jar"/>
<pathelement path="#{jbossInstallDir}/client/jbossall-client.jar"/>
</classpath>
</java>
<echo>Shutdown rc = ${shutdown.rc}</echo>
<condition property="shutdown.okay">
<equals arg1="${shutdown.rc}" arg2="0"/>
</condition>
<fail unless="shutdown.okay" message="Unable to shut down JBoss (maybe it hasn't fully started yet?)."/>
<echo>Waiting for #{bindAddr}:#{jnpPort} to stop listening...</echo>
Why not check to see if the remote port is active?
<project name="demo" default="check">
<condition property="server.running" value="running" else="not running">
<socket server="remoteserver" port="80"/>
</condition>
<target name="check" description="Print status message">
<echo message="Web server status: ${server.running}"/>
</target>
</project>
If your JBoss instance is configured as a reverse proxy you could use the alternative http condition to check the HTTP response code (which would be 503 "Service unavailable", if the appserver is down)
So I'm building a project with maven, and in this maven pom we have a reference to an ant build script. The maven pom triggers this ant build to build a project (an install of alfresco with mysql database and tomcat server packed up with it).
The issue seems to be when you try to set up a database for alfresco to use through the ant build. This is the part of the ant build.
<target name="createDatabase">
<exec spawn="false" executable="${mysql.home}/bin/mysql" failonerror="true">
<arg value="-u" />
<arg value="root" />
<arg value="-e" />
<arg value="source ${alfresco.home}\mysql\db_setup.sql" />
</exec>
</target>
I'm getting 'unknown command '\U' sent back to me as an error on this. Of course you can install the DB manually but I want it as part of this ant script. SOmeone I work with runs this successfully on XP, but I'm getting that error on win7. Any ideas?