Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>My Environment: Fedora 8; WAS 6.1 (as installed with Rational Application Developer 7)</p> <p>The documentation is very poor in this area and there is a dearth of practical examples.</p> <p><strong>Using the WebSphere Application Server (WAS) Ant tasks</strong></p> <p>To run as described here, you need to run them from your server <strong>profile</strong> bin directory using the <strong>ws_ant.sh</strong> or <strong>ws_ant.bat</strong> commands.</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;project name="project" default="wasListApps" basedir="."&gt; &lt;description&gt; Script for listing installed apps. Example run from: /opt/IBM/SDP70/runtimes/base_v61/profiles/AppSrv01/bin &lt;/description&gt; &lt;property name="was_home" value="/opt/IBM/SDP70/runtimes/base_v61/"&gt; &lt;/property&gt; &lt;path id="was.runtime"&gt; &lt;fileset dir="${was_home}/lib"&gt; &lt;include name="**/*.jar" /&gt; &lt;/fileset&gt; &lt;fileset dir="${was_home}/plugins"&gt; &lt;include name="**/*.jar" /&gt; &lt;/fileset&gt; &lt;/path&gt; &lt;property name="was_cp" value="${toString:was.runtime}"&gt;&lt;/property&gt; &lt;property environment="env"&gt;&lt;/property&gt; &lt;target name="wasListApps"&gt; &lt;taskdef name="wsListApp" classname="com.ibm.websphere.ant.tasks.ListApplications" classpath="${was_cp}"&gt; &lt;/taskdef&gt; &lt;wsListApp wasHome="${was_home}" /&gt; &lt;/target&gt; &lt;/project&gt; </code></pre> <p>Command:</p> <pre><code>./ws_ant.sh -buildfile ~/IBM/rationalsdp7.0/workspace/mywebappDeploy/applist.xml </code></pre> <p><strong>A Deployment Script</strong></p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;project name="project" default="default" basedir="."&gt; &lt;description&gt; Build/Deploy an EAR to WebSphere Application Server 6.1 &lt;/description&gt; &lt;property name="was_home" value="/opt/IBM/SDP70/runtimes/base_v61/" /&gt; &lt;path id="was.runtime"&gt; &lt;fileset dir="${was_home}/lib"&gt; &lt;include name="**/*.jar" /&gt; &lt;/fileset&gt; &lt;fileset dir="${was_home}/plugins"&gt; &lt;include name="**/*.jar" /&gt; &lt;/fileset&gt; &lt;/path&gt; &lt;property name="was_cp" value="${toString:was.runtime}" /&gt; &lt;property environment="env" /&gt; &lt;property name="ear" value="${env.HOME}/IBM/rationalsdp7.0/workspace/mywebappDeploy/mywebappEAR.ear" /&gt; &lt;target name="default" depends="deployEar"&gt; &lt;/target&gt; &lt;target name="generateWar" depends="compileWarClasses"&gt; &lt;jar destfile="mywebapp.war"&gt; &lt;fileset dir="../mywebapp/WebContent"&gt; &lt;/fileset&gt; &lt;/jar&gt; &lt;/target&gt; &lt;target name="compileWarClasses"&gt; &lt;echo message="was_cp=${was_cp}" /&gt; &lt;javac srcdir="../mywebapp/src" destdir="../mywebapp/WebContent/WEB-INF/classes" classpath="${was_cp}"&gt; &lt;/javac&gt; &lt;/target&gt; &lt;target name="generateEar" depends="generateWar"&gt; &lt;mkdir dir="./earbin/META-INF"/&gt; &lt;move file="mywebapp.war" todir="./earbin" /&gt; &lt;copy file="../mywebappEAR/META-INF/application.xml" todir="./earbin/META-INF" /&gt; &lt;jar destfile="${ear}"&gt; &lt;fileset dir="./earbin" /&gt; &lt;/jar&gt; &lt;/target&gt; &lt;!-- http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.javadoc.doc/public_html/api/com/ibm/websphere/ant/tasks/package-summary.html --&gt; &lt;target name="deployEar" depends="generateEar"&gt; &lt;taskdef name="wsInstallApp" classname="com.ibm.websphere.ant.tasks.InstallApplication" classpath="${was_cp}"/&gt; &lt;wsInstallApp ear="${ear}" failonerror="true" debug="true" taskname="" washome="${was_home}" /&gt; &lt;/target&gt; &lt;/project&gt; </code></pre> <p>Notes:</p> <ul> <li>You can only run this once! You cannot install if the app name is in use - see other tasks like <strong>wsUninstallApp</strong></li> <li>It probably won't start the app either</li> <li>You need to run this on the server and the script is quite fragile</li> </ul> <p><strong>Alternatives</strong></p> <p>I would probably use Java Management Extensions (JMX). You could write a file-upload servlet that accepts an EAR and uses the deployment MBeans to deploy the EAR on the server. You would just POST the file over HTTP. This would avoid any WAS API dependencies on your dev/build machine and could be independent of any one project.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload