WLST script to deploy applications in Weblogic

Oracle Weblogic Server

We had a requirement where you need to have status check,stop,start,deploy and undeploy of an application automatically using scripting. So we checked other blogs for any sample scripts but got to know that all are not the same way we wanted. so we finally created our own python script which does all this in a single shot using wlst tool.

This wlst script to deploy applications can also further modified to accommodate more functions. For now it does following in a automated way.

1. Check the availability of an application.
2. Stops the EAR/WAR if it already exists in Weblogic Server
3. Undeploys/Delete the project (EAR file)
4. Deploys the new ear/war into  the Weblogic Server
5. Start the services of the project (EAR)

 

How to use it:

Step 1: Run the set domain env script to set the wlst env. (setDomainEnv.sh)

cd to $DOMAIN_HOME/bin

./setDomainEnv.sh

Step 2: Run below command with the right values inline.

java -cp .:$CLASSPATH:/opt/Middleware/wlserver_10.3/server/lib/weblogic.jar weblogic.WLST manageApplication.py -u username -p password -a adminUrl [<hostname>:<port>] -n deploymentName -f deploymentFile -t deploymentTarget

Example:

java -cp .:$CLASSPATH:/opt/Middleware/wlserver_10.3/server/lib/weblogic.jar weblogic.WLST manageApplication.py -u weblogic -p weblogic123 -a admin.techpaste.com:7001 -n mytestapplication -f "/nfs/usr/mytestapplication.war" -t TP_Managed_Server

Python Script(manageApplication.py):

[COPY IT EXACTLY TO KEEP THE SYNTAX CORRECT]
import sys
import os
import re
from java.lang import System
#Python Script to manage applications in weblogic server.
#This script takes input from command line and executes it.
#It can be used to check status,stop,start,deploy,undeploy of applications in weblogic server using weblogic wlst tool.
#Company: TechPaste Solutions
import getopt
#========================
#Usage Section
#========================
def usage():

	print "Usage:"
	print "java weblogic.WLST manageApplication.py -u username -p password -a adminUrl [:] -n deploymentName -f deploymentFile -t deploymentTarget\n"
	sys.exit(2)
#========================
#Connect To Domain
#========================

def connectToDomain():

	try:
		connect(username, password, adminUrl)
		print 'Successfully connected to the domain\n'

	except:
		print 'The domain is unreacheable. Please try again\n'
		exit()
#========================
#Checking Application Status Section
#========================

def appstatus(deploymentName, deploymentTarget):

	try:
		domainRuntime()
		cd('domainRuntime:/AppRuntimeStateRuntime/AppRuntimeStateRuntime')
		currentState = cmo.getCurrentState(deploymentName, deploymentTarget)
		return currentState
	except:
		print 'Error in getting current status of ' +deploymentName+ '\n'
		exit()
#========================
#Application undeployment Section
#========================

def undeployApplication():

	try:
		print 'stopping and undeploying ..' +deploymentName+ '\n'
		stopApplication(deploymentName, targets=deploymentTarget)
		undeploy(deploymentName, targets=deploymentTarget)
	except:
		print 'Error during the stop and undeployment of ' +deploymentName+ '\n'
#========================
#Applications deployment Section
#========================

def deployApplication():

	try:
		print 'Deploying the application ' +deploymentName+ '\n'
		deploy(deploymentName,deploymentFile,targets=deploymentTarget)
		startApplication(deploymentName)
	except:
		print 'Error during the deployment of ' +deploymentName+ '\n'
		exit()
#========================
#Input Values Validation Section
#========================

if __name__=='__main__' or __name__== 'main':

	try:
		opts, args = getopt.getopt(sys.argv[1:], "u:p:a:n:f:t:", ["username=", "password=", "adminUrl=", "deploymentName=", "deploymentFile=", "deploymentTarget="])

	except getopt.GetoptError, err:
		print str(err)
		usage()

username = ''
password = ''
adminUrl = ''
deploymentName = ''
deploymentFile = ''
deploymentTarget = ''

for opt, arg in opts:
	if opt == "-u":
		username = arg
	elif opt == "-p":
		password = arg
	elif opt == "-a":
		adminUrl = arg
	elif opt == "-n":
		deploymentName = arg
	elif opt == "-f":
		deploymentFile = arg
	elif opt == "-t":
		deploymentTarget = arg

if username == "":
	print "Missing \"-u username\" parameter.\n"
	usage()
elif password == "":
	print "Missing \"-p password\" parameter.\n"
	usage()
elif adminUrl == "":
	print "Missing \"-a adminUrl\" parameter.\n"
	usage()
elif deploymentName == "":
	print "Missing \"-n deploymentName\" parameter.\n"
	usage()
elif deploymentFile == "":
	print "Missing \"-c deploymentFile\" parameter.\n"
	usage()
elif deploymentTarget == "":
	print "Missing \"-c deploymentTarget\" parameter.\n"
	usage()

#========================
#Main Control Block For Operations
#========================

def deployUndeployMain():

		appList = re.findall(deploymentName, ls('/AppDeployments'))
		if len(appList) >= 1:
    			print 'Application'+deploymentName+' Found on server '+deploymentTarget+', undeploying application..'
			print '=============================================================================='
			print 'Application Already Exists, Undeploying...'
			print '=============================================================================='
    			undeployApplication()
			print '=============================================================================='
    			print 'Redeploying Application '+deploymentName+' on'+deploymentTarget+' server...'
			print '=============================================================================='
			deployApplication()
	   	else:
			print '=============================================================================='
			print 'No application with same name...'
    			print 'Deploying Application '+deploymentName+' on'+deploymentTarget+' server...'
			print '=============================================================================='
			deployApplication()
#========================
#Execute Block
#========================
print '=============================================================================='
print 'Connecting to Admin Server...'
print '=============================================================================='
connectToDomain()
print '=============================================================================='
print 'Starting Deployment...'
print '=============================================================================='
deployUndeployMain()
print '=============================================================================='
print 'Execution completed...'
print '=============================================================================='
disconnect()
exit()

 

Sample Output of the Script deployment:

 

When Deploying a brand new application:

 

# java -cp .:$CLASSPATH:/opt/Middleware/wlserver_10.3/server/lib/weblogic.jar weblogic.WLST manageApplication.py -u weblogic -p weblogic123 -a admin.techpaste.com:7001 -n mytestapplication -f "/nfs/usr/mytestapplication.ear" -t TP_Managed_Server

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

==============================================================================
Connecting to Admin Server...
==============================================================================
Connecting to t3://admin.techpaste.com:7001 with userid weblogic ...
Successfully connected to Admin Server 'AdminServer' that belongs to domain 'TP_domain'.

Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.

Successfully connected to the domain

==============================================================================
Starting Deployment...
==============================================================================
dr--   OneplusEar

==============================================================================
No application with same name...
Deploying Application mytestapplication on TP_Managed_Server server...
==============================================================================
Deploying the application mytestapplication

Deploying application from /nfs/usr/mytestapplication.ear to targets TP_Managed_Server (upload=false) ...
    
[Deployer:149191]Operation 'deploy' on application 'mytestapplication' is initializing on 'TP_Managed_Server'
.Completed the deployment of Application with status completed
Current Status of your Deployment:
Deployment command type: deploy
Deployment State       : completed
Deployment Message     : [Deployer:149194]Operation 'deploy' on application 'mytestapplication' has succeeded on 'TP_Managed_Server'
Starting application mytestapplication.
    
[Deployer:149194]Operation 'start' on application 'mytestapplication' has succeeded on 'TP_Managed_Server'
.Completed the start of Application with status completed
Current Status of your Deployment:
Deployment command type: start
Deployment State       : completed
Deployment Message     : [Deployer:149194]Operation 'start' on application 'mytestapplication' has succeeded on 'TP_Managed_Server'

==============================================================================
Execution completed...
==============================================================================
Disconnected from weblogic server: AdminServer


Exiting WebLogic Scripting Tool.

    

 

When Deploying an already existing application:

 

# java -cp .:$CLASSPATH:/opt/Middleware/wlserver_10.3/server/lib/weblogic.jar weblogic.WLST ms.py -u weblogic -p weblogic123 -a admin.techpaste.com:7001 -n mytestapplication -f "/nfs/usr/mytestapplication.war" -t TP_Managed_Server

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

==============================================================================
Connecting to Admin Server...
==============================================================================
Connecting to t3://admin.techpaste.com:7001 with userid weblogic ...
Successfully connected to Admin Server 'AdminServer' that belongs to domain 'TP_domain'.

Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.

Successfully connected to the domain

==============================================================================
Starting Deployment...
==============================================================================
dr--   OneplusEar
dr--   mytestapplication

Applicationmytestapplication Found on server TP_Managed_Server, undeploying application..
==============================================================================
Application Already Exists, Undeploying...
==============================================================================
stopping and undeploying ..mytestapplication

Stopping application mytestapplication.
    
[Deployer:149192]Operation 'stop' on application 'mytestapplication' is in progress on 'TP_Managed_Server'
[Deployer:149194]Operation 'stop' on application 'mytestapplication' has succeeded on 'TP_Managed_Server'
.Completed the stop of Application with status completed
Current Status of your Deployment:
Deployment command type: stop
Deployment State       : completed
Deployment Message     : [Deployer:149194]Operation 'stop' on application 'mytestapplication' has succeeded on 'TP_Managed_Server'
Undeploying application mytestapplication ...
    
.Completed the undeployment of Application with status completed
Current Status of your Deployment:
Deployment command type: undeploy
Deployment State       : completed
Deployment Message     : [Deployer:149194]Operation 'remove' on application 'mytestapplication' has succeeded on 'TP_Managed_Server'
==============================================================================
Redeploying Application mytestapplication onTP_Managed_Server server...
==============================================================================
Deploying the application mytestapplication

Deploying application from /nfs/usr/mytestapplication.war to targets TP_Managed_Server (upload=false) ...
    
.Completed the deployment of Application with status completed
Current Status of your Deployment:
Deployment command type: deploy
Deployment State       : completed
Deployment Message     : [Deployer:149194]Operation 'deploy' on application 'mytestapplication' has succeeded on 'TP_Managed_Server'
Starting application mytestapplication.
    
.Completed the start of Application with status completed
Current Status of your Deployment:
Deployment command type: start
Deployment State       : completed
Deployment Message     : [Deployer:149194]Operation 'start' on application 'mytestapplication' has succeeded on 'TP_Managed_Server'
==============================================================================
Execution completed...
==============================================================================
Disconnected from weblogic server: AdminServer


Exiting WebLogic Scripting Tool.

    

 

TroubleShooting:

1. If you see the errors like “SyntaxError: inconsistent dedent” or “(no code object) at line 0” then make sure you have copied the script correctly. If Yes, then open the script in a advanced editor and check for tabs,spaces. Make sure its properly formatted. You can use GUI editors or online python syntax checkers like pych.atomidata.com to check the error in the copied script.

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

Problem invoking WLST - Traceback (innermost last):
(no code object) at line 0
File "/U2mgr/WLS/manageApplications.py", line 38
currentState = cmo.getCurrentState(deploymentName, deploymentTarget)
^
SyntaxError: inconsistent dedent

2. If you see below class not found exception then try to bring the weblogic.jar file into classpath like below.

-bash-3.2$ java weblogic.WLST ms.py
Exception in thread “main” java.lang.NoClassDefFoundError: weblogic/WLST
Caused by: java.lang.ClassNotFoundException: weblogic.WLST
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: weblogic.WLST. Program will exit.

Try like below post running the setDomainEnv.sh file:

-bash-3.2$ java -cp /opt/Oracle/wlserver_10.3/server/lib/weblogic.jar weblogic.WLST ms.py <Arguments>

Initializing WebLogic Scripting Tool (WLST) …

Welcome to WebLogic Server Administration Scripting Shell

 

If you dont want all this big script and want to go for something very simple then you can use below one too:

import re
 
warPath = '/nfs/usr/appl/mytestapplication.war'
appName = 'mytestapplication'

weblogicUrl = 't3://localhost:7001'
userName = 'weblogic'
password = 'weblogic123'

connect(userName, password, weblogicUrl)
 
appList = re.findall(appName, ls('/AppDeployments'))
if len(appList) >= 1:
    print 'undeploying application'
    undeploy(appName)
 
deploy(appName, path = warPath, retireTimeout = -1, upload = 'True')
exit()

If you like the article, then please share it with others!!!

 

In case of any ©Copyright or missing credits issue please check CopyRights page for faster resolutions.

29 Responses

  1. Vikram says:

    Hello,

    I am trying to use the same code for getting application status in weblogic 8.1. I don’t think we have “domainRuntime” mbean available in WLS8.1. When i try “cd(‘domainRuntime:/AppRuntimeStateRuntime/AppRuntimeStateRuntime’)” I do not actually go anywhere and remain in the same path. No error is received at the WLST prompt either.

    Can you please help me with a sample code to check application status on weblogic 8.1. I must say the above code works superb in WLS10.3.

    Request you to kindly email the WLS8.1 equivalent to my mail – [email protected]

    Thanks so much!

    -Vikram

    • admin says:

      WLST inbuild with Weblogic 9.x onwards but if you are working with 8.x version of weblogic and want to use wlst then you have to download jython.jar & wlst.jar separately and add to weblogic classpath.

      1. Download jython.jar & wlst.jar from the links provided below
      2. Update classpath on your setWLSenv.cmd/.sh scriprt for both jar files
      3. Run setWLSenv.cmd/.sh
      4. Invoke wlst as “java weblogic.WLST”

      Download jython.jar

      http://www.jython.org/downloads.html

      Download wlst.jar

      http://code.google.com/p/wlst-archives/downloads/detail?name=wlst.jar&can=2&q=label%3Aweblogic+8.1+7.0

      In WLS8.1 you cannot use WLST Online commands. Means Commands which requires to establish the Connection to the AdminServer before are called as Online Commands.

      Full Support for Online commands are added in WebLogic 9.1 only.

      Though there is a way to get the server states like below code using Java:
      You can also modify the below code to get the application related states following http://docs.oracle.com/cd/E11035_01/wls100/javadocs_mhome/weblogic/management/runtime/ServerRuntimeMBean.html link. Do remember that 8.1 is no more supported by oracle also.

      import java.util.*;
      import java.util.Enumeration;
      import javax.naming.Context;
      import javax.naming.InitialContext;
      import javax.management.ObjectName;
      import weblogic.jndi.Environment;
      import weblogic.management.*;
      import weblogic.management.runtime.*;
      import javax.management.*;

      import weblogic.management.configuration.ServerMBean;
      import weblogic.management.configuration.*;
      import weblogic.management.configuration.DomainMBean;
      import weblogic.management.configuration.ServerMBean;

      public class ServerStatusChecker81
      {
      MBeanServer server = null; // MBeanServer
      MBeanHome mbeanHome=null;
      Hashtable inStart = new Hashtable();
      public ServerStatusChecker81()
      {
      try {
      Environment env = new Environment();
      env.setProviderUrl(“t3://localhost:7003”);
      env.setSecurityPrincipal(“weblogic”); // username
      env.setSecurityCredentials(“weblogic”); // password
      Context myCtx = env.getInitialContext();
      mbeanHome =(MBeanHome)myCtx.lookup(“weblogic.management.adminhome”);
      server = mbeanHome.getMBeanServer();
      }
      catch (Exception ex)
      {
      System.err.println(“\n\n\tCannot get MBeanServer: “+ex);
      }
      }

      public void getServerState(String type,MBeanHome home)
      {
      Set set=home.getMBeansByType(type);
      Iterator it=set.iterator();
      while(it.hasNext())
      {
      ServerRuntimeMBean serverRuntime=(ServerRuntimeMBean)it.next();
      System.out.println(“\n\tNAME: “+serverRuntime.getName()+”\tSTATE: “+serverRuntime.getState());
      }
      }

      public static void main(String ar[]) throws Exception
      {
      ServerStatusChecker81 sm=new ServerStatusChecker81();
      sm.getServerState(“ServerRuntime”,sm.mbeanHome);
      }
      }

      OUTPUT:
      JMX>java ServerStatusChecker81
      ************************************************************
      SERVER ###### AdminServer ###### STATE: RUNNING
      ************************************************************
      SERVER ###### managedServer1 ###### STATE: RUNNING
      ************************************************************
      SERVER ###### managedServer2 ###### STATE: RUNNING

  2. Anto says:

    Hi

    This is great working script… I am looking for a feature that needs to be included in deployment automations. For development/testing environments, the frequency of deployments are quite high… I was wondering if there was a way a log the events that happen from start to end of a deployment in DEBUG mode and store it in a log file. I can send this file to the developers for troubleshooting purposes if a deployments fails or does not work as per their expectations.

    I tried this solution..
    javamonamour.org/2011/08/wlst-redirecting-all-output-to-file.html
    but it just logs the print commands of the script. I was wondering if it can also include the java deployment logs in this…
    I have been looking for a way to do this… but with my limited scripting skills I am finding it hard to find a solution… can u provide some help..

    Thanks

    Anto

    • admin says:

      Hi Anto,

      Not sure what you mean by debug mode, though you can put the manageApplication.py script run command in a shell script(Say: autodeploy.sh) like below
      ————————————————————————————————–
      #!/bin/bash
      #autodeploy.sh

      NOW=$(date +”%m-%d-%Y_%H-%M”)

      Main() {
      #Change the Domain Home according to Your Env.
      $DOMAIN_HOME/bin/setDomainEnv.sh
      #Change the variables according to your env details
      #E.g:java weblogic.WLST manageApplication.py -u weblogic -p weblogic123 -a newtest.wlst.techpaste.com:6090 -n mapviewer -f “/U2mgr/WL/home/apps/mapviewer.ear” -t AdminServer
      java weblogic.WLST manageApplication.py -u username -p password -a adminUrl [:] -n deploymentName -f deploymentFile -t deploymentTarget
      }

      Main | tee autodeploylog_$NOW.log
      ————————————————————————————————————
      So when ever you run ./autodeploy.sh you will find a log something like autodeploylog_09-11-2013_03-35.log which you can use for sending to developers incase of any failures.

  3. Amulya says:

    Hi,

    Thanks for posting the script. When i am running the above script thorugh WLST, it simply ends as below and nothing happens. Could you please let me know the reason why is it happenning?

    C:\Oracle\Middleware\wlserver_10.3\server\bin>java weblogic.WLST autodeploy.py -u weblogic -p egarage1 -a t3://localhost:7001/console -n TemporaryServiceLayer -f “C:\ATG\

    Initializing WebLogic Scripting Tool (WLST) …

    Welcome to WebLogic Server Administration Scripting Shell

    Type help() for help on available commands

    C:\Oracle\Middleware\wlserver_10.3\server\bin>

    Thanks!!!

    • TechPaste.Com says:

      dont use t3 etc in server url.. do something like below:

      java weblogic.WLST autodeploy.py -u weblogic -p egarage1 -a localhost:7001 -n TemporaryServiceLayer -f “C:\ATG\FileName.ear” -t Target_Server_Name

      • Amulya says:

        Hi,

        No luck! Gets out of the loop… Please help.

        C:\Oracle\Middleware\wlserver_10.3\server\bin>java weblogic.WLST autodeploy.py -u weblogic -p egarage1 -a localhost:7001 -n TemporaryServiceLayer -f ‘C:\ATG\ATG9.2\Tem

        Initializing WebLogic Scripting Tool (WLST) …

        Welcome to WebLogic Server Administration Scripting Shell

        Type help() for help on available commands

        Testing

        C:\Oracle\Middleware\wlserver_10.3\server\bin>

        • TechPaste.Com says:

          Not sure why its just coming out of wlst.From the logs I see its not even connecting to the admin server for authentication. Are you sure you have copied the code mentioned in post exactly to autodeploy.py file ?
          I just checked and in 10.3WL its working very fine without any issues.

          Please try something like below:

          cd to C:\Oracle\Middleware\wlserver_10.3\server\bin
          Copy the code mentioned in post to autodeploy.py
          run setDomainEnv.cmd or setWLSEnv.cmd
          java -cp C:\Oracle\Middleware\wlserver_10.3\server\lib\weblogic.jar weblogic.WLST autodeploy.py -u weblogic -p egarage1 -a localhost:7001 -n TemporaryServiceLayer -f “C:\ATG\FileName.ear” -t Target_Server_Name

          Make sure you have below things are also set as these are basic pre req to start wlst tool

          From “My Computer” or “Computer” (depending on your version of Windows)
          Click “Properties” or “System Properties”
          Click “Advanced System Settings”
          Add these user Environment Variables

          WL_HOME=C:/Oracle/Middleware/wlserver_10.3
          and

          CLASSPATH=.;%WL_HOME%/server/lib/weblogic.jar

          • Amulya says:

            Thanks a ton!!! It works …..

            Also i have removed exit() command from the script. Or otherwise it is coming out of the loop.

            Could you please let me know any other command to return to next statement?

            Thanks!

  4. sam says:

    Nice post…
    I am facing syntax error near except: . Can you please help me

    • sam says:

      i am able to solve the syntax issue. Now i am facing below error:

      Successfully connected to Admin Server ‘AdminServer’ that belongs to domain ‘base_domain’.

      Warning: An insecure protocol was used to connect to the
      server. To ensure on-the-wire security, the SSL port or
      Admin port should be used instead.

      Successfully connected to the domain

      Location changed to domainRuntime tree. This is a read-only tree with DomainMBean as the root.
      For more help, use help(domainRuntime)
      other Applications are Running
      application error

      Exiting WebLogic Scripting Tool.

      Can you please advise.

      Thanks a lot

      • Ramakanta says:

        Not enough info to recommend something… can you try to execute the commands one by one manually before executing them from script it seems some error in your deployed application… from the sample log, though not much info in logs provided…

        • sam says:

          It’s brand new application. It doesn’t exist on server.

          When I am able to deploy manually.

          • sam says:

            I tried to execute all the commands manually. But from script. I am unable to move forward.

            Can you please suggest any solution.

            Thanks for help!

          • Ramakanta says:

            Hi Sam,

            I have updated the main script, try the new script It is much faster.
            You can also use the simplest script which I have updated at the end of the article

  5. Antony says:

    Hi Nice Post…

    When I am trying to execute….It’s directly going to ‘ other Applications are Running ‘ and show the error “‘Error during the deployment of application”.

    Can you please suggest. What might gone wrong.

    Appreciate your help

    Thanks!

    • Ramakanta says:

      It goes to other applications are running in code block

      if appstatus(deploymentName, deploymentTarget)==’STATE_RETIRED’ :
      appflag=1
      elif appstatus(deploymentName, deploymentTarget)==’STATE_ACTIVE’:
      appflag=2
      else:
      print ‘ other Applications are Running ‘

      Means your application status is not ACTIVE or retired state then it shall print ” new application” and shall deploy the app but its not going till that point so check if you have copied the code correctly or not. Indent is important in python and check the command is correctly mentioned too… E.g

      weblogic.WLST manageApplication.py -u weblogic -p weblogic123 -a newtest.wlst.techpaste.com:6090 -n mapviewer -f “/U2mgr/WL/home/apps/mapviewer.ear” -t AdminServer

      • antony says:

        Hi…

        I am able to excute your script after making the below change…

        #sys.exit(2)

        If I wont comment the line it failing say -p parameter is missing. It’s unable to take more than one parameter.

        Can you please suggest me a solution.

        Thanks!

  6. sham says:

    Hi…

    Very good Script.

    I am trying to run….But I am facing “missing parameter error” .I gave all the parameters according to your suggest.

    Please find the below error:

    C:\Oracle\Middleware\Oracle_Home\wlserver\server\bin>java weblogic.WLST deploy.py -u weblogic -p weblogic123 -a localhost:7001 -n user -f “C:\Users\user\user\target\user.war” -t AdminServer

    Initializing WebLogic Scripting Tool (WLST) …

    Welcome to WebLogic Server Administration Scripting Shell

    Type help() for help on available commands

    Missing “-p password” parameter.

    Usage:
    java weblogic.WLST manageApplication.py -u username -p password -a adminUrl [:] -n deploymentName -f deploymentFile -t deploymentTarget

    Can you please advise me regarding this issue. (I also tried to put all the parameters in bat script. Still I am facing same issue.)

    Really Appreciate your help.

    Thanks

    • Ramakanta says:

      Hi Sham,

      Did you try the new script? I had updated it. Try running the script like below command:

      java -cp .:$CLASSPATH:/opt/Middleware/wlserver_10.3/server/lib/weblogic.jar weblogic.WLST ms.py -u weblogic -p weblogic123 -a admin.techpaste.com:7001 -n mytestapplication -f “/nfs/usr/mytestapplication.war” -t TP_Managed_Server

  7. ankur says:

    Hi Ramakanta

    Nice Script. Can we deploy multiple application once using above script. I am trying to run, but facing issue.

    Thanks for your help!

    • Ramakanta says:

      Hi Ankur,

      What you can do is create a simple shell script or batch script with a simple loop to pick up the names of war files stored in a folder and push it to below command if you are deploying to same manage server.

      Example:

      #!/bin/bash
      FILES=/path/to/all/war/files/*
      for f in $FILES
      do
      echo “Processing $f file…”
      #generate the application name from the war name
      appname=`echo $f | awk -F’/’ ‘{print $NF}’ | awk -F’.war’ ‘{print $1}’`
      echo “Deploying application $appname …”
      # take action on each file. $f store current file name
      java -cp .:\$CLASSPATH:/opt/Middleware/wlserver_10.3/server/lib/weblogic.jar weblogic.WLST ms.py -u weblogic -p weblogic123 -a admin.techpaste.com:7001 -n $appname -f “$f” -t TP_Managed_Server
      # cat $f

      done

  8. bolaji says:

    Hello.

    Am getting the below error after starting the weblogic server but the other oracle EBS services(form1_server,oacore_form, etic) is not coming up. Weblogic 11

    Error
    Warning: An insecure protocol was used to connect to the server. To ensure on-the-wire security, the SSL port or Admin port should be used instead

    Kindly assist with solutiion to

  9. Kaushik says:

    What to specify in “-t TP_Managed_Server”, if it is clustered BI environment and have both bi_server1 and bi_server2 as target?

  10. Faheem says:

    its great one.. but thinking of how to deploy artifacts to cluster..

  11. Faheem says:

    well i jus tested with cluster and it works.. although some exceptions like unable to start server etc.. but it application deployed to cluster… cheers

Leave a Reply