0 Replies Latest reply on Jun 11, 2012 10:12 AM by anand pushparaj

    Weblogic to JBoss migration-Problem with build.xml

    anand pushparaj Newbie

      Hi Everyone,

       

      I am migrating an EJB & WEBSERVICE application from weblogic to JBoss 5.1.2 EAP. I am a Microsoft resource. So i am finding the heat. However I have done the code changes. Now i am finding problem with the build.xml. It is an ANT script that has a lot of weblogic dependencies.

       

      Can anyone help me in creating a new JBoss-ant build. I have put my build.xml for your kind reference.

       

      Thank you for the timely help !!

       

       

      <project name="Advanced Query Builder" default="build" basedir=".">

      <property environment="env" />

      <property file="local.properties" />

      <property file="build.properties" />

      <property file="../build-base.properties" />

      <!-- lib.build.dir builds on a property defined in build-base.properties so needs

      to be defined after that property file import -->

      <property name="lib.build.dir" value="${lib.dir}/build" />

      <property name="war.dir" value="${build.dir}/war" />

      <import file="../build-base.xml" />

      <taskdef resource="genjar.properties" classpath="lib/build/GenJar.jar" />

      <path id="axis.classpath">

      <fileset dir="${lib.dir}/${axis.dir}" includes="axis.jar, commons-discovery-0.2.jar, commons-httpclient-3.0-rc2.jar, jaxrpc.jar, mailapi_1_3_1.jar, saaj.jar, servlet.jar, wsdl4j-1.5.1.jar, xercesImpl.jar, xmlParserAPIs.jar" />

      <fileset dir="${lib.dir}" includes="commons-logging.jar, log4j-1.2.8.jar" />

      <fileset dir="${lib.dir}/${axis.dir}" includes="axis-ant.jar" />

      <path refid="weblogic.classpath" />

      </path>

      <path id="class.path">

      <fileset dir="${basedir}/lib" includes="*.jar" />

      <pathelement location="${gen.class.dir}" />

      <path refid="axis.classpath" />

      </path>

       

      <tstamp>

      <format property="NOW" pattern="MM-dd-yyyy HH:mm" locale="en" />

      </tstamp>

       

        

      <!-- Additional Axis Ant tasks -->

      <target name="axis.taskdefs">

      <taskdef resource="axis-tasks.properties" classpathref="axis.classpath" />

      <taskdef name="axis-wsdl2java" classname="org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask" classpathref="axis.classpath" />

      </target>

       

      <target name="define.filtersets">

      <filterset id="config.filter">

      <filterset>

      <filter token="build.date" value="${NOW}" />

      <filter token="VERSIONINFO" value="${NOW}" />

      </filterset>

      <filterset filtersfile="${config.dir}/ant_${deploy.server}.properties" />

      </filterset>

      </target>

      <target name="wsdl2java" depends="axis.taskdefs">

      <mkdir dir="${gen.src.dir}" />

      <axis-wsdl2java output="${gen.src.dir}" verbose="true" url="${wsurl}" serverside="true" typemappingversion="1.2" failonnetworkerrors="true">

      <mapping namespace="${target.namespace}" package="${mapped.namespace}" />

      <mapping namespace="java:com.pfizer.ri.spf.common.vo" package="${mapped.namespace}" />

      <mapping namespace="java:com.pfizer.ri.spf.common.exception" package="${mapped.namespace}" />

      <mapping namespace="java:com.pfizer.ri.spf.webservices.service" package="${mapped.namespace}" />

      <mapping namespace="java:com.pfizer.ri.chemselect.vo" package="${mapped.namespace}" />

      <mapping namespace="java:com.pfizer.ri.chemselect.common.util" package="${mapped.namespace}" />

      <mapping namespace="java:com.pfizer.ri.chemselect.service" package="${mapped.namespace}" />

      <mapping namespace="java:com.pfizer.ri.chemselect.aqb" package="${mapped.namespace}" />

      </axis-wsdl2java>

      </target>

      <target name="compile_generated">

      <mkdir dir="${gen.class.dir}" />

      <javac srcdir="${gen.src.dir}" destdir="${gen.class.dir}" debug="on">

      <compilerarg line="-source 1.4 -target 1.4"/>

      <classpath>

      <path refid="axis.classpath" />

      </classpath>

      </javac>

      </target>

      <target name="compile">

      <mkdir dir="${classes.dir}" />

      <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="on">

      <compilerarg line="-source 1.4 -target 1.4"/>

      <classpath>

      <path refid="class.path" />

      <pathelement location="${gen.class.dir}" />

      </classpath>

      </javac>

      </target>

      <target name="war" depends="define.filtersets" description="create a war for deploying the jnlp web start application">

      <mkdir dir="${war.dir}" />

      <copy todir="${war.dir}" overwrite="true" >

      <fileset dir="${web.src}" includes="**/*" excludes="images/** **/*.jar" />

      <filterset refid="config.filter" />

      </copy>

      <copy todir="${war.dir}" overwrite="true" flatten="true">

      <fileset dir="${src.dir}" includes="**/SimpleSample.java" />

      </copy>

      <copy todir="${war.dir}/images">

      <!-- copy images without filtering to avoid corruption. -->

      <fileset dir="${web.src}/images" />

      </copy>

      <copy todir="${war.dir}" overwrite="true" preservelastmodified="true">

      <!-- copy jars without filtering to avoid corruption -->

      <fileset dir="${web.src}" includes="**/*.jar" />

      </copy>

      <copy todir="${war.dir}/WEB-INF/lib" preservelastmodified="true">

      <fileset dir="${lib.dir}" includes="jnlp-servlet.jar log4j-1.2.8.jar" />

      </copy>

      <copy todir="${war.dir}/app" preservelastmodified="true">

      <fileset dir="${dist.dir}">

      <!-- this is the application jar, must match the jar href in aqb.jnlp-->

      <include name="AQB.jar" />

      </fileset>

      <fileset dir="${lib.dir}" excludes="jnlp-servlet.jar build/**" includes="*.jar" />

      <!-- note that these filesets do NOT go to sub-directories ("**/*")-->

      <fileset dir="${lib.dir}/${axis.dir}" excludes="axis-ant.jar" includes="*.jar" />

      </copy>

      <jar jarfile="${war.dir}/WEB-INF/lib/AQB-server.jar">

      <manifest>

      <attribute name="Built-By" value="${user.name}" />

      <section name="common">

      <attribute name="Implementation-Title" value="Chemselect AQB Server Component" />

      <attribute name="Implementation-Version" value="${NOW}" />

      </section>

      </manifest>

      <fileset dir="${classes.dir}">

      <patternset>

      <include name="**/server/*"/>

      </patternset>

      </fileset>

      </jar>

      <!--

      Don't sign the library jars here. Doing so changes their modified date. This in turn causes

      webstart to think the jar has been modified and download again to the client.

      Instead, sign the jar when it is updated/committed to CVS.

      -->

      <!-- all other jars are pre-signed before checking into CVS. Only AQB.jar is not because it is generated on-the-fly -->

      <antcall target="signit">

      <param name="sign.jar" value="*.jar" />

      </antcall>

      <antcall target="component" />

      <jar jarfile="${dist.dir}/aqb.war" basedir="${war.dir}" />

      </target>

       

      <target name="component" if="comp.update">

      <!-- update the component/AQB.jar note this is condition if comp.update is defined via -D -->

      <copy file="${war.dir}/app/AQB.jar" tofile="${war.dir}/component/AQB.jar" overwrite="true"/>

      <!-- the user will have to commit this to CVS for themselves, we just copy -->

      <copy file="${war.dir}/app/AQB.jar" tofile="${web.src}/component/AQB.jar" overwrite="true"/>

      </target>

      <target name="signit" if="sign.jar">

      <property name="keystore" value="bostore"/>

      <property name="keystore.storepass" value="hicarrie"/>

      <property name="keystore.alias" value="MyKeyStore"/>

      <property name="sign.jar.dir" value="${war.dir}/app" />

      <signjar storepass="${keystore.storepass}" keystore="${keystore}" alias="${keystore.alias}">

      <fileset dir="${sign.jar.dir}" includes="${sign.jar}" />

      </signjar>

      <!-- this commented out signjar task is what I used before PGVL shared their 'bostore'

      <signjar keypass="secret" storepass="secret" keystore="${basedir}/testkeystore" alias="cct-svc">

      <fileset dir="${sign.jar.dir}" includes="${sign.jar}" />

      </signjar>-->

      </target>

      <target name="genkey">

      <!-- only needed when the test keystore has disappeared.-->

      <genkey keystore="${basedir}/testkeystore" alias="cct-svc" storepass="secret" dname="CN=CCT Services, OU=Computational Chemistry, O=Pfizer, C=US" />

      </target>

      <target name="deploy" depends="" description="create the war and deploy it to WL.">

      <taskdef name="wldeploy" classname="weblogic.ant.taskdefs.management.WLDeploy" classpathref="weblogic.classpath" />

      <wldeploy action="deploy" source="${dist.dir}/aqb.war" name="AdvancedQueryBuilder" user="${wl.user}" password="${wl.password}" adminurl="${wl.adminurl}" targets="${wl.servername}" />

      </target>

      <target name="undeploy">

      <taskdef name="wldeploy" classname="weblogic.ant.taskdefs.management.WLDeploy" classpathref="weblogic.classpath" />

      <wldeploy action="undeploy" source="${dist.dir}/aqb.war" name="AdvancedQueryBuilder" user="${wl.user}" password="${wl.password}" adminurl="${wl.adminurl}" targets="${wl.servername}" />

      </target>

      <target name="launch" description="Launch the test-gui from the jar">

      <mkdir dir="${dist.dir}/accord_util" />

      <unjar dest="${dist.dir}/accord_util" src="${lib.dir}/accord_externaleditor_utils.jar" />

      <java jar="${dist.dir}/AQB_full.jar" fork="true">

      <jvmarg value="-DWS_URL=${wsurl}" />

      <jvmarg value="-Djava.library.path=${dist.dir}/accord_util" />

      </java>

      </target>

      <target name="start" description="start the Sample Frame from the class directory.">

      <property name="lib.path.extra" value="${dist.dir}/lib_dir"/>

      <mkdir dir="${lib.path.extra}" />

      <unjar dest="${lib.path.extra}" src="${lib.dir}/accord_externaleditor_utils.jar" />

      <unjar dest="${lib.path.extra}" src="${lib.dir}/jacozoomDll2.jar" />

      <property name="classname" value="com.pfizer.ri.aqb.ui.AQBFrame" />

      <property name="WS_TYPE" value="rmi" />

      <java classname="${classname}" fork="true">

      <jvmarg value="-DWS_URL=${wsurl}" />

      <jvmarg value="-Xmx512M" />

      <!-- 64, 128, 192, 256 -->

      <jvmarg value="-Xms512M" />

      <!-- 64, 128, 192, 256 -->

      <jvmarg value="-Dlog4j.configuration=log4j-test.xml"/>

      <jvmarg value="-Djava.library.path=${lib.path.extra}" />

      <jvmarg value="-DWS_TYPE=${WS_TYPE}" />

      <!--<jvmarg value="-DWS_USER=${env.USERNAME}"/> -->

      <classpath>

      <pathelement location="${classes.dir}" />

      <pathelement location="${gen.class.dir}" />

      <fileset dir="${lib.dir}" includes="*.jar" />

      <path refid="axis.classpath" />

      </classpath>

      </java>

      </target>

      <target name="start.sample" unless="classname">

      <property name="classname" value="com.pfizer.ri.aqb.sample.AQBSampleFrame" />

      <antcall target="start" />

      </target>

      <target name="dist" description="create the distribution jar(s)">

      <property name="main-class" value="com.pfizer.ri.aqb.ui.AQBFrame"/>

      <genjar jarfile="${dist.dir}/AQBSearch.jar">

      <class name="${main-class}" />

      <library jar="${lib.dir}/looks-2.0.4.jar" />

      <library jar="${lib.dir}/log4j-1.2.8.jar" />

      <library jar="${lib.dir}/ejb.jar" />

      <library jar="${lib.dir}/jnlp.jar" />

      <library jar="${lib.dir}/csl-security.jar" />

      <library jar="${lib.dir}/csl-util.jar" />

      <library jar="${lib.dir}/rmiclient.jar" />

      <library jar="${lib.dir}/${axis.dir}/jaxrpc.jar" />

      <resource>

      <fileset dir="${classes.dir}" includes="*.properties *.gif *.png *.jpg *.xml" />

      </resource>

      <manifest>

      <attribute name="Main-Class" value="${main-class}" />

      <attribute name="Implementation-Title" value="Chemselect AQB" />

      <attribute name="Implementation-Version" value="${NOW}" />

      </manifest>

      <classpath>

      <pathelement path="${classes.dir}" />

      <pathelement path="${gen.class.dir}" />

      <path refid="class.path" />

      </classpath>

      </genjar>

      </target>

      <target name="build" depends="define.filtersets, wsdl2java,compile_generated,compile" description="Compiles everything and generates jars">

      <mkdir dir="${dist.dir}" />

      <copy todir="${classes.dir}">

      <fileset dir="${config.dir}" includes="*.txt **/*.properties **/*.xml" excludes="ant_*.properties" />

      <filterset refid="config.filter" />

      </copy>

      <copy todir="${classes.dir}">

      <!-- if set a filter when copying images, they will be corrupted. -->

      <fileset dir="${config.dir}" includes="**/*.gif **/*.jpg **/*.png">

      </fileset>

      </copy>

      <jar jarfile="${dist.dir}/AQB.jar">

      <manifest>

      <attribute name="Built-By" value="${user.name}" />

      <section name="common">

      <attribute name="Implementation-Title" value="Chemselect AQB" />

      <attribute name="Implementation-Version" value="${NOW}" />

      </section>

      </manifest>

      <fileset dir="${classes.dir}">

      <patternset>

      <include name="**/*" />

      <exclude name="**/server/*"/>

      </patternset>

      </fileset>

      <fileset dir="${gen.class.dir}">

      <include name="**/*.class" />

      </fileset>

      </jar>

      </target>

      <target name="clean" description="Deletes the build and distribution directories">

      <antcall target="ChemSelect.clean">

      </antcall>

      <delete dir="${war.dir}" />

      <delete dir="${dist.dir}" />

      <delete dir="${javadoc.dir}" />

      </target>

      <!-- <target name="cruisecontrol" depends="clean, build, test" description="used by cruisecontrol to perform the build." /> -->

        

      </project>