0

I have a setup where I'm running Oracle BPEL Process Manager in a set of WebLogic 9.2 servers. I have a release management system on another server that builds and deploys BPEL suitcases into these servers, using Ant. The recommendation from Oracle is that the suitcase is deployed explicitly to the first node in the BPEL PM cluster, and all other nodes are subsequently restarted (as opposed to directly deploying the suitcase into each node).

I have the following tasks in the Ant script to perform this set of activities:

<wlserver host="${node.hostname}" port="${node.port}" 
          configFile="${user.home}/.ant/weblogic/config/${env}/${node.config}"
          username="${bpel.cluster.user}" password="${bpel.cluster.password}" 
          action="reboot"/> 

However, this task appears to want to start a local server, and then issue it the "reboot" command, instead of connecting to a remote instance and reboot it. In fact, almost every example I've found so far seems to assume I'm going to deploy/configure/administrate a domain on my workstation, or that I'm going to execute the Ant script on the same server where the domain is configured. I want neither of these.

Is there a way to manage a remote WebLogic domain in a programmatic fashion from Ant?

EEAA
  • 108,414
  • 18
  • 172
  • 242
Paul Schifferer
  • 103
  • 2
  • 4

2 Answers2

3

You can reboot a WebLogic managed server remotely via the wlserver ANT task, but such requests must be done through the domain Admin server. For example:

<wlserver 
    adminserverurl="t3://myadminhost:7001"
    username="weblogicAdminUser"
    password="weblogicPassword"
    servername="MyManagedServer" 
    action="reboot"
    noExit="true"/>

Having said that, using the ANT task to reboot a managed server can be unreliable. I would recommend using the Weblogic Scripting Tool (WLST) instead.

daz
  • 46
  • 2
1

The answer is yes. There are probably better ways but here's how I do it:

My Ant setup uses the maverick-ssh library to open an ssh connection to the server (the ssh task). It then transfers our deployment (a zip and war file) to the server, and then it exec's a shell script which uses WLST to deploy it onto the "local" server.

Here's the ant task:

<target name="transfer-build" description="">
    <property name="transfer.host" value="${deploy.host}"/>
    <property name="transfer.user" value="${deploy.user}"/>
    <property name="transfer.pass" value="${deploy.pass}"/>
    <property name="transfer.cwd"  value="${dir.war.tmp}"/>
    <property name="transfer.conf" value="${file.conf_zip}"/>
    <property name="transfer.war"  value="${file.tds_war}"/>

    <ssh host="${transfer.host}" username="${transfer.user}" password="${transfer.pass}" version="2">
        <sftp action="put" remotedir="${dir.deploy}" verbose="false">
            <fileset dir="${transfer.cwd}" >
                <include name="${transfer.conf}"/>
                <include name="${transfer.war}"/>
            </fileset>
        </sftp>
        <exec cmd="~/deploy-build.sh ${transfer.conf} ${transfer.war}"/>
    </ssh>
</target>

And the relevant part from the deploy-build.sh script:

# issue the redeploy command
java weblogic.Deployer -adminurl t3://`hostname`:9000 -user weblogic -password weblogicadmin -name fooapp -deploy /path/to/weblogic/user_projects/domains/mydomain/fooapp.war

Credit for the WLST command invocation goes to some BEA help docs which I can't find anymore...

weiji
  • 268
  • 1
  • 3
  • 10