Deploy

Deploy Multiple Applications Remotely Using ANT

Ravish Mody

Today, one of our subscriber Kiran using comment asked us that how can he deploy more then one application remotely that to using ANT script. Thus we create this script which would do the same job very easily.

The logic behind this script is the that, we have used upload and depends. To cut the story sort the value of default which is on the line-1 is given as deploy3 and the target name for deploy2 has dependency on the deployment of application-1 same way the target name for deploy3 has dependency on the deployment of application-2. Thus till the application-1 is not deployed other applications would not deploy, this way all the application are been deployed one by one.

Steps To Create An ANT Script to Deploy Multiple Applications Remotely:

Step1) Create a “build.xml” file with the following details in it (i.e just copy the below snip-code).

<project name="webservices-hello_world" default="deploy3">
<property name="wls.username" value="weblogic" />
<property name="wls.password" value="weblogic" />
<property name="wls.hostname" value="10.10.10.10" />
<property name="wls.port" value="7001" />
<property name="admin.server.name" value="AdminServer" />

<!-- Deploying Target -->
<property name="deploy.target" value="AdminServer" />

<!-- Details for Application-1 -->
<property name="deploy.name.1" value="TestApp1" />
<property name="deploy.source.1" value="TestApp1.war" />

<!-- Details for Application-2 -->
<property name="deploy.name.2" value="TestApp2" />
<property name="deploy.source.2" value="TestApp2.war" />

<!-- Details for Application-3 -->
<property name="deploy.name.3" value="TestApp3" />
<property name="deploy.source.3" value="TestApp3.war" />

<!-- Setting TaskDefinition -->
<taskdef name="wldeploy" classname="weblogic.ant.taskdefs.management.WLDeploy">
<classpath>
<pathelement location="C:/bea103/wlserver_10.3/server/lib/weblogic.jar"/>
</classpath>
</taskdef>

<!-- Deploying Applications  -->
<target name="deploy1">
<wldeploy action="deploy"
	  upload="true"
          name="${deploy.name.1}"
          source="${deploy.source.1}"
          user="${wls.username}"
          password="${wls.password}"
          verbose="true"
          adminurl="t3://${wls.hostname}:${wls.port}" targets="${deploy.target}" />
</target>

<!-- Deploying Applications-2 DEPENDS on Deployment of Applications-1 -->

<target name="deploy2" depends="deploy1">
<wldeploy action="deploy"
	  upload="true"
          name="${deploy.name.2}"
          source="${deploy.source.2}"
          user="${wls.username}"
          password="${wls.password}"
          verbose="true"
          adminurl="t3://${wls.hostname}:${wls.port}" targets="${deploy.target}" />
</target>

<!-- Deploying Applications-3 DEPENDS on Deployment of Applications-2 -->

<target name="deploy3" depends="deploy2">
<wldeploy action="deploy"
	  upload="true"
          name="${deploy.name.3}"
          source="${deploy.source.3}"
          user="${wls.username}"
          password="${wls.password}"
          verbose="true"
          adminurl="t3://${wls.hostname}:${wls.port}" targets="${deploy.target}" />
</target>
</project>

Step2) Open a prompt and then run (setWLSenv.cmd/sh  or setDomainEnv.sh/cmd)

Step3) To deploy the applications move to the current directory where ever you have placed both “build.xml” and all the application “TestApp1.war” ,“TestApp2.war” and “TestApp3.war” and then run the following command.

ant

Step4) The output would be like follows

ant
Buildfile: build.xml

deploy1:
 [wldeploy] weblogic.Deployer -verbose -upload -noexit -name TestApp1 -source /home/rmody/JBoss_Data/Samples/WLS/TestApp1.war -targets AdminServer -adminurl t3://10.10.10.10:7001 -user weblogic -password ******** -deploy
 [wldeploy] weblogic.Deployer invoked with options:  -verbose -upload -noexit -name TestApp1 -source /home/rmody/JBoss_Data/Samples/WLS/TestApp1.war -targets AdminServer -adminurl t3://10.10.10.10:7001 -user weblogic -deploy
 [wldeploy] <Feb 11, 2011 6:12:53 PM IST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, TestApp1 [archive: /home/rmody/JBoss_Data/Samples/WLS/TestApp1.war], to AdminServer .>
 [wldeploy] Task 0 initiated: [Deployer:149026]deploy application TestApp1 on AdminServer.
 [wldeploy] Task 0 completed: [Deployer:149026]deploy application TestApp1 on AdminServer.
 [wldeploy] Target state: deploy completed on Server AdminServer

 [wldeploy] Target Assignments:
 [wldeploy] + TestApp1  AdminServer

deploy2:
 [wldeploy] weblogic.Deployer -verbose -upload -noexit -name TestApp2 -source /home/rmody/JBoss_Data/Samples/WLS/TestApp2.war -targets AdminServer -adminurl t3://10.10.10.10:7001 -user weblogic -password ******** -deploy
 [wldeploy] weblogic.Deployer invoked with options:  -verbose -upload -noexit -name TestApp2 -source /home/rmody/JBoss_Data/Samples/WLS/TestApp2.war -targets AdminServer -adminurl t3://10.10.10.10:7001 -user weblogic -deploy
 [wldeploy] <Feb 11, 2011 6:12:54 PM IST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, TestApp2 [archive: /home/rmody/JBoss_Data/Samples/WLS/TestApp2.war], to AdminServer .>
 [wldeploy] Task 1 initiated: [Deployer:149026]deploy application TestApp2 on AdminServer.
 [wldeploy] Task 1 completed: [Deployer:149026]deploy application TestApp2 on AdminServer.
 [wldeploy] Target state: deploy completed on Server AdminServer

 [wldeploy] Target Assignments:
 [wldeploy] + TestApp2  AdminServer

deploy3:
 [wldeploy] weblogic.Deployer -verbose -upload -noexit -name TestApp3 -source /home/rmody/JBoss_Data/Samples/WLS/TestApp3.war -targets AdminServer -adminurl t3://10.10.10.10:7001 -user weblogic -password ******** -deploy
 [wldeploy] weblogic.Deployer invoked with options:  -verbose -upload -noexit -name TestApp3 -source /home/rmody/JBoss_Data/Samples/WLS/TestApp3.war -targets AdminServer -adminurl t3://10.10.10.10:7001 -user weblogic -deploy
 [wldeploy] <Feb 11, 2011 6:12:56 PM IST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, TestApp3 [archive: /home/rmody/JBoss_Data/Samples/WLS/TestApp3.war], to AdminServer .>
 [wldeploy] Task 2 initiated: [Deployer:149026]deploy application TestApp3 on AdminServer.
 [wldeploy] Task 2 completed: [Deployer:149026]deploy application TestApp3 on AdminServer.
 [wldeploy] Target state: deploy completed on Server AdminServer

 [wldeploy] Target Assignments:
 [wldeploy] + TestApp3  AdminServer

BUILD SUCCESSFUL
Total time: 5 seconds

That it, now if you check in your remote box under the server on which you have deployed the applications it would have the following directory structure and then check you console under deployments you would notice that all the applications are been deployed.

Path:

Application-1

<BEA_HOME>user_projects/domains/<YOUR_DOMAIN>/servers/AdminServer/upload/TestApp1/app/TestApp1.war

Application-2

<BEA_HOME>user_projects/domains/<YOUR_DOMAIN>/servers/AdminServer/upload/TestApp2/app/TestApp2.war

Application-3

<BEA_HOME>user_projects/domains/<YOUR_DOMAIN>/servers/AdminServer/upload/TestApp3/app/TestApp3.war

========================================

Issues:

Suppose if you get following kind of error while deploying from a remote machine:
Caused by: javax.naming.NamingException: Couldn’t connect to any host [Root exception is org.omg.CORBA.OBJECT_NOT_EXIST: Unknown object in LOCATE_REQUEST vmcid: 0x0 minor code: 0

[wldeploy] Caused by: weblogic.deploy.api.spi.exceptions.ServerConnectionException: [J2EE Deployment SPI:260010]Unable to connect to ‘t3://he3unxd189v01:9100′ as user, ‘weblogic’. Error received: Couldn’t connect to any host
[wldeploy] at weblogic.deploy.api.spi.deploy.internal.ServerConnectionImpl.getMBeanServer(ServerConnectionImpl.java:251)
[wldeploy] at weblogic.deploy.api.spi.deploy.internal.ServerConnectionImpl.getMBeanServerForType(ServerConnectionImpl.java:191)
[wldeploy] at weblogic.deploy.api.spi.deploy.internal.ServerConnectionImpl.init(ServerConnectionImpl.java:147)
[wldeploy] at weblogic.deploy.api.spi.deploy.WebLogicDeploymentManagerImpl.getNewConnection(WebLogicDeploymentManagerImpl.java:148)
[wldeploy] at weblogic.deploy.api.spi.deploy.WebLogicDeploymentManagerImpl.<init>(WebLogicDeploymentManagerImpl.java:118)
[wldeploy] … 32 more
[wldeploy] Caused by: java.io.IOException: Couldn’t connect to any host
[wldeploy] at weblogic.management.remote.common.ClientProviderBase.makeConnection(ClientProviderBase.java:156)
[wldeploy] at weblogic.management.remote.common.ClientProviderBase.newJMXConnector(ClientProviderBase.java:79)
[wldeploy] at javax.management.remote.JMXConnectorFactory.newJMXConnector(JMXConnectorFactory.java:338)
[wldeploy] at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:247)
[wldeploy] at weblogic.deploy.api.spi.deploy.internal.ServerConnectionImpl.getMBeanServer(ServerConnectionImpl.java:240)
[wldeploy] … 36 more
[wldeploy] Caused by: javax.naming.NamingException: Couldn’t connect to any host [Root exception is org.omg.CORBA.OBJECT_NOT_EXIST: Unknown object in LOCATE_REQUEST vmcid: 0x0 minor code: 0 completed: No]
[wldeploy] Caused by: javax.naming.NamingException: Couldn’t connect to any host [Root exception is org.omg.CORBA.OBJECT_NOT_EXIST: Unknown object in LOCATE_REQUEST vmcid: 0x0 minor code: 0 completed: No]
[wldeploy] at weblogic.corba.j2ee.naming.Utils.wrapNamingException(Utils.java:83)
[wldeploy] at weblogic.corba.j2ee.naming.ORBHelper.getORBReferenceWithRetry(ORBHelper.java:590)
[wldeploy] at weblogic.corba.j2ee.naming.ORBHelper.getORBReference(ORBHelper.java:547)
[wldeploy] at weblogic.corba.j2ee.naming.InitialContextFactoryImpl.getInitialContext(InitialContextFactoryImpl.java:85)
[wldeploy] at weblogic.corba.j2ee.naming.InitialContextFactoryImpl.getInitialContext(InitialContextFactoryImpl.java:31)
[wldeploy] at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:41)
[wldeploy] at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
[wldeploy] at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
[wldeploy] at javax.naming.InitialContext.init(InitialContext.java:223)
[wldeploy] at javax.naming.InitialContext.<init>(InitialContext.java:197)
[wldeploy] at weblogic.management.remote.common.ClientProviderBase.makeConnection(ClientProviderBase.java:143)
[wldeploy] … 40 more
[wldeploy] Caused by: org.omg.CORBA.OBJECT_NOT_EXIST: Unknown object in LOCATE_REQUEST vmcid: 0×0 minor code: 0 completed: No
[wldeploy] at weblogic.iiop.LocateReplyMessage.needsForwarding(LocateReplyMessage.java:171)
[wldeploy] at weblogic.iiop.IORManager.locateInitialReference(IORManager.java:254)
[wldeploy] at weblogic.corba.orb.ORB.resolve_initial_references(ORB.java:258)
[wldeploy] at weblogic.corba.client.naming.ClientORBInfo.<init>(ClientORBInfo.java:34)
[wldeploy] at weblogic.corba.client.naming.ClientORBHelper.createORBInfo(ClientORBHelper.java:42)
[wldeploy] at weblogic.corba.j2ee.naming.ORBHelper.cacheORB(ORBHelper.java:314)
[wldeploy] at weblogic.corba.j2ee.naming.ORBHelper.cacheORBAndCreateURL(ORBHelper.java:323)
[wldeploy] at weblogic.corba.j2ee.naming.ORBHelper.getORBReferenceWithRetry(ORBHelper.java:583)

Then please make sure to add "wlfullclient.jar" at the beginning of the CLASSPATH in your ANT Script...Also please refer to http://forums.oracle.com/forums/thread.jspa?threadID=2188580&tstart=0

And to khow to make wlfullclient.jar in weblogic please refer to: http://middlewaremagic.com/weblogic/?p=558


Changing DeploymentOrder Of DataSources

Hi,

Jay SenSharma

Jay SenSharma

Many times we want to Change the Deployment Order of different dataSources according to our Requirement…sothat WebLogic Server will activate the DataSources and ConnectionPools according to the deployment Order which we have set.

In the following Demonstration we are going to achieve it using WLST script … Suppose if your DataSource Name is “TestDS” Then u can use the following WLST Script…

Step1). Open Text Editor and then Write the following WLST Script inside it:

ChangeDeploymentOrder.py

connect('weblogic','weblogic','t3://localhost:7001')
edit()
startEdit()
cd ('JDBCSystemResources')
cd ('TestDS')
ls()
print 'see the Value of DEPLOYMENT ORDER ...we are going to change it...to 50'
cmo.setDeploymentOrder(40)
ls()
print 'Can u see that it is changed...?'
save()
activate()
————————-ChangeDeploymentOrder.py—————————

Step2). Now open a Command prompt then run “. ./setWLSEnv.sh”

Step3). Run the WLST Script like following:

java weblogic.WLST     /app/wlstScripts/ChangeDeploymentOrder.py

.

.

Thanks

Jay SenSharma


Deploying Applications Using Java (JMX)

Hi,

Jay SenSharma

Jay SenSharma

Here is a Simple JMX code to deploy our applications on WebLogic Server. This JMX Code uses some very important WLS Deployment API like:

WebLogicDeploymentManager, SesionHelper, DeploymentOptions,  TargetModuleID, ProgressObject etc…

When u will try the following program to deploy your applications then please  replace “ModuleType.WAR” to ModuleType.EAR -> If u want to deploy EAR Application And Similarly  replace “ModuleType.WAR” to ModuleType.JAR -> If u want to deploy JAR (EJB)Application

import java.io.*;
import weblogic.deploy.api.tools.*;  //SesionHelper
import weblogic.deploy.api.spi .*;  //WebLogicDeploymentManager
import weblogic.deploy.api.spi.DeploymentOptions;
import javax.enterprise.deploy.spi.TargetModuleID;
import javax.enterprise.deploy.spi.status.ProgressObject;
import javax.enterprise.deploy.spi.status.DeploymentStatus;
import javax.enterprise.deploy.shared.ModuleType;
import javax.enterprise.deploy.spi.Target;

import javax.enterprise.deploy.shared.*;

public class ApplicationDeployment
{
     public static void main(String ar[]) throws Exception
		{
			ApplicationDeployment appDeploy=new ApplicationDeployment();
			String protocol="t3";
			String hostName="localhost";
			String portString="7001";
			String adminUser="weblogic";
			String adminPassword="weblogic";

			WebLogicDeploymentManager deployManager=SessionHelper.getRemoteDeploymentManager( protocol,hostName,portString,adminUser,adminPassword);
			System.out.println("\n\t WebLogicDeploymentManager: "+deployManager);
			DeploymentOptions options = new DeploymentOptions();
			System.out.println("\n\t DeploymentOptions: "+options);

			Target targets[]=deployManager.getTargets();
			System.out.println("------------------------------------------------------------");
			System.out.println("\t Application Can be Deployed in the Following targets:");
			int i=0;
			for (i=0;i<targets.length;i++)
					{
					   System.out.println("\n\t "+targets[i]);
				    }
			System.out.println("-----------Above We need to write our Logic to Choose the Deploy target---------\n\n");
			Target deployTargets[]=new Target[1];
			//SUPPOSE WE WAANT TO DEPLOY IT ON AdminServer ...
			deployTargets[0]=targets[0];

            //-------------DEPLOYING FIRST APPLICATION-------------//
			String applicationDisplayName="FirstEARApplication";
			options.setName(applicationDisplayName);
			ProgressObject processStatus=deployManager.distribute(deployTargets, new File("FirstEAR.ear"), null,options);
			processStatus=deployManager.deploy(deployTargets, new File("FirstEAR.ear"), null,options);
			DeploymentStatus deploymentStatus=processStatus.getDeploymentStatus() ;
			System.out.println("\n\n\t For FirstEAR.ear DeploymentStayus.getState(): "+deploymentStatus.getState() +"\n\n");

			System.out.println("Sleeping for atleast 5-Seconds. Sothat the Deployment Activation gets Completed Successfully.");
			Thread.sleep(5000);

            //-------------DEPLOYING SECOND APPLICATION-------------//
			deployManager=null;
			deployManager=SessionHelper.getRemoteDeploymentManager( protocol,hostName,portString,adminUser,adminPassword);
			applicationDisplayName="SecondEARApplication";
			options.setName(applicationDisplayName);
			processStatus=deployManager.distribute(deployTargets, new File("SecondEAR.ear"), null,options);
			Thread.sleep(5000);
			processStatus=deployManager.deploy(deployTargets, new File("SecondEAR.ear"), null,options);
			deploymentStatus=processStatus.getDeploymentStatus() ;
			System.out.println("\n\n\t For SecondEAR.ear DeploymentStayus.getState(): "+deploymentStatus.getState() +"\n\n");

		}
}

(Based on the comment http://middlewaremagic.com/weblogic/?p=483#comment-4189 we have updated the JMX Deployment Code)

In the above Updated JMX Code You will get following kind of Output:

C:\JMX_Notification>javac ApplicationDeployment.java
Note: ApplicationDeployment.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

C:\JMX_Notification>java ApplicationDeployment

         WebLogicDeploymentManager: weblogic.deploy.api.spi.deploy.WebLogicDeploymentManagerImpl@1dd7ed

         DeploymentOptions: {isRetireGracefully=true,isGracefulProductionToAdmin=false,isGracefulIgnoreSessions=false,rmiGracePeriod=-1,reti
reTimeoutSecs=-1,undeployAllVersions=false,archiveVersion=null,planVersion=null,isLibrary=false,libSpecVersion=null,libImplVersion=null,stag
eMode=null,clusterTimeout=3600000,altDD=null,altWlsDD=null,name=null,securityModel=null,securityValidationEnabled=false,versionIdentifier=nu
ll,isTestMode=false,forceUndeployTimeout=0,defaultSubmoduleTargets=true,timeout=0deploymentPrincipalName=null}
------------------------------------------------------------
         Application Can be Deployed in the Following targets:

         AdminServer/server

         MyJMSServer/JMS server
-----------Above We need to write our Logic to Choose the Deploy target---------

<Jun 4, 2011 6:37:17 PM IST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating distribute operation for application, FirstEARApplication
 [archive: C:\JMX_Notification\FirstEAR.ear], to AdminServer .>
<Jun 4, 2011 6:37:41 PM IST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, FirstEARApplication [ar
chive: C:\JMX_Notification\FirstEAR.ear], to AdminServer .>

         For FirstEAR.ear DeploymentStayus.getState(): running

Sleeping for atleast 5-Seconds. Sothat the Deployment Activation gets Completed Successfully.
<Jun 4, 2011 6:38:14 PM IST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating distribute operation for application, SecondEARApplicatio
n [archive: C:\JMX_Notification\SecondEAR.ear], to AdminServer .>
<Jun 4, 2011 6:38:19 PM IST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, SecondEARApplication [a
rchive: C:\JMX_Notification\SecondEAR.ear], to AdminServer .>

         For SecondEAR.ear DeploymentStayus.getState(): running

<Jun 4, 2011 6:38:21 PM IST> <Warning> <JNDI> <BEA-050001> <WLContext.close() was called in a different thread than the one in which it was
created.>
<Jun 4, 2011 6:38:21 PM IST> <Warning> <JNDI> <BEA-050001> <WLContext.close() was called in a different thread than the one in which it was
created.>

.
.
Thanks

Jay SenSharma


Undeploying Application Using Java Method (JMX)

Hi,

Jay SenSharma

Jay SenSharma

Here is a Simple JMX code to deploy our applications on WebLogic Server. This JMX Code uses some very important WLS Deployment API like: WebLogicDeploymentManager, SesionHelper, DeploymentOptions,  TargetModuleID, ProgressObject etc…

Note: To deploy Applications using JMX u can refer to: http://middlewaremagic.com/weblogic/?p=483

Here is a Simple Code which demeontrate ..How we can Undeploy an Application Deployed on WebLogic Server using Java Methods…We Need to Use JMX Api to do this using Java…

ApplicationUndeployment.java

import java.io.*;
import weblogic.deploy.api.tools.*;  //SesionHelper
import weblogic.deploy.api.spi .*;  //WebLogicDeploymentManager
import weblogic.deploy.api.spi.DeploymentOptions;
import javax.enterprise.deploy.spi.TargetModuleID;
import javax.enterprise.deploy.spi.status.ProgressObject;
import javax.enterprise.deploy.spi.status.DeploymentStatus;
import javax.enterprise.deploy.shared.ModuleType;
import javax.enterprise.deploy.spi.Target;

public class ApplicationUndeployment
{
public static void main(String ar[]) throws Exception
{
ApplicationUndeployment appDeploy=new ApplicationUndeployment();
String protocol="t3";
String hostName="localhost";
String portString="7001";
String adminUser="weblogic";
String adminPassword="weblogic";

WebLogicDeploymentManager deployManager=SessionHelper.getRemoteDeploymentManager( protocol,hostName,portString,adminUser,adminPassword);
System.out.println("\n\t WebLogicDeploymentManager: "+deployManager);
DeploymentOptions options = new DeploymentOptions();
System.out.println("\n\t DeploymentOptions: "+options);

TargetModuleID[] targetModuleIDs=deployManager.getAvailableModules(ModuleType.EAR, deployManager.getTargets());
System.out.println("targetModuleIDs length: "+targetModuleIDs.length);
for(int i=0;i<targetModuleIDs.length;i++)
{
System.out.println("\n\n\tUNDEPLOYING------- targetModuleIDs["+i+"]: "+targetModuleIDs[i]);
ProgressObject processStatus=deployManager.undeploy(new TargetModuleID[]{targetModuleIDs[i]});
DeploymentStatus deploymentStatus=processStatus.getDeploymentStatus() ;
System.out.println("UnDeploymentStayus.getMessage(): "+deploymentStatus.getMessage() );
}
}

OUTPUT:
C:\DELETE\JMX_Deploy>java ApplicationUndeployment

WebLogicDeploymentManager: weblogic.deploy.api.spi.deploy.WebLogicDeploymentManagerImpl@35e6e3

DeploymentOptions: {isRetireGracefully=true,isGracefulProductionToAdmin=false,isGracefulIgnoreSessions=false,rmiGracePeriod=-1,retireTimeoutSecs=-1,undeployAllVersions=false,archiveVersion=null,planVersion=null,isLibrary=false,libSpecVersion=null,libImplVersion=null,stageMode=null,clusterTimeout=3600000,altDD=null,altWlsDD=null,name=null,securityModel=null,securityValidationEnabled=false,versionIdentifier=null,isTestMode=false,forceUndeployTimeout=0,defaultSubmoduleTargets=true,timeout=0deploymentPrincipalName=null}         targetModuleIDs length: 2
UNDEPLOYINF------- targetModuleIDs[0]: {Target=AdminServer, WebLogicTargetType=server, Name=SecondWebAppEar}
<Jan 15, 2010 12:25:25 PM IST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating undeploy operation for application,
SecondWebAppEar [archive: null], to AdminServer .>
UnDeploymentStayus.getMessage(): null

UNDEPLOYING------- targetModuleIDs[1]: {Target=AdminServer, WebLogicTargetType=server, Name=wls-commonslogging-b
ridge#1.0@1.1}
<Jan 15, 2010 12:25:26 PM IST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating undeploy operation for application,
wls-commonslogging-bridge#1.0@1.1 [archive: null], to AdminServer .>
UnDeploymentStayus.getMessage(): weblogic.management.ManagementException: [Deployer:149164]The domain edit lock is owned
by another session in exclusive mode - hence this deployment operation cannot proceed.
<Jan 15, 2010 12:25:27 PM IST>

<Warning> <JNDI> <BEA-050001> <WLContext.close() was called in a different thread than th
e one in which it was created.>

.
.
Thanks
Jay SenSharma


Ant to Deploy Applications

Hi,

Jay SenSharma

Jay SenSharma

Form WLS 9.x onwards in Admin Console we have a Feature called as “Lock & Edit”. It has many advantages but Some Adminstrators always complaint that because of this feature they need to keep on click on this button before deploying Any Application on WLS Server ..then there are several pages in the process of Deployment through Admin Console…for testing when we want to keep on deploying Applications /redeploy and undeploy them. Like in Dev Environments..This Simple ANT script will save our lots of time.

I have a very simple ANT Script which i use most of the time for quick deployment/redeployment/undeployment.

Just have a look … it is  good.

Step1). WhereEver you have placed your Jar/WAR/EAR file to be deployed on the Server Just Paste this “build.xml” file. Just change the Property values according to your requirement in the below file…
“build.xml”

<project name="webservices-hello_world" default="deploy">
<property name="wls.username" value="weblogic" />
<property name="wls.password" value="weblogic" />
<property name="wls.hostname" value="localhost" />
<property name="wls.port" value="7001" />
<property name="admin.server.name" value="AdminServer" />
<property name="deploy.target" value="ClusterNameABC" />
<!-- Here you can specify Either ClusterName, IndividualServerName Like "ManagedOne" or comma Seperated List of Managed/AdminServer -->
<property name="deploy.name" value="TestApp" />
<property name="deploy.source" value="TestApp.ear" />

<!-- Setting TaskDefinition -->
<taskdef name="wldeploy" classname="weblogic.ant.taskdefs.management.WLDeploy">
<classpath>
<pathelement location="C:/bea103/wlserver_10.3/server/lib/weblogic.jar"/>
</classpath>
</taskdef>

<!-- Deploying Applications  -->
<target name="deploy">
<wldeploy action="deploy"
          name="${deploy.name}"
          source="${deploy.source}"
          user="${wls.username}"
          nostage="true"
          password="${wls.password}"
          verbose="true"
          adminurl="t3://${wls.hostname}:${wls.port}" targets="${deploy.target}" />
</target>

<!-- Redeploying Applications  -->
<target name="redeploy">
<wldeploy action="redeploy"
          name="${deploy.name}"
          user="${wls.username}"
          password="${wls.password}"
          verbose="true"
          adminurl="t3://${wls.hostname}:${wls.port}" targets="${deploy.target}" />
</target>

<!-- Uneploying Applications  -->
<target name="undeploy">
<wldeploy action="undeploy"
          name="${deploy.name}"
          failonerror="false"
          user="${wls.username}"
          password="${wls.password}"
          verbose="true"
          adminurl="t3://${wls.hostname}:${wls.port}" targets="${deploy.target}" />
</target>
</project>

Step2). Whenever you want to deploy the Application Just Change the Properties according to your requirement.

Step3). Open a command Window and then run (setWLSenv.cmd or setWLSEnv.sh or setDomainEnv.sh or setDomainEnv.cmd)

Step4). To Deploy the Application move to the current directory where ever you have placed “build.xml” and “TestApp.ear” (Your Application) and then run

ant deploy

Step5). To Redeploy the Application

ant redeploy

Step6). To Undeploy the Application

ant undeploy

.

.

Thanks
Jay SenSharma


  • Testimonials

  • RSS Middleware Magic – JBoss

  • Receive FREE Updates


    FREE Email updates of our new posts Enter your email address:



  • Magic Archives

  • Sitemeter Status

  • ClusterMap 7-Nov-2011 till Date

  • ClusterMap 6-Nov-2010 till 7-Nov-2011

  • Copyright © 2010-2012 Middleware Magic. All rights reserved. | Disclaimer