Archive for July, 2005

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 Files\IBM\Rational\SDP\6.0\runtimes\base_v6\lib\wsanttasks.jar"/>
	<property name="runtime.path" value="C:\Program Files\IBM\Rational\SDP\6.0\rwd\eclipse\plugins\com.ibm.etools.j2ee.ant_6.0.0.1\runtime"/>
	<property name="core.runtime.path" value="C:\Program Files\IBM\Rational\SDP\6.0\eclipse\plugins\org.eclipse.core.runtime_3.0.2"/>
	<property name="resources.path" value="C:\Program Files\IBM\Rational\SDP\6.0\eclipse\plugins\org.eclipse.core.resources_3.0.1"/>
	<property name="osgi.path" value="C:\Program Files\IBM\Rational\SDP\6.0\eclipse\plugins\org.eclipse.osgi_3.0.1"/>
	<property name="startup.file" value="C:\Program Files\IBM\Rational\SDP\6.0\eclipse\startup.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

Remote Deploy to Websphere - 2

First post is here

Third post is here

I found out that the provided IBM ant tasks are designed to run from within eclipse (apparently as plugins, through a set of clicks).
In order to run them as _Headless Tasks_ (IBM: “Headless” means running builds from the command line without using the WebSphere Studio or Rational Application Developer GUI) they have to be invoked through some batch files (from IBM).

I went through these files, and I'm in the process of writing some (regular) ANT script that would:
My Ant Script -> Eclipse Launcher -> IBM class -> Intermediate Build File -> IBM ANT Task.

This has worked, but, according to a bug in the provided EARExport task, the .ear file was never written.

I'm currently downloading an update (RAD 6.0.0.1) to my environment (RAD 6.0) of about 950+ MBytes, in order to apply an Interim Fix 002 (which I have to also download) to be able to run the EARExport task without a problem.
Would someone tell me please, can it be more complicated than this?

Remote Deploy to Websphere - Should it be that difficult?

Second Post is
Here

Third post is
here

In an effort to ease our deployment cycle, I've been trying to develop simple ANT scripts to deploy to a remote server

running Websphere 6.0.
To my joy, I found that IBM was kind enough to provide ANT tasks that take care of the deployment (wsInstall, wsadmin) [Poor

me: I thought this has to be well documented].

<wsInstallApp ear="${earfile}" host="${ipaddress}" conntype="SOAP" port="8880" wasHome="${washome}" />

After trying out the task. Nothing seems to be working:


Unable to parse setupCmdLine: null\bin\setupCmdLine.bat (The handle is invalid.)
…….
The java class is not found: com/ibm/ws/bootstrap/WSLauncher



There seems to be some misguidance about where this task should be running (a build/local machine, or a remote one) -

Feature/Bug?

After digging more, I decided to head another way. Trying out some sample script .Jacl files.

Straight from an archived pdf file

Remote base server deployment:

[A funny part] If you install webSphere Application Server on the build machine, then the WebSphere Application Server

runtime and its wsadmin command tool are available, even if that installation server is never configured or started.


So, this means that I just have to install the Whole Application Server in order to make use of the wsadmin tool - how about

those licensing fees?

[Even Funnier] Note: The above solution for remote base server deployment only works if both the remote and local

installation (where wsadmin is running) are WebSphere version-6 installations. If either of the installations is a WebSphere

version-5.0 or version-5.1 installation then you will get an error “X:\MyTEMP\appnnnnn.ear does not exist for installation”.

Base server (non-managed) Remote File Transfer support is a version-6 enhancement, unfortunately the version-5x error is not

clear about that.

[This was straight out of their pdf file - I swear, I haven't edited it :-)]

Making note of those notes, I did the following using ANT:

  • Generate the .ear file.
  • Run a batch file I found with Rational Application Developer base runtime (isn't that the runtime IBM was talking about

    when mentioning the “Websphere Application Server Runtime” - If so, why haven't they said that?).


<target name="ear.deploy" description="Deploy the EAR file to the server">
   <exec dir=”${rationalhome}” executable=”cmd” os=”Windows XP”>
      <arg line=”/c wsadmin.bat -conntype SOAP -host 10.1.2.103 -port 8880 -lang jython -c “AdminApp.install

'c:/TestEAR.ear', '-nopreCompileJSPs -defaultbinding.virtual.host default_host -verbose')”"/>
   </exec>


Now, I'm getting:
..IWAE0022E Exception occurred loading deployment descriptor for module ...

Googling for the error - I found that:

PQ98556: WEBSPHERE V6.0 DOES NOT HAVE BACKWARD COMPATABILITY WITH 2.3 SERVLET SPEC. ONLY OPERATES WITH 2.4 SERVLET SPEC.
Error description

* PROBLEM DESCRIPTION: Application Server 6.0 does not have full backwards compatibility with the 2.3 servlet specification.

LATER: The reason for this error was that the generated .ear file (from ANT task) is different than that generated via the “export ear” from within RAD.

It seems I'm missing out on some orientation to IBM developer-nonfriendly-opensource-turned-proprietary products (Websphere

Application Server, Application Developer, etc…).

I will later update the post with my latest adventures in websphere land - wish me luck.