Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
5 replies Latest Post - ‏2007-10-17T18:14:05Z by SystemAdmin
SystemAdmin
SystemAdmin
1479 Posts
ACCEPTED ANSWER

Pinned topic Using Ant and WSAD for headless build issues

‏2005-08-24T20:31:36Z |
Hello,

When trying to build ouside of wsad (headless build) I have the following issue for every jsp:

projectBuild null XYZ.jsp:JspTranslate: PAR002 Class, "org.apache.xerces.dom.DocumentImpl", is not of type org.w3c.dom.Document.

When building from wsad workbench IDE I don't see this messages.

Does anybody knows the solution?

Thank you.
Updated on 2007-10-17T18:14:05Z at 2007-10-17T18:14:05Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    1479 Posts
    ACCEPTED ANSWER

    Re: Using Ant and WSAD for headless build issues

    ‏2005-09-08T22:09:08Z  in response to SystemAdmin
    > When trying to build ouside of wsad (headless build)
    > I have the following issue for every jsp:
    >
    > projectBuild null XYZ.jsp:JspTranslate: PAR002
    > Class, "org.apache.xerces.dom.DocumentImpl", is not
    > of type org.w3c.dom.Document.
    >
    > When building from wsad workbench IDE I don't see
    > this messages.
    >
    > Does anybody knows the solution?
    >
    I have just encountered the same problem. Have you solved it?

    Do you know where you are pulling in xerces from? I am wondering if the copy we are using might be down-level and the stricter error checking in the comand line is catching some inconsistency.

    I have noticed that WSAD's default settings ignore a lot of problems that get reported in the commandline builds.
    • SystemAdmin
      SystemAdmin
      1479 Posts
      ACCEPTED ANSWER

      Re: Using Ant and WSAD for headless build issues

      ‏2005-09-12T14:53:23Z  in response to SystemAdmin
      Hi all,

      in fact, you are not alone with this problem. I'm sure, it is a problem with classpathes for Xerces, but I din't solve it yet.

      Please post your solution, if you have one, here. Will do the same.

      Thanks
      Volker
      • SystemAdmin
        SystemAdmin
        1479 Posts
        ACCEPTED ANSWER

        Re: Using Ant and WSAD for headless build issues

        ‏2005-09-14T22:00:13Z  in response to SystemAdmin
        Yes, I solved the problem - I rewrote the scripts. In the initial script there were tags that count the errors and stop execution in case of any error. But some of the errors should be ignored. Here are my new working scripts. There are four files involved: setupBuild.bat (for configuration), build.bat (starts the ant), ProjectBuild.xml (builds and creates the actual jars and ear) build.xml (contain tasks to do the following 1.get latest code from cvs or any other repository, 2. calls ProjectBuild.xml 3. ftp the ear to some server for the deployment). I had to replace < and > with # to publish the files.

        BuildProject.xml

        #?xml version="1.0" encoding="UTF-8"?#
        #project name="ITSO Pro Guide Ant" default="Total" basedir="."#

        #!-- Set global properties --#
        #property name="project.ear" value="MyEAR" /#
        #property name="project.ejb" value="MyEJB" /#
        #property name="project.war.1" value="MyWeb" /#
        #property name="project.war.2" value="My2ndWeb" /#
        #property name="project.util" value="MySharedJava" /#
        #property name="type" value="incremental" /#
        #property name="debug" value="true" /#
        #property name="source" value="false" /#
        #property name="meta" value="false" /#
        #property name="noValidate" value="false" /#
        #target name="init"#
        #!-- Create the time stamp --#
        #tstamp /#
        #!-- Create the dist directory where the output files are placed --#
        #mkdir dir="${dist}" /#
        #/target#
        #target name="info"#
        #!-- Displays the properties for this run --#
        #echo message="debug=${debug}" /#
        #echo message="type=${type}" /#
        #echo message="source=${source}" /#
        #echo message="meta=${meta}" /#
        #echo message="noValidate=${noValidate}" /#
        #echo message="Output directory=${dist}" /#
        #echo message="project.ear=${project.ear}" /#
        #echo message="project.ejb=${project.ejb}" /#
        #echo message="project.war.1=${project.war.1}" /#
        #echo message="project.war.2=${project.war.2}" /#
        #echo message="project.util=${project.util}" /#
        #/target#

        #!-- import projects in wsad --#

        #target name="importProjects"#
        #echo#Importing ${project.name} into Studio workspace...#/echo#
        #importProject projectname="${project.ear}"/#
        #importProject projectname="${project.util}"/#
        #importProject projectname="${project.ejb}"/#
        #importProject projectname="${project.war.1}"/#
        #importProject projectname="${project.war.2}"/#
        #/target#
        #!-- START ProjectEjb --#
        #target name="getProjectDataEjb"#
        #getProjectData Basedir="${workspace.dir}/${project.ejb}" /#
        #echo#grtProjectData ${workspace.dir}/${project.ejb}#/echo#
        #/target#
        #target name="deployEjb" depends="getProjectDataEjb"#
        #!-- Generates deployed code for the EJBs --#
        #ejbDeploy EJBProject="${project.ejb}" NoValidate="${noValidate}" /#
        #/target#

        #target name="buildEjb"#
        #!-- Builds the EJB project --#
        #projectBuild ProjectName="${project.ejb}" BuildType="${type}" DebugCompilation="${debug}" /#
        #/target#
        #!-- END --#
        #!-- START ProjectWeb_1 --#
        #target name="getProjectDataWeb"#
        #getProjectData Basedir="${workspace.dir}/${project.war.1}" /#
        #echo#grtProjectData ${workspace.dir}/${project.war.1}#/echo#
        #/target#
        #target name="buildWar1" depends="getProjectDataWeb"#
        #!-- Builds the WAR project --#
        #projectBuild ProjectName="${project.war.1}" BuildType="${type}" DebugCompilation="${debug}" /#
        #/target#
        #!-- END --#
        #!-- START ProjectWeb_2 --#
        #target name="getProjectDataWebInternal"#
        #getProjectData Basedir="${workspace.dir}/${project.war.2}" /#
        #echo#grtProjectData ${workspace.dir}/${project.war.2}#/echo#
        #/target#
        #target name="buildWar2"#
        #!-- Builds the WAR project --#
        #projectBuild ProjectName="${project.war.2}" BuildType="${type}" DebugCompilation="${debug}" /#
        #/target#
        #!-- END --#
        #!-- START ProjectUtil --#
        #target name="getProjectDataUtil"#
        #getProjectData Basedir="${workspace.dir}/${project.util}" /#
        #echo#grtProjectData ${workspace.dir}/${project.util}#/echo#
        #/target#
        #target name="buildUtil" depends="getProjectDataUtil"#
        #!-- Builds the utility project --#
        #projectBuild ProjectName="${project.util}" BuildType="${type}" DebugCompilation="${debug}" /#
        #/target#
        #!-- END --#
        #!-- START ProjectEar --#
        #target name="getProjectDataEar"#
        #getProjectData Basedir="${workspace.dir}/${project.ear}" /#
        #echo#grtProjectData ${workspace.dir}/${project.ear}#/echo#
        #/target#
        #target name="buildEar" depends="getProjectDataEar"#
        #!-- Builds the EAR project --#
        #projectBuild ProjectName="${project.ear}" BuildType="${type}" DebugCompilation="${debug}" /#
        #/target#
        #!-- END --#

        #target name="exportEjb" depends="init"#
        #!-- Exports the EJB JAR --#
        #ejbExport EJBProjectName="${project.ejb}" EJBExportFile="${dist}/${project.ejb}.jar" ExportSource="${source}" overwrite="true" /#
        #/target#

        #target name="exportWar1" depends="init"#
        #!-- Exports the WAR file --#
        #warExport WARProjectName="${project.war.1}" WARExportFile="${dist}/${project.war.1}.war" ExportSource="${source}" overwrite="true" /#
        #/target#

        #target name="exportWar2" depends="init"#
        #!-- Exports the WAR file --#
        #warExport WARProjectName="${project.war.2}" WARExportFile="${dist}/${project.war.2}.war" ExportSource="${source}" overwrite="true" /#
        #/target#

        #target name="exportEar" depends="init"#
        #!-- Exports the EAR file --#
        #earExport EARProjectName="${project.ear}" EARExportFile="${dist}/${project.ear}.ear" ExportSource="${source}" IncludeProjectMetaFiles="${meta}" overwrite="true" /#
        #/target#

        #target name="buildAll" depends="importProjects,buildUtil,deployEjb,buildEjb,buildWar1,buildWar2,buildEar"#
        #!-- Builds all projects --#
        #echo message="Built all projects" /#
        #/target#

        #target name="exportAll" depends="exportEjb,exportWar1,exportWar2,exportEar"#
        #!-- Exports all files --#
        #echo message="Exported all files" /#
        #/target#

        #target name="Total" depends="buildAll,exportAll"#
        #!-- Buidl all projects and exports all files --#
        #echo message="Total finished" /#
        #/target#

        #target name="clean"#
        #!-- Delete the output files --#
        #delete file="${dist}/${project.ejb}.jar" failOnError="false" /#
        #delete file="${dist}/${project.war.1}.war" failOnError="false" /#
        #delete file="${dist}/${project.war.2}.war" failOnError="false" /#
        #delete file="${dist}/${project.ear}.ear" failOnError="false" /#
        #/target#

        #/project#

        build.xml

        #?xml version="1.0"?#
        #project name="masterBuild" default="init"#

        #target name="init" unless="build.time"#
        #tstamp##format property="build.time" pattern="yyyy-MM-dd.HH.mm.ss"/##/tstamp#
        #echo#Build started at ${build.time}...#/echo#

        #echo#

        Usage: build <release# <target# ...

        Available targets:

        init - displays the currently set variables and displays this help message
        extractCode - extracts the contents of cmsynergy into the workspace.dir
        (${workspace.dir}) directory
        buildAll - builds each of the projects. This target will run build.xml (using the default target)
        in each of the project directories. In turn, these ant scripts should do whatever
        compiling is necessary as well as package any needed artifacts (EAR, WAR, RAR, JAR
        files etc...) to the ftp.localdir (${output.dir}) directory.
        ftpAll - FTPs the packaged files to the ftp.server (${ftp.server}) FTP site.

        To run a full build:

        c:\Automation\buildscripts# build init extractCode buildAll ftpAll


        Using properties from ${buildscripts.dir}/setupBuild.bat

        buildscripts.dir = ${buildscripts.dir}
        cmsynergy.dir = ${cmsynergy.dir}
        cmsynergy.view = ${cmsynergy.view}
        cmsynergy = ${cmsynergy}
        workspace.dir = ${workspace.dir}
        log.dir = ${log.dir}
        output.dir = ${output.dir}
        ftp.server = ${ftp.server}
        ftp.user = ${ftp.user}
        ftp.password = ********
        ftp.port = ${ftp.port}

        #/echo#

        #/target#

        #target name="extractCode" depends="init"#
        #echo#Extracting CM Synergy ${cmsynergy} to ${cmsynergy.view}...#/echo#

        #!-- TODO here goes the exec command to run the cm synergy extract --#

        #echo#Copying CM Synergy files to new workspace ${workspace.dir}...#/echo#
        #copy todir="${workspace.dir}"#
        #fileset dir="${cmsynergy.view}"/#
        #/copy#
        #echo#${workspace.dir} is up-to-date with CM Synergy ${cmsynergy}!#/echo#
        #/target#

        #!-- ========== clean class files========== --#
        #target name="clean-classes" description="Removes all class files"#
        #delete quiet="true" includeEmptyDirs="false"#
        #fileset dir="${workspace.dir}"#
        #include name="*/.class"/#
        #/fileset#
        #/delete#
        #/target#
        #!-- ========== clean generated ========== --#
        #target name="clean-generated" description="Removes all generated Deploy and RMIC code and class files"#
        #delete quiet="true" includeEmptyDirs="true"#
        #fileset dir="${workspace.dir}/META-INF/backends"/#
        #fileset dir="${workspace.dir}/META-INF" includes="Table.ddl"/#
        #fileset dir="${workspace.dir}" includes="**/websphere_deploy/**"/#
        #fileset dir="${workspace.dir}" includes="*/EJS.*,*/_.*,*/Concrete"/#
        #/delete#
        #/target#

        #target name="cleanAll" depends="clean-classes, clean-generated"/#

        #target name="buildAll" depends="init,cleanAll"#
        #ant antfile="ProjectBuild.xml"#
        #property name="dist" value="${output.dir}"/#
        #property name="workspace.dir" value="${workspace.dir}"/#
        #/ant#

        #/target#

        #!-- TODO the following part has not been tested yet --#

        #target name="ftpAll" depends="init"#
        #exec dir="${output.dir}" executable="cmd.exe"#
        #arg line="/c dir /s"/#
        #/exec#
        #ftp server="${ftp.server}"
        port="${ftp.port}"
        remotedir="${ftp.remotedir}"
        userid="${ftp.user}"
        password="${ftp.password}"
        ignoreNoncriticalErrors="true"#
        #fileset dir="${output.dir}"#
        #include name="*/.*"/#
        #/fileset#
        #/ftp#
        #echo#All files in ${output.dir} FTPed to ftp://${ftp.server}:${ftp.port}${ftp.remotedir}!#/echo#
        #/target#

        #/project#

        setupBuild.bat

        rem
        rem This file is used to set up the necessary variables to run build automation.
        rem Run build.bat from the same directory.
        rem
        rem Important: Use 8.3 file and directory names (ie. "PROGRA~1", not "Program Files")
        rem

        rem WSAD IE 5.0 installation directory - use back slashes
        SET WSAD_HOME=C:\PROGRA~1\IBM\WEBSPH~1\APPLIC~1\v5.1.2

        rem CM Synergy base directory (usually C:\Program Files\Telelogic\CM Synergy 6.3\bin) - use back slashes
        SET CMSYNERGY_HOME="C:\Program Files\Telelogic\CM Synergy 6.3\bin"

        rem Root directory of the automation scripts and workspaces (usually c:\Automation) - use back slashes
        SET AUTOMATION_HOME=c:\Automation

        rem FTP server
        SET FTP_SERVER=rtpgsa.raleigh.ibm.com

        rem FTP port (default port is 21)
        SET FTP_PORT=21

        rem FTP user ID
        SET FTP_USER=dleigh

        rem FTP password
        rem If you "rem" out the following line, you will be prompted to enter the password.
        rem This means that you will not be able to run truly unattended build.
        SET FTP_PASSWORD=x23clqr

        rem Directory on FTP server to upload the newly built files - use forward slashes
        SET FTP_REMOTEDIR=tmp/autobuild

        rem
        rem You shouldn't have to change any of the following environment variables
        rem

        rem JAVA home directory (usually %WSAD_HOME%\runtimes\base_v5\java) - use back slashes
        SET JAVA_HOME=%WSAD_HOME%\runtimes\base_v5\java

        rem We want a date in the format YYYYMMDD
        SET TODAYS_DATE=%DATE:~10%%DATE:~4,2%%DATE:~7,2%

        rem The directory where the log files will be written - use back slashes
        SET LOGDIR=%AUTOMATION_HOME%\dailybuilds\%CMSYNERGY%\%TODAYS_DATE%

        rem The eclipse log files directory of running scripts
        SET LOGDIR_ECLIPSE=%AUTOMATION_HOME%\logs

        rem Directory on local machine where EARs etc.. will be created and from where these
        rem files will be sent to the FTP_SERVER machine - use forward slashes
        SET OUTPUT_DIR=%AUTOMATION_HOME%/dailybuilds/%CMSYNERGY%/%TODAYS_DATE%

        rem CM Synergy view directory - use back slashes
        rem example - SET CMSYNERGY_VIEW=%AUTOMATION_HOME%\%CMSYNERGY%_view
        SET CMSYNERGY_VIEW=C:\CashServicesCMWorkArea\ccm_wa\FLWebCash

        rem WSAD workspace directory - use back slashes
        SET WORKSPACE=%AUTOMATION_HOME%\workspace\%CMSYNERGY%\%TODAYS_DATE%

        build.bat

        @echo off
        setlocal
        SET PATH=%PATH%;

        if not "%1"=="" goto continue
        echo Usage: %0 (CMSYNERGY) (BUILD_TARGET) ...
        goto done

        :continue
        SET CMSYNERGY=%1

        call setupBuild.bat

        :continue1
        if exist %WSAD_HOME% goto continue2
        echo Error: WSAD_HOME="%WSAD_HOME%" is not a valid directory. Edit setupBuild.bat.

        :continue2
        if exist %JAVA_HOME% goto continue3
        echo Error: JAVA_HOME="%JAVA_HOME%" is not a valid directory. Edit setupBuild.bat.

        :continue3
        if exist %CMSYNERGY_HOME% goto continue4
        echo Error: CMSYNERGY_HOME="%CMSYNERGY_HOME%" is not a valid directory. Edit setupBuild.bat.

        :continue4
        if not defined FTP_PASSWORD (
        echo Enter the FTP password for %FTP_USER%:
        set /P FTP_PASSWORD=
        cls
        )

        :run
        %WSAD_HOME%\eclipse/jre/bin/java -Dworkspace.dir=%WORKSPACE% -Dlog.dir=%LOGDIR% -Doutput.dir=%OUTPUT_DIR% -Dcmsynergy.dir=%CMSYNERGY_HOME% -Dcmsynergy.view=%CMSYNERGY_VIEW% -Dcmsynergy=%CMSYNERGY% -Dbuildscripts.dir=%AUTOMATION_HOME%\buildscripts -Dftp.server=%FTP_SERVER% -Dftp.port=%FTP_PORT% -Dftp.user=%FTP_USER% -Dftp.password=%FTP_PASSWORD% -Dftp.remotedir=%FTP_REMOTEDIR% -cp %WSAD_HOME%\eclipse\startup.jar org.eclipse.core.launcher.Main -logfile %LOGDIR_ECLIPSE%\eclipse_%TODAYS_DATE%.log -debug -verbose -application com.ibm.etools.j2ee.ant.RunAnt -data %WORKSPACE% -buildfile %AUTOMATION_HOME%/buildscripts/build.xml %2 %3 %4 %5 %6 %7 %8 %9
        echo RunAnt returned %ERRORLEVEL%
        if "%ERRORLEVEL%"=="23" goto run
        if "%ERRORLEVEL%"=="15" echo You already have WSAD open on this workspace (%WORKSPACE%)

        :done
        endlocal

        The directory structure:
        C:/Automation
        C:/Automation/buildscripts - contains the above scripts
        C:/Automation/dailybuilds/projectName - results from the build
        C:/Automation/logs - output log file from the execution of the scripts
        C:/Automation/workspace/projectName - working dir for the build, here are the copies of the project from cvs

        Command to run only the build:
        build projectName init extractCode buildAll

        To create the above scripts I used the published examples from the following references:

        Performing unattended daily builds with WebSphere Studio and Ant -- Part 3
        http://www-128.ibm.com/developerworks/websphere/library/techarticles/0404_bowker/0404_bowker3.html
        Using Ant with WebSphere Studio Application Developer
        http://www-128.ibm.com/developerworks/websphere/library/techarticles/0203_searle/searle1.html
        Redbook 246957 Chapter 19 http://www.redbooks.ibm.com/redbooks/SG246957/wwhelp/wwhimpl/js/html/wwhelp.htm
        Redbook 246993 Chapter 17 http://www.redbooks.ibm.com/redbooks/SG246993/wwhelp/wwhimpl/js/html/wwhelp.htm

        Hope this helps.
        • RussoZ
          RussoZ
          1 Post
          ACCEPTED ANSWER

          Re: Using Ant and WSAD for headless build issues

          ‏2006-07-04T15:41:22Z  in response to SystemAdmin
          Let's hope someone is still reading this topic.

          I have got the same errors here now, and I have taken a look at miglena's solution, but I am not sure what is the catch in what she did. I tried somethings here, but still got the same error.

          Anyone has had better luck?

          Alexei
          alexeiz NOSPAMISAID br ibm com
    • SystemAdmin
      SystemAdmin
      1479 Posts
      ACCEPTED ANSWER

      Re: Using Ant and WSAD for headless build issues

      ‏2007-10-17T18:14:05Z  in response to SystemAdmin
      I was getting this error when I try to build in WSAD, I tried rebuilding project (Project -> Rebuild Build Project) solved this problem.