Sunday, 9 October 2016

Deploy Application war file on Weblogic Managed Server using python script

Here i will list out the steps to deploy application using python script.
I am using weblogic version 10.3.6 on OEL5.5 OS
Please download the shoppingcart.war here.
Step1:
Create python script deploy.py
2
Step2:
Run the setDomainEnv.sh
1
Step3: Deploy the Application war as below
3
Once we execute we will see the below output
[oracle@weblogic domains]$ java weblogic.WLST deploy.py
Initializing WebLogic Scripting Tool (WLST) ...
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
*** WEBLOGIC : START ***
connecting to admin server....
Connecting to t3://weblogic.localdomain:7001 with userid weblogic ...
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.
stopping and undeploying ....
deploying....
Deploying application from /tmp/shoppingcart.war to targets managedserv1 (upload=false) ...
<Apr 14, 2014 12:22:13 PM IST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, shoppingcart [archive: /tmp/shoppingcart.war], to managedserv1 .>
.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 'shoppingcart' has succeeded on 'managedserv1'
Starting application shoppingcart.
<Apr 14, 2014 12:22:18 PM IST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating start operation for application, shoppingcart [archive: null], to managedserv1 .>
.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 'shoppingcart' has succeeded on 'managedserv1'
disconnecting from admin server....
Disconnected from weblogic server: AdminServer
Exiting WebLogic Scripting Tool.
<Apr 14, 2014 12:22:21 PM IST> <Warning> <JNDI> <BEA-050001> <WLContext.close() was called in a different thread than the one in which it was created.>
[oracle@weblogic domains]$
We can access the application using url
As i deployed the application on managed server and the managed server port is 7003.
4

Install Weblogic in Silent mode using silent.xml and creating default domain server in Console mode using config.sh

Hi all,
I am going to list out the steps to install weblogic in silent mode and managed server in console mode.
First install jrocket. I installed Jrocket using console mode. I used PUTTY for the installation of Jrocket and Weblogic
[oracle@weblogic tmp]$ ./jrockit-jdk1.6.0_45-R28.2.7-4.1.0-linux-x64.bin
Extracting 0%....................................................................................................100%
Unable to instantiate GUI, defaulting to console mode.
<----------------------------------------- Oracle JRockit Installer - Oracle JRockit JDK R28.2.7 for Java SE 6 with JRMC 4.1 ----------------------------------------->
Welcome:
--------
This installer will guide you through the installation of Oracle JRockit JDK R28.2.7 for Java SE 6 with JRMC 4.1. Type "Next" or enter to proceed to the next prompt.
If you want to change data entered previously, type "Previous". You may quit the installer at any time by typing "Exit".
Enter [Exit][Next]>
<----------------------------------------- Oracle JRockit Installer - Oracle JRockit JDK R28.2.7 for Java SE 6 with JRMC 4.1 ----------------------------------------->
Choose Product Installation Directory:
--------------------------------------
"Product Installation Directory" = [Enter new value or use default "/home/oracle/jrockit-jdk1.6.0_45-R28.2.7-4.1.0"]
Enter new Product Installation Directory OR [Exit][Previous][Next]> /d01/jrockit
<----------------------------------------- Oracle JRockit Installer - Oracle JRockit JDK R28.2.7 for Java SE 6 with JRMC 4.1 ----------------------------------------->
Choose Product Installation Directory:
--------------------------------------
"Product Installation Directory" = [/d01/jrockit]
Use above value or select another option:
 1 - Enter new Product Installation Directory
 2 - Change to default [/home/oracle/jrockit-jdk1.6.0_45-R28.2.7-4.1.0]
Enter option number to select OR [Exit][Previous][Next]> 2
<----------------------------------------- Oracle JRockit Installer - Oracle JRockit JDK R28.2.7 for Java SE 6 with JRMC 4.1 ----------------------------------------->
Choose Product Installation Directory:
--------------------------------------
"Product Installation Directory" = [Enter new value or use default "/home/oracle/jrockit-jdk1.6.0_45-R28.2.7-4.1.0"]
Enter new Product Installation Directory OR [Exit][Previous][Next]> /d01/jrockit
<----------------------------------------- Oracle JRockit Installer - Oracle JRockit JDK R28.2.7 for Java SE 6 with JRMC 4.1 ----------------------------------------->
Choose Product Installation Directory:
--------------------------------------
"Product Installation Directory" = [/d01/jrockit]
Use above value or select another option:
 1 - Enter new Product Installation Directory
 2 - Change to default [/home/oracle/jrockit-jdk1.6.0_45-R28.2.7-4.1.0]
Enter option number to select OR [Exit][Previous][Next]>
<----------------------------------------- Oracle JRockit Installer - Oracle JRockit JDK R28.2.7 for Java SE 6 with JRMC 4.1 ----------------------------------------->
Optional Components 1
Do you want to install Demos and Samples?
1 - Yes, install Demos and Samples.
 ->2 - No, do not install.

Enter a number or [Exit][Previous][Next]> 2
<----------------------------------------- Oracle JRockit Installer - Oracle JRockit JDK R28.2.7 for Java SE 6 with JRMC 4.1 ----------------------------------------->
Optional Components 2
Do you want to install Source Code?
1 - Yes, install Source Code.
 ->2 - No, do not install.
Enter a number or [Exit][Previous][Next]> 2
<----------------------------------------- Oracle JRockit Installer - Oracle JRockit JDK R28.2.7 for Java SE 6 with JRMC 4.1 ----------------------------------------->
Installing JDK to /d01/jrockit...
0% 25% 50% 75% 100%
[------------|------------|------------|------------]
[***************************************************]

<----------------------------------------- Oracle JRockit Installer - Oracle JRockit JDK R28.2.7 for Java SE 6 with JRMC 4.1 ----------------------------------------->
Installing JRE to /d01/jrockit/jre...
0% 25% 50% 75% 100%
[------------|------------|------------|------------]
[***************************************************]

<----------------------------------------- Oracle JRockit Installer - Oracle JRockit JDK R28.2.7 for Java SE 6 with JRMC 4.1 ----------------------------------------->
Installation Complete
Congratulations! Oracle JRockit JDK R28.2.7 for Java SE 6 with JRMC 4.1 has been successfully installed to /d01/jrockit.
Press [Enter] to continue or type [Exit]>


<----------------------------------------- Oracle JRockit Installer - Oracle JRockit JDK R28.2.7 for Java SE 6 with JRMC 4.1 ----------------------------------------->
Clean up process in progress ...
[oracle@weblogic bin]$ export JAVA_HOME=/d01/jrockit/
Here i am using silent.xml for installation of Weblogic in silent mode.

silent.xml contents as below:
[oracle@weblogic d01]$ cat silent.xml
<?xml version="1.0" encoding="UTF-8"?>
<bea-installer>
 <input-fields>
 <data-value name="BEAHOME" value="/d01/Oracle/middleware" />
 <data-value name="WLS_INSTALL_DIR" value="/d01/Oracle/middleware/wlserver_10.3" />
 </input-fields>
</bea-installer>
[oracle@weblogic d01]$
[oracle@weblogic bin]$ export PATH=/d01/jrockit/bin:$PATH
[oracle@weblogic bin]$
[oracle@weblogic bin]$ which java
/d01/jrockit/bin/java

cd /d01/jrockit/bin/
[oracle@weblogic bin]$ java -jar /tmp/wls1036_generic.jar -mode=silent -silent_xml=/home/oracle/silent.xml
Extracting 0%....................................................................................................100%

Once the Weblogic install is finished i am configuring weblogic using config.sh
[oracle@oel bin]$ ./config.sh mode=console
Unable to instantiate GUI, defaulting to console mode.





<------------------- Fusion Middleware Configuration Wizard ------------------>

Welcome:
--------

Choose between creating and extending a domain. Based on your selection,
the Configuration Wizard guides you through the steps to generate a new or
extend an existing domain.

 ->1|Create a new WebLogic domain
 | Create a WebLogic domain in your projects directory.

 2|Extend an existing WebLogic domain
 | Use this option to add new components to an existing domain and modify |configuration settings.





Enter index number to select OR [Exit][Next]>





<------------------- Fusion Middleware Configuration Wizard ------------------>

Select Domain Source:
---------------------

Select the source from which the domain will be created. You can create the
domain by selecting from the required components or by selecting from a
list of existing domain templates.

 ->1|Choose Weblogic Platform components
 | You can choose the Weblogic component(s) that you want supported in
 |your domain.

 2|Choose custom template
 | Choose this option if you want to use an existing template. This
 |could be a custom created template using the Template Builder.





Enter index number to select OR [Exit][Previous][Next]>





<------------------- Fusion Middleware Configuration Wizard ------------------>

Application Template Selection:
-------------------------------



 Available Templates
 |_____Basic WebLogic Server Domain - 10.3.6.0 [wlserver_10.3]x
 |_____Basic WebLogic SIP Server Domain - 10.3.6.0 [wlserver_10.3] [2]
 |_____WebLogic Advanced Web Services for JAX-RPC Extension - 10.3.6.0 [wlserver_10.3] [3]
 |_____WebLogic Advanced Web Services for JAX-WS Extension - 10.3.6.0 [wlserver_10.3] [4]



Enter number exactly as it appears in brackets to toggle selection OR [Exit][Previous][Next]>





<------------------- Fusion Middleware Configuration Wizard ------------------>

Edit Domain Information:
------------------------

 | Name | Value |
 _|________|_____________|
 1| *Name: | base_domain |




Enter value for "Name" OR [Exit][Previous][Next]>





<------------------- Fusion Middleware Configuration Wizard ------------------>

Select the target domain directory for this domain:
---------------------------------------------------

 "Target Location" = [Enter new value or use default
"/d01/Oracle/middleware/user_projects/domains"]




Enter new Target Location OR [Exit][Previous][Next]>





<------------------- Fusion Middleware Configuration Wizard ------------------>

Configure Administrator User Name and Password:
-----------------------------------------------

Create a user to be assigned to the Administrator role. This user is the
default administrator used to start development mode servers.

 | Name | Value |
 _|_________________________|_________________________________________|
 1| *Name: | weblogic |
 2| *User password: | |
 3| *Confirm user password: | |
 4| Description: | This user is the default administrator. |

Use above value or select another option:
 1 - Modify "Name"
 2 - Modify "User password"
 3 - Modify "Confirm user password"
 4 - Modify "Description"




Enter option number to select OR [Exit][Previous][Next]> 2





<------------------- Fusion Middleware Configuration Wizard ------------------>

Configure Administrator User Name and Password:
-----------------------------------------------

Create a user to be assigned to the Administrator role. This user is the
default administrator used to start development mode servers.

 "*User password:" = []




Enter new *User password: OR [Exit][Reset][Accept]> weblogic1





<------------------- Fusion Middleware Configuration Wizard ------------------>

Configure Administrator User Name and Password:
-----------------------------------------------

Create a user to be assigned to the Administrator role. This user is the
default administrator used to start development mode servers.

 | Name | Value |
 _|_________________________|_________________________________________|
 1| *Name: | weblogic |
 2| *User password: | ********* |
 3| *Confirm user password: | |
 4| Description: | This user is the default administrator. |

Use above value or select another option:
 1 - Modify "Name"
 2 - Modify "User password"
 3 - Modify "Confirm user password"
 4 - Modify "Description"
 5 - Discard Changes




Enter option number to select OR [Exit][Previous][Next]> 3





<------------------- Fusion Middleware Configuration Wizard ------------------>

Configure Administrator User Name and Password:
-----------------------------------------------

Create a user to be assigned to the Administrator role. This user is the
default administrator used to start development mode servers.

 "*Confirm user password:" = []




Enter new *Confirm user password: OR [Exit][Reset][Accept]> weblogic1





<------------------- Fusion Middleware Configuration Wizard ------------------>

Configure Administrator User Name and Password:
-----------------------------------------------

Create a user to be assigned to the Administrator role. This user is the
default administrator used to start development mode servers.

 | Name | Value |
 _|_________________________|_________________________________________|
 1| *Name: | weblogic |
 2| *User password: | ********* |
 3| *Confirm user password: | ********* |
 4| Description: | This user is the default administrator. |

Use above value or select another option:
 1 - Modify "Name"
 2 - Modify "User password"
 3 - Modify "Confirm user password"
 4 - Modify "Description"
 5 - Discard Changes




Enter option number to select OR [Exit][Previous][Next]>





<------------------- Fusion Middleware Configuration Wizard ------------------>

Domain Mode Configuration:
--------------------------

Enable Development or Production Mode for this domain.

 ->1|Development Mode

 2|Production Mode




Enter index number to select OR [Exit][Previous][Next]>





<------------------- Fusion Middleware Configuration Wizard ------------------>

Java SDK Selection:
-------------------

 ->1|N/A SDK 1.7.0_45 @ /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.45.x86_64
 2|Other Java SDK




Enter index number to select OR [Exit][Previous][Next]> 2





<------------------- Fusion Middleware Configuration Wizard ------------------>

Java SDK Selection:
-------------------

 "JVM Directory" = []




Enter new JVM Directory OR [Exit][Previous][Next]> /d01/jrockit





<------------------- Fusion Middleware Configuration Wizard ------------------>

Java SDK Selection:
-------------------

 "JVM Directory" = [/d01/jrockit]




Enter new JVM Directory OR [Exit][Previous][Next]>





<------------------- Fusion Middleware Configuration Wizard ------------------>

Select Optional Configuration:
------------------------------

 1|Administration Server [ ]
 2|Managed Servers, Clusters and Machines [ ]
 3|RDBMS Security Store [ ]



Enter index number to select OR [Exit][Previous][Next]> 1





<------------------- Fusion Middleware Configuration Wizard ------------------>

Select Optional Configuration:
------------------------------

 1|Administration Server [x]
 2|Managed Servers, Clusters and Machines [ ]
 3|RDBMS Security Store [ ]



Enter index number to select OR [Exit][Previous][Next]>





<------------------- Fusion Middleware Configuration Wizard ------------------>

Configure the Administration Server:
------------------------------------

Each WebLogic Server domain must have one Administration Server. The
Administration Server is used to perform administrative tasks.

 | Name | Value |
 _|__________________|_____________________|
 1| *Name: | AdminServer |
 2| *Listen address: | All Local Addresses |
 3| Listen port: | 7001 |
 4| SSL listen port: | N/A |
 5| SSL enabled: | false |

Use above value or select another option:
 1 - Modify "Name"
 2 - Modify "Listen address"
 3 - Modify "Listen port"
 4 - Modify "SSL enabled"




Enter option number to select OR [Exit][Previous][Next]>





<------------------- Fusion Middleware Configuration Wizard ------------------>

Creating Domain...

0% 25% 50% 75% 100%
[------------|------------|------------|------------]
[***************************************************]


**** Domain Created Successfully! ****


[oracle@oel bin]$

now start the weblogic.........
[oracle@oel base_domain]$ pwd
/d01/Oracle/middleware/user_projects/domains/base_domain
[oracle@oel base_domain]$ ls
autodeploy bin config console-ext fileRealm.properties init-info lib security servers startWebLogic.sh
[oracle@oel base_domain]$ ./startWebLogic.sh
.
.
JAVA Memory arguments: -Xms512m -Xmx512m
.
WLS Start Mode=Development
.
CLASSPATH=/d01/Oracle/middleware/patch_wls1036/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/d01/Oracle/middleware/patch_ocp371/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/d01/jrockit/lib/tools.jar:/d01/Oracle/middleware/wlserver_10.3/server/lib/weblogic_sp.jar:/d01/Oracle/middleware/wlserver_10.3/server/lib/weblogic.jar:/d01/Oracle/middleware/modules/features/weblogic.server.modules_10.3.6.0.jar:/d01/Oracle/middleware/wlserver_10.3/server/lib/webservices.jar:/d01/Oracle/middleware/modules/org.apache.ant_1.7.1/lib/ant-all.jar:/d01/Oracle/middleware/modules/net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contrib.jar:/d01/Oracle/middleware/wlserver_10.3/common/derby/lib/derbyclient.jar:/d01/Oracle/middleware/wlserver_10.3/server/lib/xqrl.jar
.
PATH=/d01/Oracle/middleware/wlserver_10.3/server/bin:/d01/Oracle/middleware/modules/org.apache.ant_1.7.1/bin:/d01/jrockit/jre/bin:/d01/jrockit/bin:/d01/jrockit/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/oracle/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.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Oracle JRockit(R) (build R28.2.7-7-155314-1.6.0_45-20130329-0641-linux-x86_64, compiled mode)
Starting WLS with line:
/d01/jrockit/bin/java -jrockit -Xms512m -Xmx512m -Dweblogic.Name=AdminServer -Djava.security.policy=/d01/Oracle/middleware/wlserver_10.3/server/lib/weblogic.policy -Xverify:none -da -Dplatform.home=/d01/Oracle/middleware/wlserver_10.3 -Dwls.home=/d01/Oracle/middleware/wlserver_10.3/server -Dweblogic.home=/d01/Oracle/middleware/wlserver_10.3/server -Dweblogic.management.discover=true -Dwlw.iterativeDev= -Dwlw.testConsole= -Dwlw.logErrorsToConsole= -Dweblogic.ext.dirs=/d01/Oracle/middleware/patch_wls1036/profiles/default/sysext_manifest_classpath:/d01/Oracle/middleware/patch_ocp371/profiles/default/sysext_manifest_classpath weblogic.Server
<Apr 11, 2014 10:30:31 PM IST> <Info> <Security> <BEA-090905> <Disabling CryptoJ JCE Provider self-integrity check for better startup performance. To enable this check, specify -Dweblogic.security.allowCryptoJDefaultJCEVerification=true>
<Apr 11, 2014 10:30:32 PM IST> <Info> <Security> <BEA-090906> <Changing the default Random Number Generator in RSA CryptoJ from ECDRBG to FIPS186PRNG. To disable this change, specify -Dweblogic.security.allowCryptoJDefaultPRNG=true>
<Apr 11, 2014 10:30:33 PM IST> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Oracle JRockit(R) Version R28.2.7-7-155314-1.6.0_45-20130329-0641-linux-x86_64 from Oracle Corporation>
<Apr 11, 2014 10:30:34 PM IST> <Info> <Management> <BEA-141107> <Version: WebLogic Server 10.3.6.0 Tue Nov 15 08:52:36 PST 2011 1441050 >
<Apr 11, 2014 10:30:39 PM IST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING>
<Apr 11, 2014 10:30:39 PM IST> <Info> <WorkManager> <BEA-002900> <Initializing self-tuning thread pool>
<Apr 11, 2014 10:30:42 PM IST> <Notice> <Log Management> <BEA-170019> <The server log file /d01/Oracle/middleware/user_projects/domains/base_domain/servers/AdminServer/logs/AdminServer.log is opened. All server side log events will be written to this file.>
<Apr 11, 2014 10:30:51 PM IST> <Notice> <Security> <BEA-090082> <Security initializing using security realm myrealm.>
<Apr 11, 2014 10:31:03 PM IST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STANDBY>
<Apr 11, 2014 10:31:03 PM IST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING>
<Apr 11, 2014 10:31:04 PM IST> <Notice> <Log Management> <BEA-170027> <The Server has established connection with the Domain level Diagnostic Service successfully.>
<Apr 11, 2014 10:31:05 PM IST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to ADMIN>
<Apr 11, 2014 10:31:05 PM IST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RESUMING>
<Apr 11, 2014 10:31:06 PM IST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING>
<Apr 11, 2014 10:31:06 PM IST> <Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>
weblogic

Utility to View Weblogic Logs

Hello Everyone.
In this post I will introduce you too a utility to view Weblogic Log Files. As we know in R12.2, MiddleTier is managed by  Weblogic, to view big log files it is not that easy to view in putty.
The Weblogic Log Viewer tool can be useful for traversing log files and aid in quickly finding error messages within large log files.
You can download this tool from here

This is a small and simple but very helpful tool I developed to visualize WLS logs.


The motivation to write it came with the need to filter WLS logs by columns: it really helps to analyze logs by filtering out what is not relevant and concentrating in what is related to your problem.

It is a WIP, and currently it can only parse WLS logs (not stdouts) that use line start tag as "####".

You can filter by any of the predefined 12 columns: Time Stamp, Severity, Subsystem, Machine, Server, Thread ID, User ID, Transaction ID, Diagnostic Context, Raw Time, Message ID and Message Text.

You can also re-order the columns and resize them. There's a button to conveniently copy the contents of the selected line (only the message) to the clipboard.

Give it a try and let me know what you think. Download the jar at the end of this post and start it with java -jar WLSLogViewerApp.jar.

Download WLS Log Viewer
Download the Tool and set the application environment.
How to Use this tool.

29-10-2013 11-36-39
Choose the log file
29-10-2013 11-37-44

Select and open the log file
29-10-2013 11-39-36

29-10-2013 11-39-58
Now click on TimeStamps….
29-10-2013 11-40-17


You can see log based on time stamps
29-10-2013 11-45-18
Hope this post helps you.