The startUp script of webapp is going to be executed by a standalone java management process. I understand that -D system properties can be set to CATALINA_OPTS in catalina.sh. So is the only way to pass system properties is for the java management process to go write into catalina.sh? I
I think this should be possible, but dont have the exact answer.
If it can be passed in an ant task like shown on this link, I assume it should be able to call the
org.apache.catalina.startup.Bootstrap load() passing in JVM args
<target name="tomcat-start">
<java jar="${tomcat.home}/bin/bootstrap.jar" fork="true">
<jvmarg value="-Dcatalina.home=${tomcat.home}"/>
</java>
</target>
<target name="tomcat-stop">
<java jar="${tomcat.home}/bin/bootstrap.jar" fork="true">
<jvmarg value="-Dcatalina.home=${tomcat.home}"/>
<arg line="stop"/>
</java>
</target>
Related
After building EAR file when i'm trying to extract XML file form the EAR i'm getting error [exec] Failed to open properties file : AppManage.tra
<property name="Appmanage" value="C:\tibco\etascbw513\tra\5.10\bin\AppManage.exe" />
<target name="extract">
<exec executable="${Appmanage}">
<arg value="-export"/>
<arg value="-ear"/>
<arg value="${workdir}\Deploy\EARs\${project}.ear"/>
<arg value="-out"/>
<arg value="${workdir}\Deploy\EARs\${project}.xml"/>
<arg value="-max"/>
</exec>
old Q : can someone share simple build.xml to create ear file from ant script
details : i'm able to pull repositories with the help ant script now i want to create EAR file from ant script for Tibco BW. can any one share simple demo .
try to solve this error using below steps.
try to check your environment variable path.
check TRA_HOME/bin/ using App manage utility.
This error "Failed to open properties file : AppManage.tra" occurs because the AppManage executable tries to look for AppManage.tra in the current execution directory and does not find it. In this particular case, the current execution directory would depend on where you are executing Ant from.
The correct way to avoid this error is to provide full path to the AppManage.tra file as an argument to the AppManage executable in the ant exec statement, as shown below, in the highlighted section (two new arguments are added "--propFile" and "full path to AppManage.tra"). Hope this helps.
<property name="Appmanage" value="C:\tibco\etascbw513\tra\5.10\bin\AppManage.exe" />
<target name="extract">
<exec executable="${Appmanage}">
<arg value="--propFile"/>
<arg value="C:\tibco\etascbw513\tra\5.10\bin\AppManage.tra"/>
<arg value="-export"/>
<arg value="-ear"/>
<arg value="${workdir}\Deploy\EARs\${project}.ear"/>
<arg value="-out"/>
<arg value="${workdir}\Deploy\EARs\${project}.xml"/>
<arg value="-max"/>
</exec>
Program works fine when run with eclipse run configurations, but when run with ant, it is unable to parse int from args[0], which I do not understand. Full code is available here https://gist.github.com/4108950/e984a581d5e9de889eaf0c8faf0e57752e825a97
I believe it has something to do with ant,
target name="run" description="run the project">
java dir="${build.dir}" classname="BinarySearchTree" fork="yes">
<arg value="6 in.txt"/>
/java>
/target>
the arg value will be changed via the -D flag, as in ant -Dargs="6 testData1.txt" run.
Any help would be much appreciated, it is very frustrating.
You need to supply the arguments as two different arg values:
<target name="run" description="run the project">
<java dir="${build.dir}" classname="BinarySearchTree" fork="yes">
<arg value="6" />
<arg value="in.txt" />
</java>
</target>
You can also use the line attribute; From the ANT docs:
<arg value="-l -a"/>
is a single command-line argument containing a space character, not separate commands "-> l" and "-a".
<arg line="-l -a"/>
This is a command line with two separate arguments, "-l" and "-a".
Expanding epoch 's answer.
java task supports sysproperty and jvmarg.
For example (from ant java task page)
<java classname="test.Main"
fork="yes" >
<sysproperty key="DEBUG" value="true"/>
<arg value="-h"/>
<jvmarg value="-Xrunhprof:cpu=samples,file=log.txt,depth=3"/> </java>
So you could construct the args from the command line passed to ant.
<target name="run" description="run the project">
<java dir="${build.dir}" classname="BinarySearchTree" fork="yes">
<sysproperty key="testarg" value="${testarg}"
<arg value="${arg1}" />
<arg value="${arg2}" />
</java>
</target>
Now if you call ant with ant -Dtestarg=test1234 -Darg1=6 -Darg2=in.txt, then testarg will be available via property. Others will become normal arguments to the java program.
This may be a naive question for the people who are familiar with Ant. I am new to Ant. please do me a favor. Thanks!
I write something like this in build.xml.
<target name="run">
<java jar="build/jar/sth.jar" fork="true"/>
</target>
But, I want to put some parameters to it, like
java -jar build/jar/sth.jar input.txt
How to do that?
By the way, where could I find the specifications of build.xml grammar? like how many attributes are there? what are the other attributes rather than "jar" "fork"?
This should do what you want:
<exec executable="java">
<arg value="-jar" />
<arg value="build/jar/sth.jar" />
</exec>
Here is the source of documentation http://ant.apache.org to start with.
EDITED:
You can use java tag as well, simply specifying tag args="input.txt" or whatever parameters you would like to pass. More info on java command
<java jar="build/jar/sth.jar">
<arg value="input.txt" />
</java>
im trying to invoke a specific class from within a jar file but I'm gettign below exception -
Buildfile: C:\Projects\GranHermano\build.xml
SignJadFilesInDir:
[java] java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Cell
My jar file contains all required jars (in this case poi-3.6-20091214.jar) so above exception should not be thrown.
This is how I am invoking the class -
<target name="SignJadFilesInDir" description="Signs all jad files in a dir" >
<java classname="com.src.SignDeviceJadInDir">
<classpath>
<pathelement location="BuildUtils.jar"/>
</classpath>
<arg line="${jadFileDir}"/>
<arg line="${devicesExcelDir}"/>
<arg line="${wtkDir}"/>
<arg line="${keyStoreDir}"/>
<arg line="${keyStoreId}"/>
<arg line="${keyStorePwd}"/>
</java>
</target>
Thanks
Can you please open jar BuildUtils.jar to ensure it well contains the classes of poi (and not poi jar, as I'm not aware of JRE support for jar-in-a-jar out of the box) ?
If your BuildUtils.jar contains poi-3.6-20091214.jar and not its classes, your exception is quite normal.
I need to add a folder in current classpath for ant script that I have written for running java files. How can it be done?
You could add it as an attribute
<java classpath="${extraDir}"
classname="pkg.Class">
...
</java>
Or using the nested <classpath> tag:
<java classname="pkg.Class">
<classpath>
<pathelement path="${extraDir}"/>
</classpath>
</java>
See the documentation for the Java task.
i added the following line in the tag of the task and it ran successfully.
<pathelement path="C:\JunitTest\folderIsHere"/>
and after this the script ran successfully.