Posts Remote deploy to Websphere – Take 3
Post
Cancel

Remote deploy to Websphere – Take 3

First post is here

Second Post is here

This is still work in progress and needs refinement (a How-I-Did-It not a How-To).

Running with Rational Application Developer 6.0.0.1 w/Interim Fix 003.

Although I’ve tested the concepts, yet, I haven’t yet managed to execute
a compete cycle of Checkout (from CVS), Build App, Generate EAR, Deploy
EAR to server. I still have issues to deal with regarding the migration
from WS5.x to WS6.0.0.1 (It might not be solved before WS 6.0.1).

Some of the targets below are used to invoke Headless ANT targets instead of using a batch file as per IBM examples (regular ANT targets
invoking Headless ANT targets).

Also, the ear.deploy target need to be reworked following the other targets (though it works in its current state).

Again this is still work in progress which I currently have to leave for a while.

For all the desperate Websphere ANT tasks googlers – here it is – deploy.xml

<?xml version="1.0"?>
<project name="Build" default="default" basedir=".">

	<property file="build.properties"></property>
	<property name="ear.file.name" value="${workspace}/${project.name}.ear"/>
	<property name="path.on.server" value="Temp"/>

	<property name="runtime.file" value="C:Program FilesIBMRationalSDP6.0runtimesbase_v6libwsanttasks.jar"/>
	<property name="runtime.path" value="C:Program FilesIBMRationalSDP6.0rwdeclipsepluginscom.ibm.etools.j2ee.ant_6.0.0.1runtime"/>
	<property name="core.runtime.path" value="C:Program FilesIBMRationalSDP6.0eclipsepluginsorg.eclipse.core.runtime_3.0.2"/>
	<property name="resources.path" value="C:Program FilesIBMRationalSDP6.0eclipsepluginsorg.eclipse.core.resources_3.0.1"/>
	<property name="osgi.path" value="C:Program FilesIBMRationalSDP6.0eclipsepluginsorg.eclipse.osgi_3.0.1"/>
	<property name="startup.file" value="C:Program FilesIBMRationalSDP6.0eclipsestartup.jar"/>
	<property name="rational.home" value="C:/Progra~1/IBM/Rational/SDP/6.0/nuntimes/base_v6/bin"/>

	<path id="rational.classpath">
		<fileset file="${runtime.file}"></fileset>
		<fileset dir="${runtime.path}">
			<include name="**/antextras.jar"/>
			<include name="**/antj2ee.jar"/>
			<include name="**/antrunner.jar"/>
		</fileset>
		<fileset dir="${core.runtime.path}">
			<include name="**/nuntime.jar"/>
		</fileset>
		<fileset dir="${resources.path}">
			<include name="**/nesources.jar"/>
			<include name="**/nesources-ant.jar"/>
		</fileset>
		<fileset dir="${osgi.path}">
			<include name="**/osgi.jar"/>
		</fileset>
	</path>

	<path id="eclipse.classpath">
		<fileset file="${startup.file}"></fileset>
	</path>

    <!-- ===============================================
          target: default
    ==================================================== -->
	<target name="default">
		<echoproperties srcfile="build.properties"></echoproperties>
		<echo> ----------------------------------------- </echo>
		<echo message="Please Select A Target To Run"></echo>
	</target>

    <!-- ===============================================
          target: get.app.from.cvs
    ==================================================== -->
	<target name="get.app.from.cvs"
		description="Checks out the Project from CVS into the workspace directory">
		<cvs
cvsRoot=":pserver:${cvs.username}:${cvs.password}@${cvs.host.name}:${cvs.dir}"
	  			command="checkout"
	  			quiet="true"
				package="${project.name}"
		  		failonerror="true"
				dest="${cvs.checkout.dir}"
				/>
	 </target>

    <!-- =================================
          target: project.import
         ================================= -->
	 <target name="project.import" description="Imports a project into the workspace">
    	<!-- Stupidly non-elegant -->
    	<!-- Running headless ant which in turn run this (the same) build file invoking the headless.import task -->
    	<!-- Project has to be imported even if it's physically under the workspace -->
		<java
			classpathref="eclipse.classpath"
			classname="org.eclipse.core.launcher.Main"
			failonerror="true"
			fork="true"
			resultproperty="return">
			<arg line="-application com.ibm.etools.j2ee.ant.RunAnt -data ${workspace} -verbose -buildfile deploy.xml headless.import" />
		</java>
	</target>

	<target name="headless.import">
		<!-- Could not import from the file system using projectlocation="${cvs.checkout.dir}" ,			have to import the project when its contents are in the workspace directory -->
		<!-- Importing my web project together with the enterprise one -->
		<projectImport projectname="${project.name}" />
		<projectImport projectname="${ear.project.name}" />
		<eclipse.refreshLocal resource="${project.name}/JavaSource"  depth="infinite" />
	</target>

    <!-- =================================
          target: project.build
         ================================= -->
	 <target name="project.build" description="Build the application">
	<!-- Stupidly non-elegant -->
    	<!-- Running headless ant which in turn run this (the same) build file invoking the headless.build task -->
		<java
			classpathref="eclipse.classpath"
			classname="org.eclipse.core.launcher.Main"
			failonerror="true"
			fork="true"
			>
			<arg line="-application com.ibm.etools.j2ee.ant.RunAnt -data ${workspace} -verbose -buildfile deploy.xml headless.build"/>
		</java>
	</target>

	<target name="headless.build">
    	<projectBuild
    		projectname="${project.name}"
    		failonerror="false"
    		showerrors="true"
    		debugcompilation="true"
    		quiet="true"
    		buildtype="${build.type}"
    		summary="true"/>
	</target>

    <!-- =================================
          target: ear.generate
         ================================= -->
    <target name="ear.generate" description="Geneartes the ear file">
	<!-- Stupidly non-elegant -->
    	<!-- Running headless ant which in turn run this (the same) build file invoking the headless.ear.generate task -->
    	<java
    		classpathref="eclipse.classpath"
    		classname="org.eclipse.core.launcher.Main"
    		failonerror="true"
    		fork="true"
    		resultproperty="return">
    		<arg line="-application com.ibm.etools.j2ee.ant.RunAnt -data ${workspace} -verbose -buildfile deploy.xml headless.ear.export" />
    	</java>
    </target>

	<target name="headless.ear.export">
		<earExport
			overwrite="true"
			exportsource="false"
			includeprojectmetafiles="false"
			EARProjectName="${ear.project.name}"
			EARExportFile="${ear.file.name}"/>
	</target>

    <!-- ===============================================
          target: ear.deploy
    ==================================================== -->
	<target name="ear.deploy" depends="upload.ear.file" description="Deploys the EAR file to the server">
		<exec dir="${rational.home}" executable="cmd" os="Windows XP">
		  <arg line="/c wsadmin.bat -conntype SOAP -host ${websphere.host.name} -port ${websphere.soap.port} -lang jython -c &quot;AdminApp.install('${path.on.server}/${project.name}.ear}', '-nopreCompileJSPs -defaultbinding.virtual.host default_host -verbose')&quot;" />
		</exec>
	</target>

</project>

End of deploy.xml

Migrated Comment - Subhan on July 14, 2005:
Nice theme for the blog. I came here surfing AJAX :)

Migrated Comment - Youssef on July 25, 2005:
I am thinking of doing the same in my current project (customizing some Siebel application that runs on WAS and i have a WSAD workspace) However, I wanted to follow another approach! I was thinking that my ANT build file should be IDE independent (using regular javac for compiling and xdoclet to generate DDs) and only use the tasks related to WAS. What do you think of that?

Migrated Comment - Tamer Salama on July 25, 2005:
Well Youssef: I think if you’re going to rely on WAS tasks anyway, then you’re at IBM’s mercy. It looks like their tasks are strongly dependent on WSAD/RAD workspaces. Moreover, some of the common ANT tasks might produce files that are “incompatible” with WAS (as was produced via the ear task) – you might want to dig into the differences. HTH

Migrated Comment - Youssef on July 26, 2005:
Thanks, but you replied on the second part of my comment. The first was that I am thinking that the ant biuld should be IDE-independent so that you might use WSAD, eclipse 3.x or Netbeans. for debugging, i used to use remote debugging feature JPDA which worked great for me.

Migrated Comment - Tamer Salama on July 26, 2005:
Absolutely! That was the idea about using ANT in the first place (IDE Independency). But, using IBM supplied ANT tasks meant that you?re tied to WSAD/RAD environment.
For instance, placing a project under the workspace directory is not enough for the project to be comprehended by those ANT tasks. The project has to be explicitly “imported” into the “workspace” using another ANT task.
I’d really love to see if anyone has a simpler approach for deploying WAS applications remotely.
Sorry Youssef, I didn’t understand the part of remote debugging. May be if you wish to mail me about it? :)

Migrated Comment - xiuxiu on August 9, 2005:
I just start the topic. And I am also willing to use ws_ant or wsadmin to complete the deployment.but Tamer’s weblog really disappointed me.Anyway, I still want to have a try. Wish to see the good result.

Migrated Comment - Sanjeet on March 18, 2006:
Hello,
I am trying to run the example
C:\Program Files\IBM\Rational\SDP\6.0\rwd\eclipse\plugins\com.ibm.etools.j2ee.ant_6.0.0.1 provided by IBM. It is giving me error

[projectBuild] Building: AdderJAVA (Done)
[projectSetBuild] ERROR: [0]. Type=org.eclipse.jdt.core.problem Line=0 Resource=\AdderJAVA
[projectSetBuild] ERROR: [0].. Message=The project was not built since its build path is incomplete.
Cannot find the class file for java.lang.Object. Fix the build path then try building this project
[projectSetBuild] ERROR: [1]. Type=org.eclipse.jdt.core.problem Line=1 Resource=\AdderJAVA\com\ibm\etools\ant\extras\sample\AdderJava.java
[projectSetBuild] ERROR: [1].. Message=The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files

I configured these properties only:
classpathVariable.WAS_60_INSTALLDIR=C:/Program Files/IBM/WebSphere/AppServer1
targetRuntime.targetLocation=C:/Program Files/IBM/WebSphere/AppServer1
set WORKSPACE=C:\Program Files\IBM\Rational\SDP\6.0\rwd\eclipse\plugins\com.ibm.etools.j2ee.ant_6.0.0.1\Example Do I need to configure more properties? Why I am getting these error? Please advice me, Regards,
Sanjeet.

Migrated Comment Stef P on May 31, 2006:
I would like to ask you something concerning the headless targets, e.g. “headless.import”. The tasks that exist in its body, for example “eclipse.refreshLocal” and “ProjectImport” are not core ant tasks (right?). Are they eclipse’s extensions or what? Where can i find some info about them?
Thanks, im trying to understand the buildfile im working on:))

Contents

Search Results