chaitu chaitu
asked on
how to run oc4j server using ant
build.xml
i want to run oc4j server after ear deploying and also want to open broswer with name http://localhost:8888/etrans/index.jsp but i am getting error; should i use parallel or sequetial keyword for running oc4j?
my oc4j batch file is in c:/oc4j/j2ee/home
<?xml version="1.0"?>
<project name="ant" default="all" basedir=".">
<property file="myantproperties.prop erties"/>
<property name="source" value="."/>
<property name="cvs.dir" value="${cvsdir}"/>
<property name="cvsroot" value="${cvsrootaddress}"/ >
<property name="password" value=".cvspass"/>
<property name="module" value="${module}"/>
<property name="ejbsrc" value="${ejbsrc}"/>
<property name="websrc" value="${websrc}"/>
<property name="jarname" value="${jarname}"/>
<property name="warname" value="${warname}"/>
<property name="ejbbuild" value="ejbbuild"/>
<property name="webbuild" value="webbuild"/>
<property name="app.ear" value="${earname}"/>
<property name="oc4j" value="${oc4jdirectory}"/>
<property name="browser" location="C:/Program Files/Internet Explorer/iexplore.exe"/>
<property name="file" location="http://localhost:8888/etrans/index.jsp"/>
<path id="ejb.jar">
<pathelement path="${deploy}"/>
<fileset dir="${deploy}">
<include name="ejb.jar"/>
</fileset>
</path>
<path id="classpath">
<pathelement path="${applicationJars}"/ >
<fileset dir="${applicationJars}">
<include name="*.jar"/>
</fileset>
<fileset dir="${utilityJars}">
<include name="*.jar"/>
</fileset>
</path>
<target name="all" depends="clean, login, checkout"/>
<target name="clean">
<!--delete dir="${cvs.dir}"/-->
<delete dir="${ejbbuild}"/>
<delete dir="${webbuild}"/>
<delete dir="${deploy}"/>
</target>
<target name="login" description="Login to repository">
<cvspass cvsroot="${cvsroot}" password="${password}"/>
</target>
<target name="checkout" description="Checkout project" depends="login">
<mkdir dir="${cvs.dir}"/>
<cvs cvsroot="${cvsroot}" package="${module}" dest="${cvs.dir}"/>
<antcall target="makeEar"/>
</target>
<target name="makeEar" depends="earinit, compile_ejb, jar.ejb,compile_webclasses ,copy_imag es,copy_js ps,war.web ,ear_app,d eploy_app, cleanoc4jl og,runoc4j "/>
<target name="earinit">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile
and copy the deployment descriptors into it-->
<mkdir dir="${ejbbuild}"/>
<mkdir dir="${ejbbuild}/META-INF" />
<mkdir dir="${webbuild}/WEB-INF"/ >
<mkdir dir="${webbuild}/WEB-INF/c lasses"/>
<mkdir dir="${deploy}"/>
<copy todir="${ejbbuild}/META-IN F">
<fileset dir="${source}/xml">
<include name="ejb-jar.xml"/>
<include name="orion-ejb-jar.xml"/>
</fileset>
</copy>
</target>
<!-- Compile ejb classes into the build directory (jar preparation) -->
<target name="compile_ejb" depends="earinit">
<javac srcdir="${ejbsrc}" destdir="${ejbbuild}" includes="**/*.java">
<classpath refid="classpath"/>
</javac>
<copy todir="${ejbbuild}">
<fileset dir="${ejbsrc}">
<include name="*.properties"/>
</fileset>
</copy>
</target>
<!-- Update ejb jar file or create it if it doesn't exist, including XML
deployment descriptors -->
<target name="jar.ejb" depends="compile_ejb">
<jar jarfile="${deploy}/${jarna me}" basedir="${ejbbuild}" update="yes">
</jar>
</target>
<!-- Compile client app into the clientclasses directory, and move the client jar file (created by appc) there as well -->
<target name="compile_webclasses" depends="jar.ejb">
<javac srcdir="${websrc}/com" destdir="${webbuild}/WEB-I NF/classes " includes="**/*.java">
<classpath refid="classpath"/>
<classpath refid="ejb.jar"/>
</javac>
</target>
<target name="copy_images" depends="compile_webclasse s">
<copy todir="${webbuild}/images" >
<fileset dir="${websrc}/images">
<include name="**/*.*"/>
</fileset>
</copy>
</target>
<target name="copy_jsps" depends="copy_images">
<copy todir="${webbuild}/custome r">
<fileset dir="${websrc}/customer">
<include name="**/*.*"/>
</fileset>
</copy>
<copy todir="${webbuild}/eaccoun ts">
<fileset dir="${websrc}/eaccounts">
<include name="**/*.*"/>
</fileset>
</copy>
<copy todir="${webbuild}/etrans" >
<fileset dir="${websrc}/etrans">
<include name="**/*.*"/>
</fileset>
</copy>
<copy todir="${webbuild}/vendor" >
<fileset dir="${websrc}/vendor">
<include name="**/*.*"/>
</fileset>
</copy>
<copy todir="${webbuild}">
<fileset dir="${websrc}">
<include name="*.*"/>
</fileset>
</copy>
<copy todir="${webbuild}/html">
<fileset dir="${websrc}/html">
<include name="*.*"/>
</fileset>
</copy>
<copy todir="${webbuild}/flash">
<fileset dir="${websrc}/flash">
<include name="*.*"/>
</fileset>
</copy>
<copy todir="${webbuild}/WEB-INF ">
<fileset dir="${websrc}/WEB-INF">
<include name="*.*"/>
</fileset>
</copy>
<copy todir="${webbuild}/WEB-INF ">
<fileset dir="${source}/xml">
<include name="web.xml"/>
<include name="orion-web.xml"/>
</fileset>
</copy>
<copy todir="${webbuild}/WEB-INF /lib">
<fileset dir="${websrc}/WEB-INF/lib ">
<include name="*.*"/>
</fileset>
</copy>
<copy todir="${webbuild}/WEB-INF /xml">
<fileset dir="${websrc}/WEB-INF/xml ">
<include name="*.*"/>
</fileset>
</copy>
</target>
<!-- Update ejb jar file or create it if it doesn't exist, including XML
deployment descriptors -->
<target name="war.web" depends="copy_images">
<jar jarfile="${deploy}/${warna me}" basedir="${webbuild}" update="yes">
</jar>
</target>
<!-- Put the ejb into an ear, to be deployed from the ${apps.dir} dir -->
<target name="ear_app" depends="jar.ejb,war.web">
<ear earfile="${deploy}/${app.e ar}" appxml="${source}/xml/appl ication.xm l">
<fileset dir="${deploy}" includes="${jarname}"/>
<fileset dir="${deploy}" includes="${warname}"/>
</ear>
</target>
<!-- Put the ear to be deployed into an OC4J server-->
<target name="deploy_app" depends="ear_app">
<copy file="${deploy}/${app.ear} " todir="${oc4j}/application s"/>
</target>
<target name="cleanoc4jlog" depends="deploy_app">
<delete includeemptydirs="true">
<fileset dir="${oc4j}/log" includes="**/*"/>
</delete>
</target>
<target name="runoc4j" depends="cleanoc4jlog">
<apply executable="test_run" dir="${oc4j}" failonerror="true" parallel="true">
</apply>
</target>
<target name="cleanoc4jlog" depends="openbrowser">
<exec executable="${browser}" spawn="true">
<arg value="${file}"/>
</exec>
</apply>
</target>
</project>
i want to run oc4j server after ear deploying and also want to open broswer with name http://localhost:8888/etrans/index.jsp but i am getting error; should i use parallel or sequetial keyword for running oc4j?
my oc4j batch file is in c:/oc4j/j2ee/home
<?xml version="1.0"?>
<project name="ant" default="all" basedir=".">
<property file="myantproperties.prop
<property name="source" value="."/>
<property name="cvs.dir" value="${cvsdir}"/>
<property name="cvsroot" value="${cvsrootaddress}"/
<property name="password" value=".cvspass"/>
<property name="module" value="${module}"/>
<property name="ejbsrc" value="${ejbsrc}"/>
<property name="websrc" value="${websrc}"/>
<property name="jarname" value="${jarname}"/>
<property name="warname" value="${warname}"/>
<property name="ejbbuild" value="ejbbuild"/>
<property name="webbuild" value="webbuild"/>
<property name="app.ear" value="${earname}"/>
<property name="oc4j" value="${oc4jdirectory}"/>
<property name="browser" location="C:/Program Files/Internet Explorer/iexplore.exe"/>
<property name="file" location="http://localhost:8888/etrans/index.jsp"/>
<path id="ejb.jar">
<pathelement path="${deploy}"/>
<fileset dir="${deploy}">
<include name="ejb.jar"/>
</fileset>
</path>
<path id="classpath">
<pathelement path="${applicationJars}"/
<fileset dir="${applicationJars}">
<include name="*.jar"/>
</fileset>
<fileset dir="${utilityJars}">
<include name="*.jar"/>
</fileset>
</path>
<target name="all" depends="clean, login, checkout"/>
<target name="clean">
<!--delete dir="${cvs.dir}"/-->
<delete dir="${ejbbuild}"/>
<delete dir="${webbuild}"/>
<delete dir="${deploy}"/>
</target>
<target name="login" description="Login to repository">
<cvspass cvsroot="${cvsroot}" password="${password}"/>
</target>
<target name="checkout" description="Checkout project" depends="login">
<mkdir dir="${cvs.dir}"/>
<cvs cvsroot="${cvsroot}" package="${module}" dest="${cvs.dir}"/>
<antcall target="makeEar"/>
</target>
<target name="makeEar" depends="earinit, compile_ejb, jar.ejb,compile_webclasses
<target name="earinit">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile
and copy the deployment descriptors into it-->
<mkdir dir="${ejbbuild}"/>
<mkdir dir="${ejbbuild}/META-INF"
<mkdir dir="${webbuild}/WEB-INF"/
<mkdir dir="${webbuild}/WEB-INF/c
<mkdir dir="${deploy}"/>
<copy todir="${ejbbuild}/META-IN
<fileset dir="${source}/xml">
<include name="ejb-jar.xml"/>
<include name="orion-ejb-jar.xml"/>
</fileset>
</copy>
</target>
<!-- Compile ejb classes into the build directory (jar preparation) -->
<target name="compile_ejb" depends="earinit">
<javac srcdir="${ejbsrc}" destdir="${ejbbuild}" includes="**/*.java">
<classpath refid="classpath"/>
</javac>
<copy todir="${ejbbuild}">
<fileset dir="${ejbsrc}">
<include name="*.properties"/>
</fileset>
</copy>
</target>
<!-- Update ejb jar file or create it if it doesn't exist, including XML
deployment descriptors -->
<target name="jar.ejb" depends="compile_ejb">
<jar jarfile="${deploy}/${jarna
</jar>
</target>
<!-- Compile client app into the clientclasses directory, and move the client jar file (created by appc) there as well -->
<target name="compile_webclasses" depends="jar.ejb">
<javac srcdir="${websrc}/com" destdir="${webbuild}/WEB-I
<classpath refid="classpath"/>
<classpath refid="ejb.jar"/>
</javac>
</target>
<target name="copy_images" depends="compile_webclasse
<copy todir="${webbuild}/images"
<fileset dir="${websrc}/images">
<include name="**/*.*"/>
</fileset>
</copy>
</target>
<target name="copy_jsps" depends="copy_images">
<copy todir="${webbuild}/custome
<fileset dir="${websrc}/customer">
<include name="**/*.*"/>
</fileset>
</copy>
<copy todir="${webbuild}/eaccoun
<fileset dir="${websrc}/eaccounts">
<include name="**/*.*"/>
</fileset>
</copy>
<copy todir="${webbuild}/etrans"
<fileset dir="${websrc}/etrans">
<include name="**/*.*"/>
</fileset>
</copy>
<copy todir="${webbuild}/vendor"
<fileset dir="${websrc}/vendor">
<include name="**/*.*"/>
</fileset>
</copy>
<copy todir="${webbuild}">
<fileset dir="${websrc}">
<include name="*.*"/>
</fileset>
</copy>
<copy todir="${webbuild}/html">
<fileset dir="${websrc}/html">
<include name="*.*"/>
</fileset>
</copy>
<copy todir="${webbuild}/flash">
<fileset dir="${websrc}/flash">
<include name="*.*"/>
</fileset>
</copy>
<copy todir="${webbuild}/WEB-INF
<fileset dir="${websrc}/WEB-INF">
<include name="*.*"/>
</fileset>
</copy>
<copy todir="${webbuild}/WEB-INF
<fileset dir="${source}/xml">
<include name="web.xml"/>
<include name="orion-web.xml"/>
</fileset>
</copy>
<copy todir="${webbuild}/WEB-INF
<fileset dir="${websrc}/WEB-INF/lib
<include name="*.*"/>
</fileset>
</copy>
<copy todir="${webbuild}/WEB-INF
<fileset dir="${websrc}/WEB-INF/xml
<include name="*.*"/>
</fileset>
</copy>
</target>
<!-- Update ejb jar file or create it if it doesn't exist, including XML
deployment descriptors -->
<target name="war.web" depends="copy_images">
<jar jarfile="${deploy}/${warna
</jar>
</target>
<!-- Put the ejb into an ear, to be deployed from the ${apps.dir} dir -->
<target name="ear_app" depends="jar.ejb,war.web">
<ear earfile="${deploy}/${app.e
<fileset dir="${deploy}" includes="${jarname}"/>
<fileset dir="${deploy}" includes="${warname}"/>
</ear>
</target>
<!-- Put the ear to be deployed into an OC4J server-->
<target name="deploy_app" depends="ear_app">
<copy file="${deploy}/${app.ear}
</target>
<target name="cleanoc4jlog" depends="deploy_app">
<delete includeemptydirs="true">
<fileset dir="${oc4j}/log" includes="**/*"/>
</delete>
</target>
<target name="runoc4j" depends="cleanoc4jlog">
<apply executable="test_run" dir="${oc4j}" failonerror="true" parallel="true">
</apply>
</target>
<target name="cleanoc4jlog" depends="openbrowser">
<exec executable="${browser}" spawn="true">
<arg value="${file}"/>
</exec>
</apply>
</target>
</project>
Also I see no value set for: ${oc4jdirectory}
ASKER
i set ${oc4jdirectory} value in myantproperties.properties ;
ASKER
as i was changed my build.xml specified by u but i am getting this error;
BUILD FAILED
C:\ChaitanyaAnt\build.xml: 53: The following error occurred while executing this
line:
C:\ChaitanyaAnt\build.xml: 198: no filesets and no filelists specified
BUILD FAILED
C:\ChaitanyaAnt\build.xml:
line:
C:\ChaitanyaAnt\build.xml:
can u post the contents of test_run?
ASKER
while ant is running i want to run the oc4j server in another window
test_run.bat file is this:
set path=c:\j2sdk1.4.2_06\bin;
java -Xmx512m -Djdbc.connection.debug=tr ue -Dp6.home=C:\OC4J_EXTENDED \j2ee\home \lib -Dp6trace=true -jar oc4j.jar -userThreads -verbosity 10 -out log\std_out.log -err log\std_err.log
test_run.bat file is this:
set path=c:\j2sdk1.4.2_06\bin;
java -Xmx512m -Djdbc.connection.debug=tr
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Chaituu,
did u try it?
tell me if it went ok or not
BR
did u try it?
tell me if it went ok or not
BR
<target name="runoc4j" depends="cleanoc4jlog">
<apply executable="test_run" dir="${oc4j}" failonerror="true" parallel="true">
</apply>
</target>
<target name="openbrowser" depends="runoc4j">
<exec executable="${browser}" spawn="true">
<arg value="${file}"/>
</exec>
</apply>
</target>