views:

1021

answers:

2

I have to deploy my application in weblogic through ant. what i am doing is:

<target name="deployOnServer1" >
     <echo>*********** Start deploying war file on SERVER1 *********** </echo>
     <wldeploy action="redeploy"
      source="${dist.dir}/${ant.project.name}.war" 
      name="${wls.appname}"      
      user="${wls1.user}" 
      password="${wls1.password}" 
      adminurl="${wls1.adminurl}"      
      targets="${wls1.targets}"
      verbose="true" 
      debug="true" 
      upload="true"
      remote="true"
     />
</target>

This deploys my application on weblogic, only if there is not any other application with same application context. So what i did is:

 <target name="undeployOnServer1">
      <echo>*********** Start unDeploying war file on SERVER1 *********** </echo>
     <wldeploy
     action="undeploy" verbose="true" debug="true"
      name="${wls.appname}"
     user="${wls1.user}" password="${wls1.password}" 
     adminurl="${wls1.adminurl}"      
     failonerror="false" 

     />
  </target>

and changed the deployOnServer1 target as

<target name="deployOnServer1" depends="undeployOnServer1">

but Now on undeploy it says, no application named 'myapp' to undeploy and on deploy it says, unable to deploy as there is other application with same context path '/myapp'.

How to solve this problem?

A: 

I think this property is missing: targets="${wls1.targets}"

rodrigoap
+1  A: 

According to the sample build.xml files for wldeploy from the wldeploiy Ant Task Reference, the targets attribute needs to be specified (unless the application is deployed on the Administration Server instance):

  <target name="undeploy">
    <wldeploy
      action="undeploy" verbose="true" debug="true"
      name="DeployExample"
      user="weblogic" password="weblogic"
      adminurl="t3://localhost:7001" targets="myserver"
      failonerror="false" />
  </target>

This is the description of the targets attribute:

The list of target servers to which the application is deployed.
The value of this attribute is a comma-separated list of the target servers, clusters, or virtual hosts.
If you do not specify a target list when deploying an application, the target defaults to the Administration Server instance.

Pascal Thivent