Apr 17, 2017

Installation,configuration and deployment of ADF 12C application on Weblogic 12C

In this post I would like to cover steps for Installation ,basic configuration and deployment of ADF 12C application on weblogic 12C .

In order to do this it is necessary to have the following components:

  • Application Development Runtime (ADR) 12.1.2, 
  • Oracle Database 11g Express Edition .
  • JDK 7


Followings are the link to download above necessary file:-

1.) Java Platform (JDK) 7
2.) Application Development Runtime (12.1.2)
3.) Oracle Database Express Edition 11g Release 2

Step 1  (JDK Installation) :-

Download  and Install JDK 7 from above link . In our case we are Java SE version 7u45 , for production environment use Oracle JRockit JVM instead.

Step 2  (Oracle Database Express Edition Installation) :-


Download and Install Oracle Database Express Edition 11g Release 2.


Step 3  (ADR Installation) :-


     On command prompt use below command for extracting fmw_12.1.3.0.0_infrastructure.jar file         using java.

     Note :-

     <jdk_path>\bin\java  -jar <File_path>fmw_12.1.3.0.0_infrastructure.jar

     Example:-

     C:\Java\jdk1.7.0_45\bin\java -jar D:\fmw_infra_121200.jar
















After checking all parameter for installation , Oracle Universal Installer wizard launced.






























On 2nd step of installation wizard we should specify Oracle Home directory































On 4th step of installation wizard , check all prerequisite checks have been completed successfully.






























If all prerequisite checks is successful, finished the installation.

After completion of WebLogic Installation we have to create DB schemasby RCU utility.


 Step 4  ( Create DB schemas by RCU utility) :-

You should start RCU with the below  command

<MW_HOME_path>\oracle_common\bin\rcu

eg. :- D:\Oracle\Middleware\Oracle_Home\oracle_common\bin\rcu






















During launching RCU utility we might get an error that OS cannot found JRE location directory.

You could fix this issue by the following way:

1.) Open rcu.bat batch file in a text editor.

2.) Find lines where parameter JRE_DIR was defined, and edit it, adding path to JRE location.















3.) Save the file and launch it again.

Now create RCU , for more information of creating click on below link.

Creating Schemas with the Repository Creation Utility

RCU configuration wizard launched once we click  on rcu.bat file




























Click on next and select System Load and Product Load option.





























Click on next ,on the next step of configuration wizard we should specify Database Connection Details





























Now click Next button and the utility will make all the necessary checks and report about database
incompatibility. Click on Ignore to continue process.




























On the next step of configuration wizard, you should specify schemas prefix and select all schema in schema components tree.



On next Step specify password for schemas.





























On next Step RCU creates Tablespaces and configure tablespaces.






























After the completion of the above step of configuration wizard, click the Close button.

Step 5  (Deployment and configuration.) :-

Now we create Domain and configure domain .
To start configuration execute below command

<MW_HOME_path>\oracle_common\common\bin\config.cmd

eg. D:\Oracle\Middleware\Oracle_Home\oracle_common\common\bin\config.cmd

Specify domain name in 1st step




























On the Next step of configuration wizard,select the following options in available Templates list :-

   • Oracle Enterprise Manager - 12.1.2.0 [em]
   • Oracle JRF - 12.1.2.0 [oracle_common]
   • Weblogic Coherence Cluster Extension - 12.1.2.0 [wlserver]






























On 4th step specify Administrator Account password.




























On Next step, select Domain Mode (Production) and JDK path the same.




























On the Next step of configuration wizard, specify DB connection parameters, and RCU service table (STB) schema credentials. Click Get RCU Configuration and ensure that Connection Result Log is OK. Click Next.




























On next step select Schema and click next




























On next step test connection and click next




























On the Next step, check Administration Server, Managed servers, clusters and
coherence options. We will configure its later. Click Next.




























On next step, specify following details of Admin Server :-
    •  Address
    • Port





























On next step, Specify following details of Managed Server
   •  Name
   •  Address
   •  Port




























On the next step , click Add button to add machine as ADFMachine and then click Next.




























On next step , target AdminServer and Adf_ManagedServer to AdfMachine and
click Next.




























On the Next step, click Create button and wait until wizard will create and configure
domain. Click Finish after this.




























Now Domain creation has been completed.

Step 6  (Additional configuration of the domain and other components) :-

Now run Admin Server to configure domain from below path.

<MW_HOME_path>\user_projects\domains\<domain_name>\bin\startWebLogic.cmd

eg.
D:\Oracle\Middleware\Oracle_Home\user_projects\domains\adf_domain\bin\startWebLogic.cmd

Open WebLogic Administartion Console, on URL:
http://<host_name>:7001/console


Log in using weblogic account.

In our configuration we will not use SSL encryption in the Node Manager configuration. So to use Plain type we have to make the following steps:

1.) Go in the Domain Structure tree to Machines node. Click on our Adf_Machine and go to the     Node Manager tab.
Click Lock & Edit to edit current configuration and select Plain value of Type parameter. Click Save & Activate Changes to save current configuration.



















2.) Open nodemanager.properties file located in the following path in the text editor :-

<MW_HOME_path>\user_projects\domains\<domain_name>\nodemanager\nodemanager.properties

eg.
D:\Oracle\Middleware\Oracle_Home\user_projects\domains\adf_domain\nodemanager\nodemanager.properties

Edit SecureListener parameter, and specify it value as false.

SecureListener=false

3) Run Node Manager service, using the following command :-

<MW_HOME_path>\user_projects\domains\<domain_name>\bin\startNodeManager.cmd

eg.
D:\Oracle\Middleware\Oracle_Home\user_projects\domains\adf_domain\bin\startNodeManager.cmd

4) Restart AdminServer and make sure that the Node Manager is available and has Reachable status. You could check it in Monitoring tab and Node Manager Status tab inside it.













Step 7  (Targeting JRF libraries to managed servers) :-

Now we have to target JRF (Java Required Files) libraries to managed servers.

1) Open Enterprise Manager Console, using URL:
    http://<host_name>:7001/em
    Log in, using weblogic account.

2) Select Adf_ManagedServer in components tree. Click Apply JRF Template button. Wait until the operation is completed & Targeting libraries is complete now.

3) Now run our managed server. Select Control -> Start Up in the context menu of managed
server. Wait until the process is complete.
4) Ensure that AdminServer and all managed servers  are running. We could do this, for example, from WebLogic Administration Console.

Step 8  (Applications deployment and domain testing) :-

Now our managed server and admin server is ready to deploy our application.

We can deploy application from Admin Console or directly from Jdeveloper .


Ref :- The Specifics of ADF 12c Production Domain Deployment

Apr 15, 2017

Filter Data by date using RowQualifier in adf

Sometime we need to filter ViewObject Data by Date.

For Example :-

In Employee View Object, we need to filter Employee data having HireDate equals to Current date or any date.

So we have to use below code in method of AMImpl


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        java.util.Date date = new java.util.Date();
        String date1 = dateFormat.format(date);
        try {
            date = dateFormat.parse(date1);
        } catch (ParseException e) {
        }
        java.sql.Date sqlDate = new java.sql.Date(date.getTime());
        oracle.jbo.domain.Date dt= (new oracle.jbo.domain.Date(sqlDate));
        
        ViewObjectImpl vo = getemp1();
        RowQualifier rq = new RowQualifier(vo);
        rq.setWhereClause("HireDate=to_date('" + dt +"','yyyy-MM-dd')" );   
        Row rw[]=vo.getFilteredRows(rq);
        // rw is filtered row

In above code I have used equal to (=) operator, same way we can use all Date type operator ( <,>,=,<=,>=, between).



Apr 8, 2016

Programmatically get and set Iterator Key value from Managed Bean

Sometimes we need to set current row after performing some action like Rollback or Execute.



BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iter = (DCIteratorBinding) bindings.get("EmployeesIterator");
oracle.jbo.Key empKey = null;

// get key value of current row

                if (iter.getEstimatedRowCount() > 1) {
                    if (iter.getCurrentRow() != null) {
                        empKey = iter.getCurrentRow().getKey();
                    }
                }

// Perform action you want to do here

// set ket value of current row

            if (empKey != null) {
                iter.setCurrentRowWithKey(empKey.toStringFormat(true));
            }



Programmatically Call and execute Iterator from Managed Bean

Below code is use to get Iterator and Execute Iterator:-

BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iter= (DCIteratorBinding) bindings.get("EmployeeIterator");
iter.executeQuery();



Mar 2, 2016

Call Stored Database Function in ADF

Sometimes we need to call stored database function in ADF application.

Note :- Try to call stored database function in ApplicationModuleImpl Class or in ViewObjectImpl.

Use below method to call stored function.


import java.sql.CallableStatement;
import java.sql.SQLException;
import java.sql.Types;
import oracle.jbo.JboException;

/**Method to call Database function
     * @param sqlReturnType (Return type of Function)
     * @param stmt (Function Name with Parameters)
     * @param bindVars (Parameter's Value)
     * @return
*/

    protected Object callStoredFunction(int sqlReturnType, String stmt, Object[] bindVars) {


        CallableStatement st = null;
        try {
      //Creating sql statement
            st = this.getDBTransaction().createCallableStatement("begin ? := " + stmt + ";end;", 0);

      //Register dataType for return value
            st.registerOutParameter(1, sqlReturnType);
     //Pass input parameters value
            if (bindVars != null) {

                for (int z = 0; z < bindVars.length; z++) {

                    st.setObject(z + 2, bindVars[z]);

                }
            }

            st.executeUpdate();
      //Finally get returned value
            return st.getObject(1);
        } catch (SQLException e) {
            throw new JboException(e.getMessage());
        } finally {
            if (st != null) {
                try {
                    st.close();
                } catch (SQLException e) {
                      e.printStackTrace();
                }
            }
        }
    }


Use above callStoredFunction method in a method in Impl class and pass parameter.


public String callFunction(Integer EmployeeId){

    String EmpNm =null;



    Object obj = callStoredFunction(Types.VARCHAR, "fn_getEmpNm(?)", new Object[] {  EmployeeId     });


    if(obj!= null) {
      EmpNm =obj.toString();
    }


    return EmpNm ;
}