How to restart a WebLogic domain remotely using Ant

antweblogic

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?

Best Answer

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.