Shellscript to fetch all java exceptions from a weblogic managed server logfile

With the shellscript below you can fetch the java exceptions in a weblogic managed server logfile (stdout).
It will show for every java exception a line with in front of this the nummber of occurences.
It expects two parameters:

  • filename of the logfile
  • number of lines from the end of the logfile
  • FILE=$1
    NUMLINES=${2:-1000}
    echo "File : ${FILE}, number of lines : ${NUMLINES}"
    echo "-----------------------------------------------------------------------------------------------------------------------------------------"
    tail -${NUMLINES} ${FILE}|grep "^<"|head -1|sed 's/>.*$//'
    echo "-----------------------------------------------------------------------------------------------------------------------------------------"
    tail -${NUMLINES} ${FILE}|grep "java.*Exception" | sort | uniq -c | sort -n
    echo "-----------------------------------------------------------------------------------------------------------------------------------------"
    tail -${NUMLINES} ${FILE}|grep "^<"|tail -1|sed 's/>.*$//'
    echo "-----------------------------------------------------------------------------------------------------------------------------------------"
    

    We you run it you will get output like in the example below.

    File : wls_srv01.out, number of lines : 200000
    -----------------------------------------------------------------------------------------------------------------------------------------
    <Aug 23, 2016 3:10:18 PM CEST
    -----------------------------------------------------------------------------------------------------------------------------------------
          1 <Aug 23, 2016 4:58:17 PM CEST> <Emergency> <oracle.dfw.incident> <BEA-000000> <incident 5483 created with problem key "DFW-99998 [java.io.IOException][oracle.adf.library.webapp.LibraryFilter.doFilter][TestPortal]">
          1 <Aug 24, 2016 10:13:34 AM CEST> <Error> <HTTP> <BEA-101104> <Servlet execution in servlet context "ServletContext@537225323[app:TestPortaal module:TestPortaal path:/TestPortaal spec-version:2.5]" failed, java.io.IOException: Connection reset by peer.
          1 <Aug 24, 2016 11:06:28 AM CEST> <Emergency> <oracle.dfw.incident> <BEA-000000> <incident 5486 created with problem key "DFW-99998 [java.io.IOException][oracle.adf.library.webapp.LibraryFilter.doFilter][SendPortal]">
          1 <Aug 24, 2016 9:00:48 AM CEST> <Warning> <oracle.adf.controller.faces.lifecycle.Utils> <BEA-000000> <ADF: Adding the following JSF error message: java.lang.NullPointerException
          1 <Aug 24, 2016 9:12:21 AM CEST> <Emergency> <oracle.dfw.incident> <BEA-000000> <incident 5485 created with problem key "DFW-99998 [java.io.IOException][oracle.adf.library.webapp.LibraryFilter.doFilter][verzekeringenonline]">
          1 Caused By: java.lang.Exception: MDSLockedSessionManager already registered. Can't register more than one.
          1 java.lang.RuntimeException: java.lang.Exception: MDSLockedSessionManager already registered. Can't register more than one.
          1 javax.faces.application.ViewExpiredException: viewId:/Index - ADF_FACES-30108:The view state of the page has expired because of inactivity.  Reload the page.
          1 javax.faces.application.ViewExpiredException: viewId:/Main - ADF_FACES-30107:The view state of the page has expired.  Reload the page.
          2 <Aug 24, 2016 9:01:00 AM CEST> <Warning> <oracle.adf.controller.faces.lifecycle.Utils> <BEA-000000> <ADF: Adding the following JSF error message: java.lang.NullPointerException
          2 <Aug 24, 2016 9:01:10 AM CEST> <Warning> <oracle.adf.controller.faces.lifecycle.Utils> <BEA-000000> <ADF: Adding the following JSF error message: java.lang.NullPointerException
          5 java.lang.NullPointerException
          9 java.io.IOException: Connection reset by peer
         11 javax.el.PropertyNotFoundException: Target Unreachable, 'controller' returned null
      16397 java.lang.IllegalStateException: HttpSession is invalid
    -----------------------------------------------------------------------------------------------------------------------------------------
    <Aug 24, 2016 1:56:56 PM CEST
    -----------------------------------------------------------------------------------------------------------------------------------------
    

    This is a nice report to send to your developers.

    twitterlinkedinmailby feather

    Make a formatted output of all destinations with the number of messages and consumers

    With the jython code below you can generate a formatted output which contains totals of messages and consumers for all destinations.

    print('destinationName'.ljust(60) + 'MsgCurrent'.rjust(18) + 'MsgPending'.rjust(18)+ 'MsgHigh'.rjust(18)+ 'MsgReceived'.rjust(18) + 'ConsumersHigh'.rjust(18)+ 'ConsumersCurrent'.rjust(18) );
    servers = domainRuntimeService.getServerRuntimes();
    if (len(servers) &gt; 0):
        for server in servers:
            jmsRuntime = server.getJMSRuntime();
            jmsServers = jmsRuntime.getJMSServers();
            for jmsServer in jmsServers:
                destinations = jmsServer.getDestinations();
                for destination in destinations:
                    print(destination.getName().ljust(60) +str(destination.getMessagesCurrentCount()).rjust(18) + str(destination.getMessagesPendingCount()).rjust(18)+ str(destination.getMessagesHighCount()).rjust(18)+ str(destination.getMessagesReceivedCount()).rjust(18) + str(destination.getConsumersHighCount()).rjust(18)+ str(destination.getConsumersCurrentCount()).rjust(18) );
    

    When you run this will connected to a weblogic domain containing JMS destinations, you get output like in the example below.

    destinationName                  MsgCurrent        MsgPending           MsgHigh       MsgReceived     ConsumersHigh  ConsumersCurrent
    JMSDEST!JmsServer1@Q_OUT_TEST1          955                 0               955                 0                 0                 0
    JMSDEST!JmsServer2@Q_OUT_TEST1          925                 0               925                 0                 0                 0
    JMSDEST!JmsServer1@Q_IN_TEST2             0                 0                 0               655                 2                 1
    JMSDEST!JmsServer2@Q_IN_TEST2             0                 0                 0               624                 1                 1
    

    twitterlinkedinmailby feather

    List OSB proxy & business services with their state

    Create a shell script listosb.sh with contents below and change the “MW_HOME” and “path_to_file” with the correct values for you environment:

    #!/bin/sh
    MW_HOME=<MW_HOME></span>
    ORACLE_HOME="${MW_HOME}/Oracle_OSB1"
    WL_HOME="${MW_HOME}/wlserver_10.3"
    
    # set up common environment
    WLS_NOT_BRIEF_ENV=true
    . "${WL_HOME}/server/bin/setWLSEnv.sh"
    
    CLASSPATH="${CLASSPATH}${CLASSPATHSEP}${FMWLAUNCH_CLASSPATH}${CLASSPATHSEP}${DERBY_CLASSPATH}${CLASSPATHSEP}${DERBY_TOOLS}${CLASSPATHSEP}${POINTBASE_CLASSPATH}${CLASSPATHSEP}${POINTBASE_TOOLS}"
    
    CLASSPATH=$CLASSPATH:$ORACLE_HOME/modules/com.bea.common.configfwk_1.7.0.0.jar:$ORACLE_HOME/lib/sb-kernel-api.jar:$ORACLE_HOME/lib/sb-kernel-impl.jar:$WL_HOME/server/lib/weblogic.jar:$ORACLE_HOME/lib/alsb.jar;
    export CLASSPATH
    
    if [ "${WLST_HOME}" != "" ] ; then
    WLST_PROPERTIES="-Dweblogic.wlstHome='${WLST_HOME}'${WLST_PROPERTIES}"
    export WLST_PROPERTIES
    fi
    JVM_ARGS="-Dprod.props.file='${WL_HOME}'/.product.properties ${WLST_PROPERTIES} ${JVM_D64} ${MEM_ARGS} ${CONFIG_JVM_ARGS}"
    
    $ORACLE_HOME/common/bin/wlst.sh <path_to_file>/listosb.py
    

    First check if in your $ORACLE_HOME a file com.bea.common.configfwk_1.7.0.0.jar exists with the same version number. Otherwise change it to the correct name.
    Also create a file listosb.py with the contents below and fill in “password” and “hostname”:

    import sys
    import os
    import socket
    
    connect(username='weblogic', password='<password>', url='t3://<hostname>:7001')
    
    from com.bea.wli.sb.management.configuration import ALSBConfigurationMBean
    from com.bea.wli.config import Ref
    from java.lang import String
    from com.bea.wli.sb.util import Refs
    from com.bea.wli.sb.management.configuration import CommonServiceConfigurationMBean
    from com.bea.wli.sb.management.configuration import SessionManagementMBean
    from com.bea.wli.sb.management.configuration import ProxyServiceConfigurationMBean
    from com.bea.wli.sb.management.query import ProxyServiceQuery
    from com.bea.wli.sb.management.query import BusinessServiceQuery
    from com.bea.wli.monitoring import StatisticType
    from com.bea.wli.monitoring import ServiceDomainMBean
    from com.bea.wli.monitoring import ServiceResourceStatistic
    from com.bea.wli.monitoring import StatisticValue
    from com.bea.wli.monitoring import ServiceDomainMBean
    from com.bea.wli.monitoring import ServiceResourceStatistic
    from com.bea.wli.monitoring import StatisticValue
    from com.bea.wli.monitoring import ResourceType
    
    domainRuntime()
    
    alsbCore = findService(ALSBConfigurationMBean.NAME, ALSBConfigurationMBean.TYPE)
    
    psQuery = ProxyServiceQuery()
    psQuery.setServiceEnabled(true)
    allRefs= alsbCore.getRefs(psQuery)
    print "List of enabled Proxy Services"
    print "========================================================================="
    for ref in allRefs:
      typeId = ref.getTypeId()
      if typeId == "ProxyService":
         print "Proxy Service: " + ref.getFullName()
    
    psQuery = ProxyServiceQuery()
    psQuery.setServiceEnabled(false)
    allRefs= alsbCore.getRefs(psQuery)
    print "List of disabled Proxy Services"
    print "========================================================================="
    for ref in allRefs:
      typeId = ref.getTypeId()
      if typeId == "ProxyService":
         print "Proxy Service: " + ref.getFullName()
    
    bsQuery = BusinessServiceQuery()
    bsQuery.setServiceEnabled(true)
    allRefs= alsbCore.getRefs(bsQuery)
    print "List of enabled Business Services"
    print "========================================================================="
    for ref in allRefs:
      typeId = ref.getTypeId()
      if typeId == "BusinessService":
         print "Business Service: " + ref.getFullName()
    
    bsQuery = BusinessServiceQuery()
    bsQuery.setServiceEnabled(false)
    allRefs= alsbCore.getRefs(bsQuery)
    print "List of disabled Business Services"
    print "========================================================================="
    for ref in allRefs:
      typeId = ref.getTypeId()
      if typeId == "BusinessService":
         print "Business Service: " + ref.getFullName()
    

    Now run the shellscript and you will get output like below :

    List of enabled Proxy Services
    =========================================================================
    Proxy Service: EmailTest/EmailTest_PS
    Proxy Service: Test/EchoPS
    
    List of disabled Proxy Services
    =========================================================================
    Proxy Service: SLA_Services/proxy/ReceiveSlaALert
    
    List of enabled Business Services
    =========================================================================
    Business Service: FileTransferTest/business/FTPPut
    
    List of disabled Business Services
    =========================================================================
    Business Service: FileTransferTest/business/FTPGet
    

    twitterlinkedinmailby feather

    Manually edit or reset the AdminServer console preferences

    After setting the “Number of rows displayed per page” in the Administration Console to the value 5000 on Weblogic version 12.1.2.0.0 I got this error.

    “An unexpected error condition has been detected. Details have been recorded in de admin server log”

    console01

    In de admin server logfile I saw this error :

    ####<Aug 19, 2016 10:11:24 AM CEST> <Error> <Socket> <localhost> <AdminServer> 
    <ExecuteThread: '0' for queue: 'weblogic.socket.Muxer'> <<WLS Kernel>> <> <> <1471594284090> 
    <BEA-000403> <IOException occurred on socket: Socket[addr=/127.0.0.1,port=16571,localport=7001] 
    weblogic.socket.MaxMessageSizeExceededException: Incoming message of size: '10000080' bytes exceeds the configured maximum of: '10000000' bytes for protocol: 't3'. 
    weblogic.socket.MaxMessageSizeExceededException: Incoming message of size: '10000080' bytes exceeds the configured maximum of: '10000000' bytes for protocol: 't3' at 
    weblogic.rjvm.t3.MuxableSocketT3.read(MuxableSocketT3.java:643) at weblogic.socket.NIOSocketMuxer.readFromSocket(NIOSocketMuxer.java:636) at 
    weblogic.socket.SocketMuxer.readReadySocketOnce(SocketMuxer.java:951) at weblogic.socket.SocketMuxer.readReadySocket(SocketMuxer.java:928) at 
    weblogic.socket.NIOSocketMuxer.process(NIOSocketMuxer.java:516) at weblogic.socket.NIOSharedWorkSocketMuxer.processSockets(NIOSharedWorkSocketMuxer.java:104) at 
    weblogic.socket.SocketReaderRequest.run(SocketReaderRequest.java:30) at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:43) at 
    weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:147) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:119) >       
    

    You can change the maximum value on this screen.

    console02

    After this you need to restart the AdminServer. Another option is to decrease the Number of rows displayed per page from 5000 to 100 for example. Therefore you manually need to edit the file ConsolePreferences.xml which is located in the directory ${DOMAIN_HOME}/servers/AdminServer/data/console. You can just change the value 5000 for the preference_name “maxrows”

       <portlet-preference definitionLabel="DiagnosticsViewServerLogTablePortlet" user="admin">
         <preference name="filterByCriteria" description="The description" isModifiable="true" isMultivalued="false" value=""/>
         <preference name="selectedColumns" description="The description" isModifiable="true" isMultivalued="true">
           <value>date</value>
           <value>subsystem</value>
           <value>severity</value>
           <value>msgid</value>
           <value>message</value>
           <value>contextid</value>
           <value>machine</value>
           <value>server</value>
           <value>thread</value>
           <value>timestamp</value>
           <value>txid</value>
           <value>userid</value>
         </preference>
         <preference name="timeRangeSelection" description="The description" isModifiable="true" isMultivalued="false" value="All"/>
         <preference name="rowsperpage" description="The description" isModifiable="true" isMultivalued="false" value="5000"/>
         <preference name="maxrows" description="The description" isModifiable="true" isMultivalued="false" value="All"/>
       </portlet-preference>
    

    Or you can remove the complete portlet-preference with the definitionLabel “DiagnosticsViewServerLogTablePortlet”.
    After this you will need to restart the AdminServer also.

    twitterlinkedinmailby feather

    Working with templates in FMW 12.2.1.0

    In the new version 12.2.1.0 release of the Oracle Fusion Middlware there has been a change in working with templates. The traditional commands addTemplate & readTemplate have been deprecated in this release and will be removed in future releases. New commands are now available.

    • selectTemplate
      Select an existing domain template or application template for creating a domain
    • unselectTemplate
      Unselect a selected domain template or application template
    • loadTemplates
      Loads all the selected templates using select template
    • showTemplates
      Display all currently selected and loaded templates
    • showAvailableTemplates
      Displays all currently selected templates for loading

    So how do is work ?
    This example below is done with an Oracle Service Bus 12.2.1.0 software installation.

    $ORACLE_HOME/oracle_common/common/bin/wlst.sh
    
    wls:/offline> showAvailableTemplates('false','true','false')
    20849: Available templates.
    20849: Currently available templates for loading: 
    Oracle API Manager:12.2.1 [/app/oracle/middleware/fmw12.2.1.0.0/osb/common/templates/wls/oracle.apimanager_template.jar]
    Oracle Service Bus:12.2.1 [/app/oracle/middleware/fmw12.2.1.0.0/osb/common/templates/wls/oracle.osb_template.jar]
    WebLogic Advanced Web Services for JAX-RPC Extension:12.2.1 [/app/oracle/middleware/fmw12.2.1.0.0/oracle_common/common/templates/wls/oracle.wls-webservice-template.jar]
    ODSI XQuery 2004 Components:12.1.3.0 [/app/oracle/middleware/fmw12.2.1.0.0/oracle_common/common/templates/wls/oracle.odsi.xquery2004_template_12.1.3.jar]
    Oracle Enterprise Scheduler Service Basic:12.2.1 [/app/oracle/middleware/fmw12.2.1.0.0/oracle_common/common/templates/wls/oracle.ess.basic_template.jar]
    Oracle Enterprise Manager Plugin for ESS:12.2.1 [/app/oracle/middleware/fmw12.2.1.0.0/em/common/templates/wls/oracle.em_ess_template.jar]
    Oracle Enterprise Manager:12.2.1 [/app/oracle/middleware/fmw12.2.1.0.0/em/common/templates/wls/oracle.em_wls_template.jar]
    Oracle Business Activity Monitoring:12.2.1 [/app/oracle/middleware/fmw12.2.1.0.0/soa/common/templates/wls/oracle.bam.server_template.jar]
    Oracle User Messaging Service Basic:12.2.1 [/app/oracle/middleware/fmw12.2.1.0.0/oracle_common/common/templates/wls/oracle.ums.basic_template.jar]
    Oracle WSM Policy Manager:12.2.1.0 [/app/oracle/middleware/fmw12.2.1.0.0/oracle_common/common/templates/wls/oracle.wsmpm_template.jar]
    Oracle RAS Session Service:12.2.1.0 [/app/oracle/middleware/fmw12.2.1.0.0/oracle_common/common/templates/wls/oracle.ras_template.jar]
    Oracle JRF SOAP/JMS Web Services:12.2.1 [/app/oracle/middleware/fmw12.2.1.0.0/oracle_common/common/templates/wls/oracle.jrf.ws.soapjms_template.jar]
    Oracle Enterprise Manager-Restricted JRF:12.2.1 [/app/oracle/middleware/fmw12.2.1.0.0/em/common/templates/wls/oracle.em_wls_restricted_template.jar]
    Oracle JRF:12.2.1 [/app/oracle/middleware/fmw12.2.1.0.0/oracle_common/common/templates/wls/oracle.jrf_template.jar]
    Oracle Restricted JRF:12.2.1 [/app/oracle/middleware/fmw12.2.1.0.0/oracle_common/common/templates/wls/oracle.jrf_restricted_template.jar]
    WebLogic Coherence Cluster Extension:12.2.1 [/app/oracle/middleware/fmw12.2.1.0.0/wlserver/common/templates/wls/wls_coherence_template.jar]
    WebLogic Advanced Web Services for JAX-WS Extension:12.2.1 [/app/oracle/middleware/fmw12.2.1.0.0/oracle_common/common/templates/wls/oracle.wls-webservice-jaxws-template.jar]
    Basic WebLogic Server Domain:12.2.1 [/app/oracle/middleware/fmw12.2.1.0.0/wlserver/common/templates/wls/wls.jar]
    Oracle OPSS REST Service Application:12.2.1.0 [/app/oracle/middleware/fmw12.2.1.0.0/oracle_common/common/templates/wls/oracle.opss.rest_service_template.jar]
    WebLogic JAX-WS SOAP/JMS Extension:12.2.1 [/app/oracle/middleware/fmw12.2.1.0.0/oracle_common/common/templates/wls/oracle.wls-webservice-soapjms-template.jar]
    20849: No action required.'
    
    wls:/offline> selectTemplate('Oracle Service Bus','12.2.1')
    
    wls:/offline> showTemplates()
    20845: Applied templates.
    20845: Previously applied templates: None
    20845: No action required.
    20846: Selected templates.
    20846: Currently selected templates: 
    ODSI XQuery 2004 Components:12.1.3.0
    Oracle JRF:12.2.1
    Oracle WSM Policy Manager:12.2.1.0
    WebLogic Advanced Web Services for JAX-RPC Extension:12.2.1
    Oracle Service Bus:12.2.1
    Basic WebLogic Server Domain:12.2.1
    WebLogic Coherence Cluster Extension:12.2.1
    Oracle Enterprise Manager:12.2.1
    20846: No action required.
    
    wls:/offline> loadTemplates()

    As you can see if you choose the Oracle Service Bus template all other dependent templates are automatically selected. When you unselect a template it works the same way.

    wls:/offline/> unselectTemplate('WebLogic Coherence Cluster Extension','12.2.1')
    wls:/offline/>showTemplates()
    20845: Applied templates.
    20845: Previously applied templates:   None
    20845: No action required.
    20846: Selected templates.
    20846: Currently selected templates: 
    ODSI XQuery 2004 Components:12.1.3.0
    WebLogic Advanced Web Services for JAX-RPC Extension:12.2.1
    Basic WebLogic Server Domain:12.2.1
    20846: No action required.
    

    twitterlinkedinmailby feather

    Convert an existing server configuration to an executable WLST script

    The command configToScript() read your domain configuration (config.xml) and convert this to an excutable WLST script. The configToScript() command can be done offline or online.

    So let’s do it in offline mode (not connected to the AdminServer) on my domain and see the results. For this test I created some resources in my domain :

    • Cluster : TestCluser
    • Server : TestServer1, TestServer2
    • Datasource : TestDatasource

    Also an user raymond was created with group membership Deployer, Monitor and Operator. Here we go…..

    /Users/raymond/oracle/wls12130/wlserver/common/bin/wlst.sh 
    
    Initializing WebLogic Scripting Tool (WLST) ...
    
    Welcome to WebLogic Server Administration Scripting Shell
    
    Type help() for help on available commands
    
    wls:/offline> configToScript('/Users/raymond/oracle/wls12130/user_projects/domains/mydomain')
    configToScript is loading configuration from /Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/config.xml ...
    Completed configuration load, now converting resources to wlst script...
    Creating the key file can reduce the security of your system if it is not kept in a secured location after it is created. Creating new key...
    Using existing user key file...
    Using existing user key file...
    Using existing user key file...
    Using existing user key file...
    Using existing user key file...
    Using existing user key file...
    Using existing user key file...
    Using existing user key file...
    configToScript completed successfully The WLST script is written to /Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/config.py and the properties file associated with this script is written to /Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/config.py.properties
    WLST found encrypted passwords in the domain configuration. 
    These passwords are stored encrypted in /Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/c2sConfigmydomain 
    and /Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/c2sSecretmydomain. WLST will use these password values 
    while the script is run.
    

    Now have a look at the generated files :

    cd /Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config
    ls -ltr
    total 80
    drwxr-xr-x  3 raymond  staff    102  4 apr 11:27 startup
    drwxr-xr-x  3 raymond  staff    102  4 apr 11:27 security
    drwxr-xr-x  3 raymond  staff    102  4 apr 11:27 diagnostics
    drwxr-xr-x  3 raymond  staff    102  4 apr 11:27 deployments
    drwxr-xr-x  3 raymond  staff    102  4 apr 11:27 nodemanager
    drwxr-xr-x  3 raymond  staff    102  4 apr 11:27 configCache
    drwxr-xr-x  4 raymond  staff    136 14 mei 22:55 jdbc
    -rw-r--r--  1 raymond  staff   5394 14 mei 22:55 config.xml
    -rw-r-----  1 raymond  staff      0 14 mei 22:55 config.lok
    -rw-r-----  1 raymond  staff    330 14 mei 23:12 config.py.properties
    -rw-r-----  1 raymond  staff  19002 14 mei 23:12 config.py
    -rw-r-----  1 raymond  staff     64 14 mei 23:12 c2sSecretmydomain
    -rw-r-----  1 raymond  staff   1488 14 mei 23:12 c2sConfigmydomain
    

    The file config.py.properties contains this :

    cat config.py.properties 
    #WLST ConfigToScript Default Properties file 
    #Thu May 14 23:12:00 CEST 2015
    exitonerror=false
    adminServerListenAddress=localhost
    adminServerName=myserver
    domName=mydomain
    passWord=
    overWriteRootDir=true
    TimeOut=240000
    startedNewServer=0
    domainDir=WLSTConfigToScriptDomain
    userName=
    adminServerListenPort=7001
    startServerJvmArgs=
    

    The file c2sConfigmydomain contains all the encrypted usernames and passwords in the domain. Together with the file c2sSecretmydomain you can decrypt them, so keep them both in a safe place.

    at c2sConfigmydomain 
    #WebLogic User Configuration File; 2
    #Thu May 14 23:12:00 CEST 2015
    c2s42.username={AES}TWy4I/ozbsguJT9NLoatFalOpD/6PsuyXgIHUB33hi8\=
    c2s47.username={AES}3LJ2Zr3inCDz4OIox5sTNwv/8Qb05tpqvSyd7idbFM8\=
    c2s35.username={AES}4jyIEKN3nQ6YGNMEAcVYxlCy1pe5/pgPNUq0WIc5J2w\=
    c2s45.password={AES}Yn7ZAFLeovpKhUCWK85Msi0XCdT9pbfocF986MMqoAiDNQiL9HtiYLEohhwe2Pm5r/FoxqSKwpyEVEBrOGn3UphwEmTIv9kaHU9cKTPbaQ7EajROtq0X4aB51AGTNViw
    c2s45.username={AES}kCr+XVy/EWnbIzwq2VqzdjoF2yyCdxSBgs1RlnQE1fY\=
    c2s43.password={AES}POl2hdF/aBc066Zi9in75ITC7x4pU3Vl4y6jsEmK0UE\=
    weblogic.management.username={AES}tM7YP91aLKx/p26msAe+fJ3gtex2h1fPJ38GZuI0yMI\=
    c2s43.username={AES}4WobtGMpnoPZQ1D6JE6npynHKQfbEMxCPA/QlhT/Huc\=
    c2s48.username={AES}idiCJVgzWdCW9BuPRhHRXoZXhNVBzWNV1zT634o3Z+Y\=
    c2s46.password={AES}KpBhnLk/CiuKbuaxne3L5fBmEBMzPb+bx3icnwcXJvk\=
    c2s34.password={AES}qTF7M/4JsDJrwxvLxbFCwJAnCRrtR1oDwgIt6YUh8Q+WtJYL1/xAbVfHeeKws6W2
    c2s34.username={AES}cbkVnvQr7Z/ynXuVcsxHACYob7/SVmcIIzx5oM2Nmrc\=
    c2s46.username={AES}Vkte41G8JY+EI6RIiEyAYP/6WhYRBLJI0HLGKa+kgzQ\=
    weblogic.management.password={AES}XLFSe+hiosvRb7w+/rolA96ocTXnQQ5R7EtD4JimSy8\=
    c2s48.password={AES}HEbo9ixojirc5Zm22sSFjAaXrffxCbIGIe6bay4qzTitZ/4x9YrDXdu7t0tr/uh+clubBRDT8a2o9AV4iLRtUf01XrwVfMCI3/YhTrZ2gk1pb1fh7mthhgNJgpIjpBov
    c2s42.password={AES}tJz5k0AkUZUStZ8OObAbac/V3QvQkGkuSoSxNSeKd/8\=
    c2s35.password={AES}vr1f/d7pBmsLEURBYUEhyAkuqSZQKlSvkP4CnqfXfd43hJMh7qInIH5CFmRtWVmb
    c2s47.password={AES}1nQsD9eEtIxhwFvxqiWMB7Q5NTbdhdkqHQhpw5hl1tU\=
    

    The file config.py contains all the WLST commands needed to recreate this domain.
    So let’s give it a try :

    pwd
    /Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config
    ls -l
    total 64
    -rw-r-----   1 raymond  staff   1488 14 mei 23:27 c2sConfigmydomain
    -rw-r-----   1 raymond  staff     64 14 mei 23:27 c2sSecretmydomain
    -rw-r-----   1 raymond  staff  19002 14 mei 23:26 config.py
    -rw-r-----   1 raymond  staff    330 14 mei 23:26 config.py.properties
    drwxr-xr-x  17 raymond  staff    578 14 mei 22:52 mydomain
    cp config.py* ../..
    cp c2s* ../..
    cd ../../
    mv mydomain mydomain.org
    ls -l
    total 64
    -rw-r-----   1 raymond  staff   1488 14 mei 23:27 c2sConfigmydomain
    -rw-r-----   1 raymond  staff     64 14 mei 23:27 c2sSecretmydomain
    -rw-r-----   1 raymond  staff  19002 14 mei 23:26 config.py
    -rw-r-----   1 raymond  staff    330 14 mei 23:26 config.py.properties
    drwxr-xr-x  17 raymond  staff    578 14 mei 22:52 mydomain.org
    mkdir -p mydomain/config
    mv c2s* mydomain/config/
    mv config.py* mydomain/config/
    cd mydomain/config
    ls -l
    total 64
    -rw-r-----  1 raymond  staff   1488 14 mei 23:27 c2sConfigmydomain
    -rw-r-----  1 raymond  staff     64 14 mei 23:27 c2sSecretmydomain
    -rw-r-----  1 raymond  staff  19002 14 mei 23:26 config.py
    -rw-r-----  1 raymond  staff    330 14 mei 23:26 config.py.properties
    
    export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_76.jdk/Contents/Home/
    /Users/raymond/oracle/wls12130/wlserver/common/bin/wlst.sh
    
    Initializing WebLogic Scripting Tool (WLST) ...
    
    Welcome to WebLogic Server Administration Scripting Shell
    
    Type help() for help on available commands
    
    wls:/offline> execfile('config.py')
    Connecting to t3://localhost:7001 with userid weblogic ...
    No server is running at t3://localhost:7001, the script will start a new server
    Starting a brand new server at t3://localhost:7001 with server name myserver
    Please see the server log files for startup messages available at WLSTConfigToScriptDomain
    Starting weblogic server ...
    WLST-WLS-1431639400858: <14-mei-2015 23:36:41 uur CEST> <Info> <Security> <BEA-090905> <Disabling the CryptoJ JCE Provider self-integrity check for better startup performance. To enable this check, specify -Dweblogic.security.allowCryptoJDefaultJCEVerification=true.> 
    WLST-WLS-1431639400858: <14-mei-2015 23:36:41 uur CEST> <Info> <Security> <BEA-090906> <Changing the default Random Number Generator in RSA CryptoJ from ECDRBG128 to FIPS186PRNG. To disable this change, specify -Dweblogic.security.allowCryptoJDefaultPRNG=true.> 
    .WLST-WLS-1431639400858: <14-mei-2015 23:36:44 uur CEST> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) 64-Bit Server VM Version 24.76-b04 from Oracle Corporation.> 
    WLST-WLS-1431639400858: <14-mei-2015 23:36:47 uur CEST> <Info> <Management> <BEA-140013> </Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/WLSTConfigToScriptDomain/config not found> 
    WLST-WLS-1431639400858: <14-mei-2015 23:36:47 uur CEST> <Info> <Management> <BEA-141254> <Generating new domain directory in /Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/WLSTConfigToScriptDomain.>
    .........WLST-WLS-1431639400858: <14-mei-2015 23:37:23 uur CEST> <Info> <Management> <BEA-141255> <Domain generation completed in 35.846 milliseconds.> 
    WLST-WLS-1431639400858: <14-mei-2015 23:37:23 uur CEST> <Info> <Management> <BEA-141107> <Version: WebLogic Server 12.1.3.0.0  Tue Jan 27 02:49:44 UTC 2015 1654890 > 
    ..WLST-WLS-1431639400858: <14-mei-2015 23:37:32 uur CEST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING.> 
    WLST-WLS-1431639400858: <14-mei-2015 23:37:32 uur CEST> <Info> <WorkManager> <BEA-002900> <Initializing self-tuning thread pool.> 
    WLST-WLS-1431639400858: <14-mei-2015 23:37:33 uur CEST> <Info> <WorkManager> <BEA-002942> <CMM memory level becomes 0. Setting standby thread pool size to 256.> 
    ...WLST-WLS-1431639400858: <14-mei-2015 23:37:43 uur CEST> <Notice> <Log Management> <BEA-170019> <The server log file /Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/WLSTConfigToScriptDomain/servers/myserver/logs/myserver.log is opened. All server side log events will be written to this file.> 
    .........WLST-WLS-1431639400858: <14-mei-2015 23:38:19 uur CEST> <Notice> <Security> <BEA-090082> <Security initializing using security realm myrealm.> 
    .WLST-WLS-1431639400858: <14-mei-2015 23:38:21 uur CEST> <Warning> <Store> <BEA-280109> <The JVM was unable to load the native wlfileio library for the store "_WLS_myserver". File and paging stores will continue to function correctly. Specifically, file stores that are configured with a transactionally safe synchronous write policy will continue to operate safely and transactionally but may open with a different write-policy. Other store types may not be able to open.> 
    .......WLST-WLS-1431639400858: <14-mei-2015 23:38:53 uur CEST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STANDBY.> 
    WLST-WLS-1431639400858: <14-mei-2015 23:38:53 uur CEST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING.> 
    WLST-WLS-1431639400858: mei 14, 2015 11:38:54 PM weblogic.wsee.WseeCoreMessages logWseeServiceStarting
    WLST-WLS-1431639400858: INFO: The Wsee Service is starting
    .WLST-WLS-1431639400858: <14-mei-2015 23:38:56 uur CEST> <Notice> <Log Management> <BEA-170027> <The server has successfully established a connection with the Domain level Diagnostic Service.> 
    WLST-WLS-1431639400858: <14-mei-2015 23:38:58 uur CEST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to ADMIN.> 
    .WLST-WLS-1431639400858: <14-mei-2015 23:38:59 uur CEST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RESUMING.> 
    WLST-WLS-1431639400858: <14-mei-2015 23:39:00 uur CEST> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 127.0.0.1:7001 for protocols iiop, t3, ldap, snmp, http.> 
    WLST-WLS-1431639400858: <14-mei-2015 23:39:00 uur CEST> <Notice> <WebLogicServer> <BEA-000331> <Started the WebLogic Server Administration Server "myserver" for domain "mydomain" running in development mode.> 
    WLST-WLS-1431639400858: <14-mei-2015 23:39:00 uur CEST> <Notice> <WebLogicServer> <BEA-000360> <The server started in RUNNING mode.> 
    WLST-WLS-1431639400858: <14-mei-2015 23:39:00 uur CEST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING.> 
    Server started successfully.
    Started Server. Trying to connect to the server ... 
    Connecting to t3://localhost:7001 with userid weblogic ...
    Successfully connected to Admin Server "myserver" that belongs to domain "mydomain".
    
    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.
    
    Location changed to edit tree. This is a writable tree with 
    DomainMBean as the root. To make changes you will need to start 
    an edit session via startEdit(). 
    
    For more help, use help('edit')
    
    Starting an edit session ...
    Started edit session, please be sure to save and activate your 
    changes once you are done.
    creating mbean of type Server ... 
    creating mbean of type Server ... 
    creating mbean of type Server ... 
    creating mbean of type MigratableTarget ... 
    creating mbean of type MigratableTarget ... 
    creating mbean of type Realm ... 
    creating mbean of type Authorizer ... 
    creating mbean of type Adjudicator ... 
    creating mbean of type AuthenticationProvider ... 
    creating mbean of type AuthenticationProvider ... 
    creating mbean of type CertPathProvider ... 
    creating mbean of type CredentialMapper ... 
    creating mbean of type RoleMapper ... 
    creating mbean of type Cluster ... 
    creating mbean of type JDBCSystemResource ... 
    creating mbean of type Property ... 
    setting attributes for mbean type Server
    setting attributes for mbean type Server
    setting attributes for mbean type Server
    setting attributes for mbean type MigratableTarget
    setting attributes for mbean type MigratableTarget
    setting attributes for mbean type DefaultIdentityAsserter
    setting attributes for mbean type Cluster
    setting attributes for mbean type JDBCSystemResource
    setting attributes for mbean type JDBCProperty
    setting attributes for mbean type JDBCConnectionPoolParams
    setting attributes for mbean type EmbeddedLDAP
    setting attributes for mbean type WebServerLog
    setting attributes for mbean type Domain
    setting attributes for mbean type WebServerLog
    setting attributes for mbean type JTAMigratableTarget
    setting attributes for mbean type JDBCDataSourceParams
    setting attributes for mbean type JDBCDriverParams
    setting attributes for mbean type SecurityConfiguration
    setting attributes for mbean type JTAMigratableTarget
    setting attributes for mbean type JDBCDataSource
    Starting an edit session ...
    Started edit session, please be sure to save and activate your 
    changes once you are done.
    Saving all your changes ...
    WLST-WLS-1431639400858: <14-mei-2015 23:41:18 uur CEST> <Warning> <Cluster> <BEA-003121> <Unicast cluster may not function correctly as the listen address of server TestServer1 is not specified.> 
    WLST-WLS-1431639400858: <14-mei-2015 23:41:18 uur CEST> <Warning> <Cluster> <BEA-003121> <Unicast cluster may not function correctly as the listen address of server TestServer2 is not specified.> 
    Saved all your changes successfully.
    Activating all your changes, this may take a while ... 
    The edit lock associated with this edit session is released 
    once the activation is completed.
    WLST-WLS-1431639400858: <14-mei-2015 23:41:19 uur CEST> <Warning> <Cluster> <BEA-003121> <Unicast cluster may not function correctly as the listen address of server TestServer1 is not specified.> 
    WLST-WLS-1431639400858: <14-mei-2015 23:41:19 uur CEST> <Warning> <Cluster> <BEA-003121> <Unicast cluster may not function correctly as the listen address of server TestServer2 is not specified.> 
    WLST-WLS-1431639400858: <14-mei-2015 23:41:19 uur CEST> <Warning> <Management> <BEA-141239> <The non-dynamic attribute CredentialEncrypted on weblogic.management.configuration.EmbeddedLDAPMBeanImpl@d7846a68([mydomain]/EmbeddedLDAP[mydomain]) has been changed. This may require redeploying or rebooting configured entities.> 
    WLST-WLS-1431639400858: <14-mei-2015 23:41:19 uur CEST> <Warning> <Management> <BEA-141238> <A non-dynamic change has been made which affects the server myserver. This server must be rebooted in order to consume this change.> 
    WLST-WLS-1431639400858: <14-mei-2015 23:41:19 uur CEST> <Warning> <Management> <BEA-141239> <The non-dynamic attribute ListenAddress on weblogic.management.configuration.ServerMBeanImpl@3e95d0cb([mydomain]/Servers[myserver]) has been changed. This may require redeploying or rebooting configured entities.> 
    WLST-WLS-1431639400858: <14-mei-2015 23:41:19 uur CEST> <Warning> <Management> <BEA-141238> <A non-dynamic change has been made which affects the server myserver. This server must be rebooted in order to consume this change.> 
    WLST-WLS-1431639400858: <14-mei-2015 23:41:20 uur CEST> <Warning> <Cluster> <BEA-003121> <Unicast cluster may not function correctly as the listen address of server TestServer1 is not specified.> 
    WLST-WLS-1431639400858: <14-mei-2015 23:41:20 uur CEST> <Warning> <Cluster> <BEA-003121> <Unicast cluster may not function correctly as the listen address of server TestServer2 is not specified.> 
    
    The following non-dynamic attribute(s) have been changed on MBeans 
    that require server re-start:
    MBean Changed : com.bea:Name=myserver,Type=Server
    Attributes changed : ListenAddress
    
    MBean Changed : com.bea:Name=mydomain,Type=EmbeddedLDAP
    Attributes changed : CredentialEncrypted
    
    Activation completed
    Shutting down the server that is started... 
    Shutting down the server myserver with force=true while connected to myserver ...
    WLST-WLS-1431639400858: <14-mei-2015 23:41:20 uur CEST> <Notice> <WebLogicServer> <BEA-000396> <Server shutdown has been requested by weblogic.> 
    WLST-WLS-1431639400858: <14-mei-2015 23:41:20 uur CEST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FORCE_SUSPENDING.> 
    WLST-WLS-1431639400858: <14-mei-2015 23:41:21 uur CEST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to ADMIN.> 
    WLST-WLS-1431639400858: <14-mei-2015 23:41:21 uur CEST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FORCE_SHUTTING_DOWN.> 
    WLST-WLS-1431639400858: <14-mei-2015 23:41:21 uur CEST> <Notice> <Server> <BEA-002607> <Channel "Default", listening on 127.0.0.1:7001, was shut down.> 
    WLST-WLS-1431639400858: mei 14, 2015 11:41:21 PM weblogic.wsee.WseeCoreMessages logWseeServiceHalting
    WLST-WLS-1431639400858: INFO: The Wsee Service is halting
    .WLST-WLS-1431639400858: Stopped draining WLST-WLS-1431639400858
    WLST-WLS-1431639400858: Stopped draining WLST-WLS-1431639400858
    WLST lost connection to the WebLogic Server that you were 
    connected to, this may happen if the server was shutdown or 
    partitioned. You will have to re-connect to the server once the 
    server is available.
    Disconnected from weblogic server: myserver
    Disconnected from weblogic server: 
    Done executing the script.
    wls:/offline> 
    

    Because in the config.py.properties the value of variable domainDir is set to WLSTConfigToScriptDomain, the domain is created in the directory below :

    cd /Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/WLSTConfigToScriptDomain
    ls -l
    total 24
    drwxr-x---   3 raymond  staff  102 14 mei 23:37 autodeploy
    drwxr-x---  17 raymond  staff  578 14 mei 23:37 bin
    drwxr-x---  11 raymond  staff  374 14 mei 23:37 config
    drwxr-x---   3 raymond  staff  102 14 mei 23:37 console-ext
    -rw-r-----   1 raymond  staff   33 14 mei 23:41 edit.lok
    -rw-r-----   1 raymond  staff  328 14 mei 23:37 fileRealm.properties
    drwxr-x---  13 raymond  staff  442 14 mei 23:37 init-info
    drwxr-x---   3 raymond  staff  102 14 mei 23:37 lib
    drwxr-x---   4 raymond  staff  136 14 mei 23:37 nodemanager
    drwxr-x---   2 raymond  staff   68 14 mei 23:41 pending
    drwxr-x---   7 raymond  staff  238 14 mei 23:37 security
    drwxr-x---   4 raymond  staff  136 14 mei 23:41 servers
    -rwxr-x---   1 raymond  staff  309 14 mei 23:37 startWebLogic.sh
    drwxr-x---   2 raymond  staff   68 14 mei 23:41 tmp
    

    Now we start the AdminServer and see if the domain is identical to the original.

    ./startWebLogic.sh 
    .
    .
    JAVA Memory arguments: -Xms256m -Xmx512m -XX:CompileThreshold=8000 -XX:PermSize=128m  -XX:MaxPermSize=256m
    .
    CLASSPATH=/Library/Java/JavaVirtualMachines/jdk1.7.0_76.jdk/Contents/Home/lib/tools.jar:/Users/raymond/oracle/wls12130/wlserver/server/lib/weblogic_sp.jar:/Users/raymond/oracle/wls12130/wlserver/server/lib/weblogic.jar:/Users/raymond/oracle/wls12130/wlserver/../oracle_common/modules/net.sf.antcontrib_1.1.0.0_1-0b3/lib/ant-contrib.jar:/Users/raymond/oracle/wls12130/wlserver/modules/features/oracle.wls.common.nodemanager_2.0.0.0.jar:/Users/raymond/oracle/wls12130/wlserver/../oracle_common/modules/com.oracle.cie.config-wls-online_8.1.0.0.jar:/Users/raymond/oracle/wls12130/wlserver/common/derby/lib/derbyclient.jar:/Users/raymond/oracle/wls12130/wlserver/common/derby/lib/derby.jar:/Users/raymond/oracle/wls12130/wlserver/server/lib/xqrl.jar
    .
    PATH=/Users/raymond/oracle/wls12130/wlserver/server/bin:/Users/raymond/oracle/wls12130/wlserver/../oracle_common/modules/org.apache.ant_1.9.2/bin:/Library/Java/JavaVirtualMachines/jdk1.7.0_76.jdk/Contents/Home/jre/bin:/Library/Java/JavaVirtualMachines/jdk1.7.0_76.jdk/Contents/Home/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
    .
    ***************************************************
    *  To start WebLogic Server, use a username and   *
    *  password assigned to an admin-level user.  For *
    *  server administration, use the WebLogic Server *
    *  console at http://hostname:port/console        *
    ***************************************************
    starting weblogic with Java version:
    java version "1.7.0_76"
    Java(TM) SE Runtime Environment (build 1.7.0_76-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 24.76-b04, mixed mode)
    Starting WLS with line:
    /Library/Java/JavaVirtualMachines/jdk1.7.0_76.jdk/Contents/Home/bin/java -server   -Xms256m -Xmx512m -XX:CompileThreshold=8000 -XX:PermSize=128m  -XX:MaxPermSize=256m -Dweblogic.Name=myserver -Djava.security.policy=/Users/raymond/oracle/wls12130/wlserver/server/lib/weblogic.policy  -Xverify:none -Djava.endorsed.dirs=/Library/Java/JavaVirtualMachines/jdk1.7.0_76.jdk/Contents/Home/jre/lib/endorsed:/Users/raymond/oracle/wls12130/wlserver/../oracle_common/modules/endorsed  -da -Dwls.home=/Users/raymond/oracle/wls12130/wlserver/server -Dweblogic.home=/Users/raymond/oracle/wls12130/wlserver/server     -Dweblogic.utils.cmm.lowertier.ServiceDisabled=true  weblogic.Server
    <14-mei-2015 23:50:49 uur CEST> <Info> <Security> <BEA-090905> <Disabling the CryptoJ JCE Provider self-integrity check for better startup performance. To enable this check, specify -Dweblogic.security.allowCryptoJDefaultJCEVerification=true.> 
    <14-mei-2015 23:50:50 uur CEST> <Info> <Security> <BEA-090906> <Changing the default Random Number Generator in RSA CryptoJ from ECDRBG128 to FIPS186PRNG. To disable this change, specify -Dweblogic.security.allowCryptoJDefaultPRNG=true.> 
    <14-mei-2015 23:50:53 uur CEST> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) 64-Bit Server VM Version 24.76-b04 from Oracle Corporation.> 
    <14-mei-2015 23:50:56 uur CEST> <Info> <Management> <BEA-141107> <Version: WebLogic Server 12.1.3.0.0  Tue Jan 27 02:49:44 UTC 2015 1654890 > 
    <14-mei-2015 23:51:02 uur CEST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING.> 
    <14-mei-2015 23:51:02 uur CEST> <Info> <WorkManager> <BEA-002900> <Initializing self-tuning thread pool.> 
    <14-mei-2015 23:51:03 uur CEST> <Info> <WorkManager> <BEA-002942> <CMM memory level becomes 0. Setting standby thread pool size to 256.> 
    <14-mei-2015 23:51:04 uur CEST> <Notice> <Log Management> <BEA-170019> <The server log file /Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/WLSTConfigToScriptDomain/servers/myserver/logs/myserver.log is opened. All server side log events will be written to this file.> 
    <14-mei-2015 23:51:10 uur CEST> <Notice> <Security> <BEA-090082> <Security initializing using security realm myrealm.> 
    <14-mei-2015 23:51:11 uur CEST> <Warning> <Store> <BEA-280109> <The JVM was unable to load the native wlfileio library for the store "_WLS_myserver". File and paging stores will continue to function correctly. Specifically, file stores that are configured with a transactionally safe synchronous write policy will continue to operate safely and transactionally but may open with a different write-policy. Other store types may not be able to open.> 
    <14-mei-2015 23:51:14 uur CEST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STANDBY.> 
    <14-mei-2015 23:51:14 uur CEST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING.> 
    mei 14, 2015 11:51:15 PM weblogic.wsee.WseeCoreMessages logWseeServiceStarting
    INFO: The Wsee Service is starting
    <14-mei-2015 23:51:15 uur CEST> <Notice> <Log Management> <BEA-170027> <The server has successfully established a connection with the Domain level Diagnostic Service.> 
    <14-mei-2015 23:51:15 uur CEST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to ADMIN.> 
    <14-mei-2015 23:51:15 uur CEST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RESUMING.> 
    <14-mei-2015 23:51:15 uur CEST> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 192.168.1.56:7001 for protocols iiop, t3, ldap, snmp, http.> 
    <14-mei-2015 23:51:15 uur CEST> <Warning> <Server> <BEA-002611> <The hostname "localhost", maps to multiple IP addresses: 127.0.0.1, 0:0:0:0:0:0:0:1, fe80:0:0:0:0:0:0:1%1.> 
    <14-mei-2015 23:51:15 uur CEST> <Notice> <Server> <BEA-002613> <Channel "Default[2]" is now listening on 127.0.0.1:7001 for protocols iiop, t3, ldap, snmp, http.> 
    <14-mei-2015 23:51:15 uur CEST> <Notice> <Server> <BEA-002613> <Channel "Default[1]" is now listening on 0:0:0:0:0:0:0:1:7001 for protocols iiop, t3, ldap, snmp, http.> 
    <14-mei-2015 23:51:15 uur CEST> <Notice> <WebLogicServer> <BEA-000331> <Started the WebLogic Server Administration Server "myserver" for domain "mydomain" running in development mode.> 
    <14-mei-2015 23:51:15 uur CEST> <Notice> <WebLogicServer> <BEA-000360> <The server started in RUNNING mode.> 
    <14-mei-2015 23:51:15 uur CEST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING.> 
    

    First important difference is that the weblogic password is changed in : welcome1.
    Also the user raymond is not recreated. The other resources are recreated correctly.

    Finally, below the contents of the file config.py :

    """
    This is a WLST script that is generated by the WebLogic Scripting Tool (WLST)
    Configuration file converted               : /Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/config.xml
    WLST script generated to file              : /Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/config.py
    Properties file associated with the script : /Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/config.py.properties
    
    This script will first try to connect to a running server using the 
    values in the properties file. If there is no server running, WLST
    will start a server with the values in the properties file. You should change
    these values to suit your environmental needs. After running the script, 
    the server that is started(if started one) will be shutdown. 
    This might exit you from your WLST shell."""
    
    from weblogic.descriptor import BeanAlreadyExistsException
    from java.lang.reflect import UndeclaredThrowableException
    from java.lang import System
    import javax
    from javax import management
    from javax.management import MBeanException
    from javax.management import RuntimeMBeanException
    import javax.management.MBeanException
    from java.lang import UnsupportedOperationException
    
    
    def initConfigToScriptRun():
      global startedNewServer
      loadProperties("/Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/config.py.properties")
      hideDisplay()
      hideDumpStack("true")
      # try connecting to a running server if it is already running ... 
      if connected=="false":
        try:
          URL="t3://"+adminServerListenAddress+":"+adminServerListenPort
          connect(userName, passWord, URL, userConfigFile="/Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/c2sConfigmydomain", userKeyFile="/Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/c2sSecretmydomain")
        except WLSTException:
          print 'No server is running at '+URL+', the script will start a new server'
      hideDumpStack("false")
      if connected=="false":
        print 'Starting a brand new server at '+URL+' with server name '+adminServerName
        print 'Please see the server log files for startup messages available at '+domainDir
        # If a config.xml exists in the domainDir, WLST will use that config.xml to bring up the server. 
        # If you would like WLST to overwrite this directory, you should specify overWriteRootDir='true' as shown below
        # startServer(adminServerName, domName, URL, userName, passWord,domainDir, overWriteRootDir='true')
        _timeOut = Integer(TimeOut)
        # If you want to specify additional JVM arguments, set them using startServerJvmArgs in the property file or below
        _startServerJvmArgs=startServerJvmArgs
        if (_startServerJvmArgs=="" and (System.getProperty("java.vendor").find("Sun")>=0 or System.getProperty("java.vendor").find("Oracle")>=0 or System.getProperty("java.vendor").find("Hewlett")>=0)):
          _startServerJvmArgs = " -XX:MaxPermSize=256m"
        if overWriteRootDir=='true':
          startServer(adminServerName, domName, URL, userName, passWord,domainDir, timeout=_timeOut.intValue(), overWriteRootDir='true', block='true', jvmArgs=_startServerJvmArgs)
        else:
          startServer(adminServerName, domName, URL, userName, passWord,domainDir, timeout=_timeOut.intValue(), block='true', jvmArgs=_startServerJvmArgs)
        startedNewServer=1
        print "Started Server. Trying to connect to the server ... "
        connect(userName, passWord, URL, userConfigFile="/Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/c2sConfigmydomain", userKeyFile="/Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/c2sSecretmydomain")
        if connected=='false':
          stopExecution('You need to be connected.')
    
    def startTransaction():
      edit()
      startEdit()
    
    def endTransaction():
      startEdit()
      save()
      activate(block="true")
    
    from javax.management import InstanceAlreadyExistsException
    from java.lang import Exception
    from jarray import array
    
    def endOfConfigToScriptRun():
      global startedNewServer
      #Save the changes you have made
      # shutdown the server you have started
      if startedNewServer==1:
        print 'Shutting down the server that is started... '
        shutdown(force='true', block='true')
      print 'Done executing the script.'
    
    def create_Server_0(path, beanName):
      cd(path)
      try:
        print "creating mbean of type Server ... "
        theBean = cmo.lookupServer(beanName)
        if theBean == None:
          cmo.createServer(beanName)
      except java.lang.UnsupportedOperationException, usoe:
        pass
      except weblogic.descriptor.BeanAlreadyExistsException,bae:
        pass
      except java.lang.reflect.UndeclaredThrowableException,udt:
        pass
    
    def create_MigratableTarget_6(path, beanName):
      cd(path)
      try:
        print "creating mbean of type MigratableTarget ... "
        theBean = cmo.lookupMigratableTarget(beanName)
        if theBean == None:
          cmo.createMigratableTarget(beanName)
      except java.lang.UnsupportedOperationException, usoe:
        pass
      except weblogic.descriptor.BeanAlreadyExistsException,bae:
        pass
      except java.lang.reflect.UndeclaredThrowableException,udt:
        pass
    
    def create_Realm_10(path, beanName):
      cd(path)
      try:
        print "creating mbean of type Realm ... "
        theBean = cmo.lookupRealm(beanName)
        if theBean == None:
          cmo.createRealm(beanName)
      except java.lang.UnsupportedOperationException, usoe:
        pass
      except weblogic.descriptor.BeanAlreadyExistsException,bae:
        pass
      except java.lang.reflect.UndeclaredThrowableException,udt:
        pass
    
    def create_Authorizer_12(path, beanName):
      cd(path)
      try:
        print "creating mbean of type Authorizer ... "
        theBean = cmo.lookupAuthorizer(beanName)
        if theBean == None:
          cmo.createAuthorizer(beanName,"weblogic.security.providers.xacml.authorization.XACMLAuthorizer")
      except java.lang.UnsupportedOperationException, usoe:
        pass
      except weblogic.descriptor.BeanAlreadyExistsException,bae:
        pass
      except java.lang.reflect.UndeclaredThrowableException,udt:
        pass
    
    def create_Adjudicator_14(path, beanName):
      cd(path)
      try:
        print "creating mbean of type Adjudicator ... "
        theBean = cmo.getAdjudicator()
        if theBean == None:
          cmo.createAdjudicator(beanName,"weblogic.security.providers.authorization.DefaultAdjudicator")
      except java.lang.UnsupportedOperationException, usoe:
        pass
      except weblogic.descriptor.BeanAlreadyExistsException,bae:
        pass
      except java.lang.reflect.UndeclaredThrowableException,udt:
        pass
    
    def create_AuthenticationProvider_16(path, beanName):
      cd(path)
      try:
        print "creating mbean of type AuthenticationProvider ... "
        theBean = cmo.lookupAuthenticationProvider(beanName)
        if theBean == None:
          cmo.createAuthenticationProvider(beanName,"weblogic.security.providers.authentication.DefaultAuthenticator")
      except java.lang.UnsupportedOperationException, usoe:
        pass
      except weblogic.descriptor.BeanAlreadyExistsException,bae:
        pass
      except java.lang.reflect.UndeclaredThrowableException,udt:
        pass
    
    def create_CertPathProvider_20(path, beanName):
      cd(path)
      try:
        print "creating mbean of type CertPathProvider ... "
        theBean = cmo.lookupCertPathProvider(beanName)
        if theBean == None:
          cmo.createCertPathProvider(beanName,"weblogic.security.providers.pk.WebLogicCertPathProvider")
      except java.lang.UnsupportedOperationException, usoe:
        pass
      except weblogic.descriptor.BeanAlreadyExistsException,bae:
        pass
      except java.lang.reflect.UndeclaredThrowableException,udt:
        pass
    
    def create_CredentialMapper_22(path, beanName):
      cd(path)
      try:
        print "creating mbean of type CredentialMapper ... "
        theBean = cmo.lookupCredentialMapper(beanName)
        if theBean == None:
          cmo.createCredentialMapper(beanName,"weblogic.security.providers.credentials.DefaultCredentialMapper")
      except java.lang.UnsupportedOperationException, usoe:
        pass
      except weblogic.descriptor.BeanAlreadyExistsException,bae:
        pass
      except java.lang.reflect.UndeclaredThrowableException,udt:
        pass
    
    def create_RoleMapper_24(path, beanName):
      cd(path)
      try:
        print "creating mbean of type RoleMapper ... "
        theBean = cmo.lookupRoleMapper(beanName)
        if theBean == None:
          cmo.createRoleMapper(beanName,"weblogic.security.providers.xacml.authorization.XACMLRoleMapper")
      except java.lang.UnsupportedOperationException, usoe:
        pass
      except weblogic.descriptor.BeanAlreadyExistsException,bae:
        pass
      except java.lang.reflect.UndeclaredThrowableException,udt:
        pass
    
    def create_Cluster_26(path, beanName):
      cd(path)
      try:
        print "creating mbean of type Cluster ... "
        theBean = cmo.lookupCluster(beanName)
        if theBean == None:
          cmo.createCluster(beanName)
      except java.lang.UnsupportedOperationException, usoe:
        pass
      except weblogic.descriptor.BeanAlreadyExistsException,bae:
        pass
      except java.lang.reflect.UndeclaredThrowableException,udt:
        pass
    
    def create_JDBCSystemResource_28(path, beanName):
      cd(path)
      try:
        print "creating mbean of type JDBCSystemResource ... "
        theBean = cmo.lookupJDBCSystemResource(beanName)
        if theBean == None:
          cmo.createJDBCSystemResource(beanName)
      except java.lang.UnsupportedOperationException, usoe:
        pass
      except weblogic.descriptor.BeanAlreadyExistsException,bae:
        pass
      except java.lang.reflect.UndeclaredThrowableException,udt:
        pass
    
    def create_Property_30(path, beanName):
      cd(path)
      try:
        print "creating mbean of type Property ... "
        theBean = cmo.lookupProperty(beanName)
        if theBean == None:
          cmo.createProperty(beanName)
      except java.lang.UnsupportedOperationException, usoe:
        pass
      except weblogic.descriptor.BeanAlreadyExistsException,bae:
        pass
      except java.lang.reflect.UndeclaredThrowableException,udt:
        pass
      except TypeError:
        prop = cmo.createProperty()
        prop.setName(beanName)
    
    def setAttributes_JDBCConnectionPoolParams_32():
      cd("/JDBCSystemResources/TestDataSource/JDBCResource/TestDataSource/JDBCConnectionPoolParams/TestDataSource")
      print "setting attributes for mbean type JDBCConnectionPoolParams"
      set("TestTableName", "SQL ISVALID")
    
    def setAttributes_EmbeddedLDAP_33():
      cd("/EmbeddedLDAP/mydomain")
      print "setting attributes for mbean type EmbeddedLDAP"
      setEncrypted("Credential", "c2s34", "/Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/c2sConfigmydomain", "/Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/c2sSecretmydomain")
      setEncrypted("Credential", "c2s35", "/Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/c2sConfigmydomain", "/Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/c2sSecretmydomain")
    
    def setAttributesFor_DefaultIdentityAsserter_19():
      cd("/SecurityConfiguration/mydomain/Realms/myrealm/AuthenticationProviders/DefaultIdentityAsserter")
      print "setting attributes for mbean type DefaultIdentityAsserter"
      set("ActiveTypes", jarray.array(["AuthenticatedUser"], String))
    
    def setAttributes_WebServerLog_36():
      cd("/Servers/TestServer2/WebServer/TestServer2/WebServerLog/TestServer2")
      print "setting attributes for mbean type WebServerLog"
      set("NumberOfFilesLimited", "false")
    
    def setAttributes_Domain_37():
      cd("/")
      print "setting attributes for mbean type Domain"
      set("DomainVersion", "12.1.3.0.0")
      set("ConfigurationVersion", "12.1.3.0.0")
      set("AdminServerName", "myserver")
    
    def setAttributes_WebServerLog_38():
      cd("/Servers/TestServer1/WebServer/TestServer1/WebServerLog/TestServer1")
      print "setting attributes for mbean type WebServerLog"
      set("NumberOfFilesLimited", "false")
    
    def setAttributes_JTAMigratableTarget_39():
      cd("/Servers/TestServer1/JTAMigratableTarget/TestServer1")
      print "setting attributes for mbean type JTAMigratableTarget"
      bean = getMBean("/Clusters/TestCluster")
      cmo.setCluster(bean)
    
      bean = getMBean("/Servers/TestServer1")
      cmo.setUserPreferredServer(bean)
    
    
    def setAttributesFor_TestServer1_3():
      cd("/Servers/TestServer1")
      print "setting attributes for mbean type Server"
      set("ListenPort", "7003")
      set("ListenAddress", "")
      bean = getMBean("/Clusters/TestCluster")
      cmo.setCluster(bean)
    
    
    def setAttributes_JDBCDataSourceParams_40():
      cd("/JDBCSystemResources/TestDataSource/JDBCResource/TestDataSource/JDBCDataSourceParams/TestDataSource")
      print "setting attributes for mbean type JDBCDataSourceParams"
      set("GlobalTransactionsProtocol", "None")
      set("JNDINames", jarray.array(["jdbc/TestDataSource"], String))
    
    def setAttributesFor_TestServer2_5():
      cd("/Servers/TestServer2")
      print "setting attributes for mbean type Server"
      set("ListenPort", "7005")
      set("ListenAddress", "")
      bean = getMBean("/Clusters/TestCluster")
      cmo.setCluster(bean)
    
    
    def setAttributes_JDBCDriverParams_41():
      cd("/JDBCSystemResources/TestDataSource/JDBCResource/TestDataSource/JDBCDriverParams/TestDataSource")
      print "setting attributes for mbean type JDBCDriverParams"
      setEncrypted("Password", "c2s42", "/Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/c2sConfigmydomain", "/Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/c2sSecretmydomain")
      setEncrypted("Password", "c2s43", "/Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/c2sConfigmydomain", "/Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/c2sSecretmydomain")
      set("DriverName", "oracle.jdbc.OracleDriver")
      set("Url", "jdbc:oracle:thin:@//localhost:1521/XE")
    
    def setAttributes_SecurityConfiguration_44():
      cd("/SecurityConfiguration/mydomain")
      print "setting attributes for mbean type SecurityConfiguration"
      setEncrypted("Credential", "c2s45", "/Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/c2sConfigmydomain", "/Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/c2sSecretmydomain")
      setEncrypted("NodeManagerPassword", "c2s46", "/Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/c2sConfigmydomain", "/Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/c2sSecretmydomain")
      setEncrypted("NodeManagerPassword", "c2s47", "/Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/c2sConfigmydomain", "/Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/c2sSecretmydomain")
      set("NodeManagerUsername", "weblogic")
      setEncrypted("Credential", "c2s48", "/Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/c2sConfigmydomain", "/Users/raymond/oracle/wls12130/user_projects/domains/mydomain/config/c2sSecretmydomain")
    
    def setAttributesFor_TestCluster_27():
      cd("/Clusters/TestCluster")
      print "setting attributes for mbean type Cluster"
      set("ClusterMessagingMode", "unicast")
    
    def setAttributesFor_TestDataSource_29():
      cd("/JDBCSystemResources/TestDataSource")
      print "setting attributes for mbean type JDBCSystemResource"
      refBean0 = getMBean("/Clusters/TestCluster")
      theValue = jarray.array([refBean0], Class.forName("weblogic.management.configuration.TargetMBean"))
      cmo.setTargets(theValue)
    
    
    def setAttributes_JTAMigratableTarget_49():
      cd("/Servers/TestServer2/JTAMigratableTarget/TestServer2")
      print "setting attributes for mbean type JTAMigratableTarget"
      bean = getMBean("/Clusters/TestCluster")
      cmo.setCluster(bean)
    
      bean = getMBean("/Servers/TestServer2")
      cmo.setUserPreferredServer(bean)
    
    
    def setAttributesFor_user_31():
      cd("/JDBCSystemResources/TestDataSource/JDBCResource/TestDataSource/JDBCDriverParams/TestDataSource/Properties/TestDataSource/Properties/user")
      print "setting attributes for mbean type JDBCProperty"
      set("Value", "scott")
      set("Name", "user")
    
    def setAttributesFor_TestServer1__migratable__7():
      cd("/MigratableTargets/TestServer1 (migratable)")
      print "setting attributes for mbean type MigratableTarget"
      set("Notes", "This is a system generated default migratable target for a server. Do not delete manually.")
      bean = getMBean("/Clusters/TestCluster")
      cmo.setCluster(bean)
    
      bean = getMBean("/Servers/TestServer1")
      cmo.setUserPreferredServer(bean)
    
    
    def setAttributes_JDBCDataSource_50():
      cd("/JDBCSystemResources/TestDataSource/JDBCResource/TestDataSource")
      print "setting attributes for mbean type JDBCDataSource"
      set("Name", "TestDataSource")
    
    def setAttributesFor_myserver_1():
      cd("/Servers/myserver")
      print "setting attributes for mbean type Server"
      set("ListenAddress", "")
    
    def setAttributesFor_TestServer2__migratable__9():
      cd("/MigratableTargets/TestServer2 (migratable)")
      print "setting attributes for mbean type MigratableTarget"
      set("Notes", "This is a system generated default migratable target for a server. Do not delete manually.")
      bean = getMBean("/Clusters/TestCluster")
      cmo.setCluster(bean)
    
      bean = getMBean("/Servers/TestServer2")
      cmo.setUserPreferredServer(bean)
    
    
    try:
      initConfigToScriptRun()
      startTransaction()
      create_Server_0("/", "myserver")
      create_Server_0("/", "TestServer1")
      create_Server_0("/", "TestServer2")
      create_MigratableTarget_6("/", "TestServer1 (migratable)")
      create_MigratableTarget_6("/", "TestServer2 (migratable)")
      create_Realm_10("/SecurityConfiguration/mydomain", "myrealm")
      create_Authorizer_12("/SecurityConfiguration/mydomain/Realms/myrealm", "XACMLAuthorizer")
      create_Adjudicator_14("/SecurityConfiguration/mydomain/Realms/myrealm", "DefaultAdjudicator")
      create_AuthenticationProvider_16("/SecurityConfiguration/mydomain/Realms/myrealm", "DefaultAuthenticator")
      create_AuthenticationProvider_16("/SecurityConfiguration/mydomain/Realms/myrealm", "DefaultIdentityAsserter")
      create_CertPathProvider_20("/SecurityConfiguration/mydomain/Realms/myrealm", "WebLogicCertPathProvider")
      create_CredentialMapper_22("/SecurityConfiguration/mydomain/Realms/myrealm", "DefaultCredentialMapper")
      create_RoleMapper_24("/SecurityConfiguration/mydomain/Realms/myrealm", "XACMLRoleMapper")
      create_Cluster_26("/", "TestCluster")
      create_JDBCSystemResource_28("/", "TestDataSource")
      create_Property_30("/JDBCSystemResources/TestDataSource/JDBCResource/TestDataSource/JDBCDriverParams/TestDataSource/Properties/TestDataSource", "user")
      setAttributesFor_myserver_1()
      setAttributesFor_TestServer1_3()
      setAttributesFor_TestServer2_5()
      setAttributesFor_TestServer1__migratable__7()
      setAttributesFor_TestServer2__migratable__9()
      setAttributesFor_DefaultIdentityAsserter_19()
      setAttributesFor_TestCluster_27()
      setAttributesFor_TestDataSource_29()
      setAttributesFor_user_31()
      setAttributes_JDBCConnectionPoolParams_32()
      setAttributes_EmbeddedLDAP_33()
      setAttributes_WebServerLog_36()
      setAttributes_Domain_37()
      setAttributes_WebServerLog_38()
      setAttributes_JTAMigratableTarget_39()
      setAttributes_JDBCDataSourceParams_40()
      setAttributes_JDBCDriverParams_41()
      setAttributes_SecurityConfiguration_44()
      setAttributes_JTAMigratableTarget_49()
      setAttributes_JDBCDataSource_50()
      endTransaction()
    finally:
      endOfConfigToScriptRun()
    

    twitterlinkedinmailby feather

    Passing arguments to execfile()

    You can execute a python script in WLST in a couple of ways :

    • as an argument to the wlst.sh command
    • with execfile() : see here

    The first option allows you to pass arguments to the executed python script like this :

    wlst.sh <python scriptname> <argument 1><argument2>

    So let’s extend the HelloWorld.py like below :

    import sys
    connect('weblogic','Welcome01','t3://localhost:7001')
    print "Hello World from domain " + domainName + sys.argv[1] + " " + sys.argv[2]
    

    In terminal do this :

    export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_76.jdk/
    /Users/raymond/oracle/wls12130/wlserver/common/bin/wlst.sh HelloWorld.py Raymond Vermeer
    
    Initializing WebLogic Scripting Tool (WLST) ...
    
    Welcome to WebLogic Server Administration Scripting Shell
    
    Type help() for help on available commands
    
    Connecting to t3://localhost:7001 with userid weblogic ...
    Successfully connected to Admin Server "myserver" that belongs to domain "mydomain".
    
    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.
    
    Hello World from domain mydomain Raymond Vermeer
    

    The two arguments are passed to the HelloWorld script.
    If you execute the pythonscript with execfile() you can’t do this.

    export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_76.jdk/
    /Users/raymond/oracle/wls12130/wlserver/common/bin/wlst.sh
    
    Initializing WebLogic Scripting Tool (WLST) ...
    
    Welcome to WebLogic Server Administration Scripting Shell
    
    Type help() for help on available commands
    
    Connecting to t3://localhost:7001 with userid weblogic ...
    Successfully connected to Admin Server "myserver" that belongs to domain "mydomain".
    
    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.
    
    wls:/mydomain/serverConfig> execfile('HelloWorld.py' Raymond Vermeer)
    Traceback (innermost last):
      (no code object) at line 0
      File "<console>", line 1
    	execfile('HelloWorld.py' Raymond Vermeer)
    	                         ^
    SyntaxError: invalid syntax
    

    The command execfile() only accepts one argument and that is the name of the script.
    For passing argument you have to use the sys.arvg.append command.

    export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_76.jdk/
    /Users/raymond/oracle/wls12130/wlserver/common/bin/wlst.sh
    
    Initializing WebLogic Scripting Tool (WLST) ...
    
    Welcome to WebLogic Server Administration Scripting Shell
    
    Type help() for help on available commands
    
    Connecting to t3://localhost:7001 with userid weblogic ...
    Successfully connected to Admin Server "myserver" that belongs to domain "mydomain".
    
    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.
    
    wls:/mydomain/serverConfig> import sys
    wls:/mydomain/serverConfig> sys.argv.append('Raymond')
    wls:/mydomain/serverConfig> sys.argv.append('Vermeer')
    wls:/mydomain/serverConfig> execfile('HelloWorld.py')
    Connecting to t3://localhost:7001 with userid weblogic ...
    Successfully connected to Admin Server "myserver" that belongs to domain "mydomain".
    
    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.
    
    Hello World from domain mydomain Raymond Vermeer
    

    twitterlinkedinmailby feather

    Decrypt a datasource password in WLST

    If you have a working datasource but you don’t know the password to the database anymore, you can decrypt it like below. This script must be ran locally on the server where the weblogic domain is created because it needs the file SerializedSystemIni.dat.

    This file is located in the subfolder security in your domain directory.
    (/Users/raymond/oracle/wls12130/user_projects/domains/mydomain/security/SerializedSystemIni.dat)
    See : http://docs.oracle.com/cd/E29542_01/web.1111/e13707/domain.htm#SECMG413

    # decryptDS.py
    import weblogic.security.internal.SerializedSystemIni
    import weblogic.security.internal.encryption.ClearOrEncryptedService
    
    def decrypt(domainDir, encryptedPassword):
        encryptSrv = weblogic.security.internal.SerializedSystemIni.getEncryptionService(domainDir)
        ces = weblogic.security.internal.encryption.ClearOrEncryptedService(encryptSrv)
        password = ces.decrypt(encryptedPassword)
    
        print "Decrypted password is : " + password
    
    def bytearray2str(list):
            line=''
            for i in list :
                    line=line+chr(i)
            return line
    
    try:
        domainDir='/Users/raymond/oracle/wls12130/user_projects/domains/mydomain'
        dataSource='mds-soa'
        print "Datasource            : " + dataSource
    
        cd('/JDBCSystemResources/'+dataSource+'/JDBCResource/'+dataSource+'/JDBCDriverParams/'+dataSource)
    
        encryptedPassword=bytearray2str(cmo.getPasswordEncrypted())
        print "Encrypted password is : " + encryptedPassword
    
        decrypt(domainDir,encryptedPassword)
    
    except:
        print "Exception: ", sys.exc_info()[0]
        dumpStack()
        raise
    

    When you run this script you get the output below :

    macbook-raymond:scripts raymond$ export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_76.jdk/
    macbook-raymond:scripts raymond$ /Users/raymond/oracle/wls12130/wlserver/common/bin/wlst.sh decryptDS.py 
    
    Initializing WebLogic Scripting Tool (WLST) ...
    
    Welcome to WebLogic Server Administration Scripting Shell
    
    Type help() for help on available commands
    
    Datasource            : mds-soa
    Encrypted password is : {AES}f3vdkxlRDvjzhzggektZr7+EYJqWDE+oZmh0OOWR2X8=
    Decrypted password is : Welcome01
    

    twitterlinkedinmailby feather

    Encrypt and decrypt a password in WLST

    Storing a password plaintext in a WLST script is not a secure way of working. You can encrypt the password with the domain password key in the file SerializedSystemIni.dat.

    This file is located in the subfolder security in your domain directory.
    (/Users/raymond/oracle/wls12130/user_projects/domains/mydomain/security/SerializedSystemIni.dat)
    See : http://docs.oracle.com/cd/E29542_01/web.1111/e13707/domain.htm#SECMG413

    Encrypting is a bit more secure than storing passwords plain text in a file, but certainly not 100% secure. If you have (SSH) access to the machine where the weblogic domain is installed you can easily decrypt the password without having to login at the AdminServer of your domain.

    In the script below you can see how this is done.

    # crypt.py
    import weblogic.security.internal.SerializedSystemIni
    import weblogic.security.internal.encryption.ClearOrEncryptedService
    
    def decrypt(domainDir, encryptedPassword):
      encryptSrv = weblogic.security.internal.SerializedSystemIni.getEncryptionService(domainDir)
      ces = weblogic.security.internal.encryption.ClearOrEncryptedService(encryptSrv)
      password = ces.decrypt(encryptedPassword)
    
      print "Decrypted password is : " + password
    
    try:
      domainDir='/Users/raymond/oracle/wls12130/user_projects/domains/mydomain'
      plainPassword='Welcome01'
      print "Plaintext password is : " + plainPassword
    
      encryptedPassword=encrypt(plainPassword,domainDir)
      print "Encrypted password is : " + encryptedPassword
    
    decrypt(domainDir,encryptedPassword)
    
    except:
      print "Exception: ", sys.exc_info()[0]
      dumpStack()
      raise
    

    When you run this script you get the output below :

    macbook-raymond:scripts raymond$ export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_76.jdk/
    macbook-raymond:scripts raymond$ /Users/raymond/oracle/wls12130/wlserver/common/bin/wlst.sh crypt.py 
    
    Initializing WebLogic Scripting Tool (WLST) ...
    
    Welcome to WebLogic Server Administration Scripting Shell
    
    Type help() for help on available commands
    
    Plaintext password is : Welcome01
    Encrypted password is : {AES}f3vdkxlRDvjzhzggektZr7+EYJqWDE+oZmh0OOWR2X8=
    Decrypted password is : Welcome01
    

    You could use this code for example to store a datasource password encrypted in a property file and decrypt it at the moment you are creating the datasource. The only issue you have, is that you have to do the encryption locally on the server with the weblogic domain itself. Also when the password to on database changes you have to do the encryption again.

    Still not convinced this is the ideal solution…….

    Maybe this is better : https://docs.oracle.com/middleware/1213/wls/JDBCA/oraclewallet.htm#JDBCA604

    More investigation on this is needed, will be continued……..

    twitterlinkedinmailby feather