WEBLOGIC COMMAND LINE DEPLOY

5 Haziran 2013 Çarşamba

Weblogic 10_3_2 command line deployment

Adding a New Module to a Deployed Enterprise Application

WebLogic Server’s module-level targeting support enables you to add and deploy a new Enterprise Application module without having to redeploy other modules that are already deployed.

For example, if you were to add a module,newmodule.war, to a deployed Enterprise Application named myEnterpriseApp(update application.xml file as necessary), you could then deploy newmodule.war using the weblogic.Deployer command:

(*)if weblogic.jar is not in your CLASSPATH then use it under wlserver_versionXXX/server/lib/weblogic.jar.

To target Web application modules that are part of an .ear file, you can use the Web application’s context-root name as the module name or specify the web-uri.

For example, if the application.xml file for a file, myEnterpriseApp.ear, defines:

<module>

<web>

<web-uri>newmodule.war</web-uri>

<context-root>/welcome</context-root>

</web>

</module>

java -cp ../server/lib/weblogic.jar weblogic.Deployer -username weblogic -password weblogic1 -name myEnterpriseApp -deploy -targets /welcome@myserver -source /myEnterpriseApp

(*)Above command-line reference and explanation is taken from weblogic ‘ s own site. So you need to optimize the command to your needs.

This command deploys the new module without redeploying the other modules in the application. Note that you must specify the correct file extension (.war in the above example) for archived modules in an EAR file.

For our real life enterprise application:

We’ve exploded our .ear file  to com.vod.onl.onear. Go into the exploded archive directory for onear.Update your application.xml (META_INF>application.xml) to include the new module definition:

/home/eteration/dev/domains/vodafoneTestDomainMySql/onlineapps/com.vod.onl.oneear

While you are inside of this directory execute below command:

java -cp /home/eteration/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar weblogic.Deployer –username weblogic –password password –urlt3://212.65.145.218:7001 –name  com.vod.onl.oneear  –deploytargets/com.xxxxxx.online.remainingBalance.web@myClustersource .

Here is:

username, weblogic ‘ s username

password, assigned password for weblogic user

-url, we should point it to our Admin Server ‘ s address

-name, specifies our enterprise application’s deployment name which is com.vod.onl.oneear

-deploy , implies  a deployment

targets, as you can specify a single managed server instance if you have an clustered environment for your managed servers you can directly put your cluster ‘ s name after ‘@’.we use the context-root name for our new module(!!!!don’t forget the place context info in application.xml for the new module). /com.xxxxx.online.remainingBalance.web

source , you need to provide a source path for the new module. If your exploded archive directory(extracted from .ear) does not contain your new .war get it from elsewhere such as nexus storage and place it under com.vod.onl.onear directory. Source indication is really important. As you realize from below command place ‘.’ (dot) after –source flag. Because we execute the command inside com.vod.onl.onear, so the dot after source flag indicates that we are on the current directory.

This was for application ‘ s web module, you can do the same for the service module.

As we assume you ‘ re still inside of  the com.vod.onl.oneear directory:

java -cp /home/eteration/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar weblogic.Deployer –username weblogic –password password –urlt3://212.65.145.218:7001 –name  com.vod.onl.oneear  –deploytargets/com.vodafone.online.remainingBalance.service@myClustersource .

Deploy Enterprise Application as an Exploded Archive Directory

Instead of using the weblogic admin console to install an application you can use command-line

reference. Using it there will be no need some extra steps. For example, after installing an application on the console,your newly installed application would get an “prepared” status which means that you need to start  it  to serve all waiting requests. It really takes a while.

Execute the below command while you are inside of the exploded archive directory which is:

/home/eteration/dev/domains/vodafoneTestDomainMySql/onlineapps/com.vod.onl.oneear/ $

java –cp /home/eteration/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar weblogic.Deployer –username weblogic –password password –urlt3://212.65.145.218:7001 –name com.vod.onl.oneear –deploytargets myCluster –source .

After a successful execution, you will see on the weblogic admin console that your newly deployed application got the “active” status directly without no need some extra work.

Undeploying a Module from a Deployed Enterprise Application

java –cp /home/eteration/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar weblogic.Deployer –username weblogic –password passowrd –urlt3://212.65.145.218:7001 –name com.vod.onl.oneear –undeploytargets/com.vodafone.online.remainingBalance.web@myCluster

This will undeploy thecom.vodafone.online.remainingBalance.webmodule on myCluster from our deployed com.vod.onl.onear  application.

Undeploying a Deployed Enterprise Application

java –cp /home/eteration/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar weblogic.Deployer –username weblogic –password password –urlt3://212.65.145.218:7001 –name com.vod.onl.oneear –undeploytargets myCluster

Above command will undeploy our com.vod.onl.onear application from domain.

Below is sample successful undeployment command execution message:

weblogic.Deployer invoked with options:  -username weblogic -url t3://212.65.145.218:7001 -name com.vod.onl.oneear -undeploy -targets myCluster

<Feb 24, 2012 3:22:13 PM EET> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating undeploy operation for application, com.vod.onl.oneear [archive: null], to myCluster .>

Task 60 initiated: [Deployer:149026]remove application com.vod.onl.oneear on myCluster.

Task 60 deferred: [Deployer:149026]remove application com.vod.onl.oneear on myCluster.

Target state: undeploy deferred on Cluster myCluster

java.rmi.RemoteException: [Deployer:149145]Unable to contact ‘managedServer2’. Deployment is deferred until ‘managedServer2’ becomes available.

If you need to update  a module unit in a deployed enterprise application with a new module version,

–         first you should undeploy the old module, –undeploy

–          place the new module context info in application.xml file

–         then deploy your new module, –deploy

To start an Application from command-line:

java –cp /home/eteration/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar weblogic.Deployer –username weblogic –password password –urlt3://212.65.145.218:7001 –name com.vod.onl.oneear –start

NOTES:

After executing your commands, you should check the line info messages what it says about the execution status of the typed command. Sometimes it needs some additional work like restarting your managed server or admin server instance. Even if you are totally sure about what you typed,

restarting really works like a magic.

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!