Friday, September 30, 2011

Weblogic : Back Up Config.xml file


Config.xml is heart of weblogic server  and if you mess your configuration then how will you recover old configuration.

You don’t need to copy paste file on your handy drive every time when you change configuration.

Weblogic will take care of making sure you have back file maintained and created automatically for you.

Login to weblogic console

Click Domain –> Configuration –> General  (Advanced)

Check Configuration Archive Enabled and Count.

true - backups of the configuration will be made during server boot.

Change will take place after you redeploy module or restart the server


it will create following files in domain.




Web logic : Importance of Web logic.jar and Weblogic.Admin Command


web logic.Server is a java class with main method which is packed in web logic.jar , web logic server starts like any java class.

There are several ways of starting weblogic server and each way calls the main method of this class by virtual machine.

Some Gems of Weblogic.Admin Command

This command is use for administration purpose.

After setting environment  you can run following command where url , username , password is compulsory and then you can give command.

java weblogic.Admin -url localhost:7001 -username weblogic -password welcome1  [COMMAND]


Most of command are self explanatory.

SERVERLOG – Display server log file for specific server

THREAD_DUMP –  Display status of thread of weblogic server that are running.

LIST – List JNDI tree

Sunday, September 18, 2011

Weblogic : Change context path of Weblogic Console for Dev , QA , Production

Let us say if you have same physical machine and all weblogic server in your company Dev , QA , Production is located on same physical machine.
Then you will access all three console using following url

URL : DEV_PORT / Console
URL : QA_PORT / Console
URL : PROD_PORT / Console

In this *_PORT will be different for each server, but rest of the URL will be same.

Can we change “Console” context to give better differentiation apart from PORT ?
So final accessible url will be.

URL : DEV_PORT / DevConsole
URL : QA_PORT / QAConsole
URL : PROD_PORT / ProdConsole

To achieve
- Click Base_Domain or what ever domain you have.


Go to General on right side and click advanced below and change
Console Context Path to DevConsole.


Click Save , it is asking me to restart server.


Now access your console using
URL : PORT / DevConsole


Weblogic : Installation of weblogic using three different way


There are various way of installing weblogic server.

- GUI Mode

- Console Mode

- Silence Mode

1. GUI Mode

Double click the EXE file that you downloaded from oracle website.

It will come up with this screen which you can click next to provide JDK , Middleware home and finally configure weblogic server.


2. Console Mode

wls1034_win32.exe -mode=console –log=filepath

It is like installing using window command window or unix command shell.

3.Silent Mode

It is one time configuration which can be used to install weblogic on multiple machine. We need to create silent.xml file and provide all necessary information for installation including JAVA_HOME , MW_HOME etc.

wls1034_win32.exe –mode=silent –silent_xml=pathofslientfile


For further information please refer to Documentation

Since I have weblogic suite installed which contains Coherence , Oracle Enterprise Pack for Eclipse with Oracle JRocket . I have following directory structure inside Middleware Home.


Middleware Home (MW_HOME)                                    C:/…../Middleware1035

Weblogic Server home (WL_HOME)    C:/……../Middleware1035/wlserver_10.3

Node Manager Directory                  WL_HOME/server/bin/startNodeManager

Weblogic :- Switch between Sun JDK and JRockit


When we configure weblogic server , it ask to select development or production mode with Sun or JRocket JDK which are now both owned by Oracle.


Sun JDK :- It clearly says that Sun JDK on Development is better for startup and performance during iterative development.

JRocket JDK :- It do not poll for application to deploy and it is recommended for better runtime performance and management.

We should choose Sun JDK for development mode and JRocket JDK for Production Mode.

Let us say if we have Sun JDK in production mode and if we want to switch to JRocket then perform the following steps.

Go to FMW_HOME\user_projects\domains\domainname\bin

Open setDomainEnv.cmd or sh based on your environment.

There is variable called JAVA_VENDOR

set JAVA_VENDOR = Oracle (Will set JRocket)

set JAVA_VENDOR = sun (will set SUN JDK)



Here I have both BEA_JAVA_HOME and SUN_JAVA_HOME pointing to corresponding JDK.

If we set JAVA_VENDOR=”Oracle” before executing startWeblogic.cmd then BEA_JAVA_HOME will be chosen.

if we set JAVA_VENDOR=”Sun” then SUN_JAVA_HOME will be chosen else JAVA_VENDOR is default set to “Sun” as you can see.

Conclusion :-

so you can set JAVA_VENDOR in setDomainEnv.cmd or sh before above logic or you can do it externally




set JAVA_VENDOR=”Oracle”


Thursday, September 15, 2011

Download File in Oracle ADF GUI : -af:fileDownloadActionListener and getRealPath() and weblogic.xml and show-archived-real-path-enabled


I had simple requirement to allow the user to download file from ADF Application i.e. PDF file , Word file.

So I am creating simple application with commandbutton with filedownloadactionlistener.

Please download the application Download Here

I added testdownload.txt file inside ViewController\public_html folder

Command Button


I added following code to dwdFile method.

FileDownloadActionListener Method  

    public void dwdFile(FacesContext facesContext, OutputStream out) {
        FacesContext fx = FacesContext.getCurrentInstance();
        ServletContext servCtx =
        File file = new File(servCtx.getRealPath("/") + "testdownload.txt");
        FileInputStream fdwd;
        byte[] bt;
        try {
            fdwd = new FileInputStream(file);
            int checkline;
            while ((checkline = fdwd.available()) > 0) {
                bt = new byte[checkline];
                int rst =;
                out.write(bt, 0, bt.length);
                if (rst == -1)
        } catch (IOException e) {
                            "File cannot be downloaded , Please contact administrator.");
When I ran the jspx locally it downloaded the file successfully.

Deploying application as EAR


When I deployed application as ear and click the download button it did not downloaded the file and it printed null for getRealPath().


After some time I figured out that I have to generate weblogic.xml




and set the following property to true.

Enable getRealPath() results for archived web apps.






Now when I deployed the application on EAR ,it allowed me to download the file successfully.


There is known CR with Weblogic for this Issue

CR299135 -  Weblogic getRealPath Issue

Monday, September 12, 2011

ADF JSF : Stopping Auto Binding in backing Bean


When you create JSF , JSFF page in ADF you have two option.

- Do Not Automatically Expose UI Component

- Automatically Expose UI Component


Let say you selected to Automatically Expose UI Component then each component will automatically have getter and setter in Backing Bean.

If you want to get rid of that behavior in mid development which should be in standard practice from beginning then go to design view of page.

Design –> Page Properties – Component Binding –> Uncheck Auto Bind


Un check this Auto Bind for backing bean.


ADF JSF : ADFc: Scope object serialization failed (object not serializable) and Managed Bean , Backing Bean

When I was testing I noticed on web logic EM logs that there is constant exception coming every second.

Download Code from Here Download Here , After Download go to and remove Serializable and run code you will notice below exception and then implement serializable this exception will be gone.


Let me demo you precisely why this happened.

Backing Bean

This is actually BackingBean which has one to one relationship with each and every component in java file.


It has getter and setter for each component on GUI.


Here is sample GUI and if you double click button it will allow you to create action inside this backing bean.


Also, before running please don’t forget to set following java option.


org.apache.myfaces.trinidad.CHECK_STATE_SERIALIZATION – This check is disabled by default. It checks no unserializable state content on session attributes is detected

After running application when I clicked button , it simply printed button called without any exception’


Managed Bean : Practice in ADF

Generally In ADF Development developer will not create backing bean for each and every JSF , JSFF. he will instead create one Managed Bean for whole TaskFlow consisting of multiple JSFF. Each JSFF page will call that managed bean to perform it operation.


So I created new Managed Bean ( and bind it to second button then ran the application without Serializable implemented in TestSer bean it was throwing above exception from both button.

but when I implemented Serializable in then it stopped throwing above exception from both button.

Note:- I did not implements Serializable in backingBean


So please make sure you implements Serializable in this type of Managed bean॥

When you are designing an application to run in a clustered environment, you must:
Ensure that all managed beans with a life span longer than one request are serializable (that is, they implement the interface). Specifically, beans stored in session scope, page flow scope, and view scope need to be serializable.

Thursday, September 8, 2011

Weblogic : WLST Engine Location


I mentioned in previous blog about WLST and how to start using it.

However , WLST engine is located in following MW Directory.


wlst.cmd and

Wednesday, September 7, 2011

Weblogic : How to connect to weblogic using WSLT


WLST stands for Weblogic Scripting Tool that system admin use to monitor weblogic instances and domains and perform most of admin task using this tool e.g. check server status , create domain , managed server , start , stop server etc..

WSLT is based on java scripting interpreter , jython (

WSLT can be used in three ways

1) Using command line

2)Using script file (.py extension) , which can be run as

java weblogic.WLST

3)Embedding Mode

We can embed WLST in java code

import org.python.util.InteractiveInterpreter

Java  Class and Logic



How to connect to weblogic

- Open Command window.

- Set the environment for weblogic


- java weblogic.WLST


After connecting to WSLT , we can run command in two mode offline and online.

offline mode

To use offline enter command , set variables or run script at WSLT prompt.

online mode

To use it online we need to connect to weblogic server first and then use command against running server.

I connect to localhost weblogic for demo using connect command.

connect(username , pwd , t3: // url)


Note : we have security warning because it is always advisable to connect to weblogic using secure channel.

Now we are free to perform action against our connected server.

If you need help type following command , it tells how to locate all important command.


There is common phrase that before entering some thing please be well informed how to exit.

So here is command to exit WLST Window.


Now we can play around with all the WSLT command as needed.

Sunday, September 4, 2011

ADF BC : LOV Switching in ADF BC


If we have a requirement to bind multiple LOV to single attribute in ADF View object then Oracle ADF BC has LOV switcher concept to achieve it.

I will use standard HR schema ,but on top of that I will create my own table to play with LOV Switch.




Here we are going to have two LOV one that will return department id and other that  will return employee id on single attribute ID.

We have LOV_RETURN_ID field which will be check box for triggering the switch.

When I create EO/VO for LOV_SWITCH Table it generated following VO definition and I added extra transient attribute lovswitchvar.


Then you can see I added two LOV one will return employee id and other department id to ID attribute. Also , I selected List of Value Switcher as lovswitchvar.

LOV Definition can be found below.


Employee LOV


If I run the application will it work ? NO

LovReturnId :- I made LovReturnId as check box and I am comparing value of LovReturnId in lovswitchervar ,if check box is clicked then use LOV_Id otherwise use LOV_Id1.

Now add groovy express to lovswitchvar.


Run Application Module tester.

When I click + icon first time to create row check box is unchecked.

UnCheck :-  EmployeeId in LOV.


Check :-  DepartmentId in LOV.


We have used LOV switcher in ADF BC layer , we can also used on Taskflow , Page Definition.

Webcenter : Setting Custom Skin and Template as Default.


When you create web center portal project it comes with default page template and default skins.

When you create your own page template and skins then you can override that value in adf-config.xml.

Note :-  Before overriding you have to add this skins by doing "Add Portal Resource” and then go to portal-preference and change the value of skin , template and more.


Webcenter : Integrate ADF Taskflow with Portal Application


In previous blog we simply created portal application which don’t even need to be blogged , however , it is easy some time for other reader to understand the basement.

Create Simple “Fusion ADF” Application with standard HR Schema with EO/VO for Employee , Department , Job , Regions.

Create Four Taskflow with one view fragment with name emp , dept , job , regions.


Create a deployment profile as ADF lib jar for this ADF application.


Once this ADF Jar is created add it to resource pallet –> IDE Connection –> File Systems –> adflibforportal 



As we can notice jar is added to File System , Right click and click “Add to Project”


Right click portal project and see project properties and click ADF Library –> Edit.


As you can see jar contains all taskflow.


Now double click navigation in portal and add following four task flow as link with Type on Navigation side as Task Flow.


click Default navigation model and click Link and associate it with taskflow as below from resource pallet.


Sam way add all four link and finally compile and run home.jspx.

When I ran the application , I see only two link Emp and Dept where are other two link Job , Region.


Go to Jazn-Data.xml and give authentication-role to job and region taskflow as below and re run the application.


Now we can see all four hyperlink.


This demo gives an example of power of reusability and modularity in ADF application with webcenter portal.

If we use same idea for bigger project then we can create new independent ADF projects like HR , Sales , Marketing and merge to portal application in independent taskflow with proper permission.