Wednesday, May 14, 2014

Configuring the Oracle Enterprise Repository plugins for Jdeveloper

Configuring the Oracle Enterprise Repository plugins for Jdeveloper

This post explain the steps to configure the Oracle Enterprise Repository Plugins in JDeveloper(JDeveloper version used is 11.1.1.5.0)

In JDeveloper click on Help-->Check For Updates

Select the Oracle Enterprise Repository plugins  as shown below.
The Oracle Enterprise Repository Adapter plugin will help us to access the assets and artifacts available in the Oracle Enterprise Repository .
The Oracle Enterprise Repository Harvester will help us to  harvest a Oracle SOA Suite project to the Oracle Enterprise Repository.


Click on Next and click on Finish


Restart the JDeveloper while prompted
After successful installation of the plugins you can able to to see the "Oracle Enterprise Repository Connection" as new connection type  and also right clicking the SOA project we can see "Submit Project To Enterprise Repository" and right clicking the files(XSD, WSDL) we can see "Submit File To Enterprise Repository"


Tuesday, April 15, 2014

Response is displayed in compressed form while testing the Siebel webservices from SOAP UI

Response is displayed in compressed form while testing the Siebel webservices from SOAP UI

When i am trying to test the Siebel web services from SOAP UI the response is displayed in compressed form, seems the response is return in compressed for(i am not sure this is part of some Siebel configuration)


To display the response in decompressed form, make sure the option "Accept compressed responses from hosts" option in SOAP UI preference.





Thursday, March 27, 2014

java.lang.ClassNotFoundException: oracle.adf.share.weblogic.listeners.ADFApplicationLifecycleListener

java.lang.ClassNotFoundException: oracle.adf.share.weblogic.listeners.ADFApplicationLifecycleListener

While deploying Oracle ADF application sometimes we may receive the following exception

weblogic.management.DeploymentException:
at weblogic.application.internal.flow.BaseLifecycleFlow$CreateListenerAction.run(BaseLifecycleFlow.java:184)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.application.internal.flow.BaseLifecycleFlow$BaseAction.invoke(BaseLifecycleFlow.java:112)
at weblogic.application.internal.flow.HeadLifecycleFlow.createListener(HeadLifecycleFlow.java:117)
at weblogic.application.internal.flow.HeadLifecycleFlow.createListener(HeadLifecycleFlow.java:103)
at weblogic.application.internal.flow.HeadLifecycleFlow.createListeners(HeadLifecycleFlow.java:175)
at weblogic.application.internal.flow.HeadLifecycleFlow.prepare(HeadLifecycleFlow.java:281)
at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:648)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:191)
at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:59)
at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:154)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:61)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:545)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
Caused By: java.lang.ClassNotFoundException: oracle.adf.share.weblogic.listeners.ADFApplicationLifecycleListener
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:249)
at

The issue is due to  missing ADF web Run-time libraries in the war file.This can be resolved by adding the ADF web Runtime libraries into the war file.

Steps to resolve the issue

If you are deploying through JDeveloper then follow the below steps.

Add the ADF Web Runtime to the project libraries.


Include the ADF Web Runtime library as part of the war. 
    Project Properties-->Edit the deployment profile.
    Select the ADF Web Runtime library as part of WEB-INF/lib contributors.





Wednesday, December 4, 2013

Test the REST services using Chrome

Test the REST services using Chrome

This post will explain you how to test the REST services using chrome.

Steps to test the REST services using Chrome

Install the REST Console Extension to Chrome.


Open REST Console


Here, i am invoking the REST enabled salesforce login service with OAuth.

Provide the Request URI, Content-Type and Language.
Select the Content-Type of Content Headers as application/x-www-form-urlencoded and provide the request payload.We can also add Authorization, Attachment and Headers to the request.



Monday, August 12, 2013

Removing the default rowselector column from DOJO Enhanced Grid

Removing the default rowselector column from DOJO Enhanced Grid:

Make sure the value for rowSelector is set as 0px or remove rowSelector property from the grid definition.

var grid = new dojox.grid.EnhancedGrid({
        id : gridObjectName,
        structure : layout,
        rowSelector : '0px',
        sortFields: [{attribute: defaultsort, ascending: true}],
        noDataMessage:"<span class=\"dojoxGridNoData\">No Matching Rows Found!!</span>",
        plugins : {
            indirectSelection:selection,
            pagination : {
                pageSizes : [ "25", "50", "100" ],
                description : true,
                sizeSwitch : true,
                pageStepper : true,
                gotoButton : true,
                /* page step to be displayed */
                maxPageStep : 4,
                /* position of the pagination bar */
                position : "bottom"
            }
        }
    }






Programmatically Uncheck/Check DOJO Checkboxs

Programmatically Uncheck/Check DOJO Checkboxs

The below lines of code will help us to check /uncheck set of dojo checkboxes from javascript.

dojo.forEach (dojo.query("input[type=checkbox]"), function(item){
var widget = dijit.getEnclosingWidget(item);
alert(widget)
widget.set('checked', false);
})

We can change the dojo.query parameter accordingly to fetch the checkboxes.


Thursday, August 8, 2013

Fetch Type vs Fetch Mode in Hibernate

Fetch Type vs Fetch Mode in Hibernate

Fetch type (lazy/eager) tells when Hibernate fetches the association, whether in advance when it fetches the entity (eager), or whether it waits for the code to ask for the association (lazy).

Fetch mode (select/join) refers to how Hibernate will fetch the association, i.e. does it use an extra SELECT statement, or does it use a join.

Some combinations of these make no sense, e.g. lazy+join. If you use lazy fetching, then SELECT fetch mode is the only one that you can do.If you use eager fetch, then you can choose to use either fetch mode.


Creating Validation TextArea in DOJO

Creating Validation TextArea in DOJO:

Sometimes we may need to do the validation of the data entered in TextArea but unfortunately the default TextArea provided by DOJO will not support the validation .

We can create a custom component extending both dijit.form.ValidationTextBox and dijit.form.SimpleTextarea, this will provide the functionality of both the ValidationTextBox and
SimpleTextarea.

dojo.declare(
            "ValidationTextarea",
            [dijit.form.ValidationTextBox,dijit.form.SimpleTextarea],
            {
                  postCreate: function() {
                    this.inherited(arguments);
                },
                validate: function() {
                    if (arguments.length==0) {
                    return this.validate(false);
                    }
                    return this.inherited(arguments);
                    },           
                onFocus: function() {
                    if (!this.isValid()) {
                        this.displayMessage(this.getErrorMessage());
                    }
                },
               onBlur: function() {
                    this.validate(false);
                }
             }
        );

We have to add the dojo require for ValidationTextarea  -  dojo.provide("ValidationTextarea");

Using the ValidationTextarea in jsp page:

<textarea id="clntlocn" name="clntlocn" data-dojo-type="ValidationTextarea" required="true" missingMessage="Enter the Client Location Name" rows="2" cols="20"" maxLength="50" style="resize:none"></textarea>

Now we can include all the validations applicable for dijit.form.ValidationTextBox to
ValidationTextarea.


Validating the Email address in DOJO

Validating the Email address in DOJO


<input  data-dojo-type="dijit.form.ValidationTextBox"regExpGen="dojox.validate.regexp.emailAddress" required="true" name="email"  id="email" missingMessage="Enter the Email id"> </input>

We have to add  regExpGen="dojox.validate.regexp.emailAddress" in the
dijit.form.ValidationTextBox

Also, we have to add the following dojo require

dojo.require("dojox.validate.regexp");





Handling the select event of dojo tab container

Handling the select event of dojo tab container:

<div data-dojo-type="dijit/layout/TabContainer" style="height:  400px;" id="client">
   <div id="usersTab" data-dojo-type="dijit/layout/ContentPane" title="Users" >
  
</div>
  <div id="akrTdrTab" data-dojo-type="dijit/layout/ContentPane" title="AKR/TDR" >
   </div>
</div>

Add the below code in the JSP page to handle the selection event of the tab.

<script>
      dojo.addOnLoad(function() {
             tabContainer = dijit.byId('client');
             dojo.connect(tabContainer, "selectChild",handleSelectedTabs);
     });


    function handleSelectedTabs(selectedTab){
           switch(selectedTab.id){
                  case "usersTab":searchUsersData();
                  break;
                  case "akrTdrTab":searchAkrtdrData();
                  break;
       }
}
</script>


Wednesday, August 7, 2013

Configuring the subeclipse plugin in eclipse

Configuring the subeclipse plugin in eclipse:

Subversion is a version control system, similar to CVS. Subclipse is an Eclipse plug-in that provides the functionality to interact with a Subversion server, and to manipulate a project on a Subversion server in the Eclipse environment.

 Click on Help--> Eclipse Marketplace in eclipse editor.

Search for subeclipse in the window





Click on Install and Click Next


Accept license and click on Finish



Monday, August 5, 2013

Changing the Default Maven Repository Location in Eclipse

Changing the Default Maven Repository Location in Eclipse

Sometimes we may need to change the default repository location of the maven in eclipse, the following steps will help us to do the same.

Steps to change the default repository location of the maven in eclipse

Change the repository path(location of the local repository path) in $MAVEN_HOME\conf\settings.xml file


Change the Settings.xml location in eclipse preferences

Browse the settings.xml file automatically the repository path will be displayed,Click on Apply then Click on Ok.





Setting up the Data Source in TOMCAT with Oracle Universal Connection Pool

Setting up the Data Source in TOMCAT with Oracle Universal Connection Pool :

Download ojdbc6_g.jar and ucp.jar and copy the same to $TOMCAT_HOME/lib folder.

Add the Data Source setup in $TOMCAT_HOME/conf/server.xml as follows under 

<GlobalNamingResources> tag.

  <GlobalNamingResources>

  <Resource
       name="jdbc/SampleConnectionPool"
       auth="Container"
       factory="oracle.ucp.jdbc.PoolDataSourceImpl"
       type="oracle.ucp.jdbc.PoolDataSource"
       description="Pas testing UCP Pool in Tomcat"
       connectionFactoryClassName="oracle.jdbc.pool.OracleDataSource"
       minPoolSize="2"
       maxPoolSize="5"
       inactiveConnectionTimeout="20"
       user="Sample"
       password="Sample"
       url="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)
            (HOST=localhost)(PORT=1522))(CONNECT_DATA=
            (SERVICE_NAME=SAMPLE)))"
       connectionPoolName="SampleConnectionPool"
       validateConnectionOnBorrow="true"
       sqlForValidateConnection="select 1 from DUAL" />


</GlobalNamingResources>


Change the database details accordingly.

Add Resource Link for the global JNDI resource in $TOMCAT_HOME/conf/context.xml file under <Context>.

<ResourceLink global="jdbc/SampleConnectionPool" name="jdbc/SampleConnectionPool" type="oracle.jdbc.pool.OracleDataSource"/>

Now jdbc/SampleConnectionPool can be used in the code to get the database connection.


Setting up HTTPD Server in Oracle Linux

Setting up HTTPD Server in Oracle Linux:


Pre-Requisite:

Down load tomcat-connectors-1.2.37-src.tar.gz(or latest version) and copy the file to the server

Steps to setup HTTPD Server

Login as root user(or create user for httpd an provide all the access required to install httpd) to server and execute the following commands

                             yum install httpd httpd-devel gcc gcc-c++
                             yum install make
                             yum install glibc-devel.x86_64 --disablerepo=adobe\*

CD to the folder where tomcat-connectors-1.2.37-src.tar.gz file is copied and execute the following commands
                             gunzip < tomcat-connectors-1.2.37-src.tar.gz | tar xvf –

cd /<<Base Dir >>/tomcat-connectors-1.2.37-src/native and execute the following commands

                          ./configure --with-apxs=/usr/sbin/apxs --enable-api-compatibility
                          make
                          make install

The httpd server is successfully setup now.

Start/Stop the httpd instance:

Login as root user(or the user that used to install httpd server) to server and execute
                         /etc/init.d/httpd start
                        /etc/init.d/httpd stop

The server can be accessed through http://<<Server IP>>/



Sunday, August 4, 2013

Populating DOJO dropdown list based on JSON Data

Populating DOJO dropdown list based on JSON Data:

<select data-dojo-type=dijit.form.Select data-dojo-props='name:"dcDistcode"' missingMessage="Enter the Distict code" style="width: 180px" id="dcDistcode"></select>

var data ={"identifier":"value","items":[],"label":"distcode"};
            var len = newContent.length;   
            data.items.push(dojo.mixin({"distcode": "--SELECT--"},{"value": ""}));           
               
            for(var i=0; i < len ; ++i){       
                data.items.push(dojo.mixin({"distcode": newContent[i].dcDistcode+' - '+newContent[i].dcDistname},{"value": newContent[i].dcDistcode}));           
            }
             var distStore = dojo.data.ItemFileReadStore({data: data});
             dijit.byId("dcDistcode").setStore(distStore);


identifier specifies the value for the drop down list,  label specifies the display label for the drop down list.

newContent is the JSON data received from the server.


Saturday, August 3, 2013

Converting the JSON text to Javascript Object

Converting the JSON text to Javascript Object:


We can use two approaches eval function or JSON parser 

Eval function:


var jsonText="{success:false,error: 'Invalid Data'}"  
var dataObject = eval('(' + jsonText+ ')');  
The properties can be accessed from dataObject. 
var errorMessage=dataObject.error; 
The eval function is very fast. However, it can compile and execute any 
JavaScript
program so this may create security issue, if the JSON text source is trustable
the eval function can be used 

JSON Parser:

var dataObject= JSON.parse(jsonText); 
Converting the Object to JSON String:  
var jsonText= JSON.stringify(dataObject);


Validating the DOJO form programatically from Java Script

Validating the DOJO form programatically from Java Script

Sometimes we may need to validate the dojo form programatically from java script.

<form id="createForm" data-dojo-type="dijit.form.Form" data-dojo-attach-point="form"> .......</form>

The below line of code will help us to validate the form from java script

var formResult=dijit.byId('createForm').validate();

The validation result will be true if the validation of all the filed is success else the value will be false.


Getting the selected rows from DOJO Enhanced Grid

Getting the selected rows from DOJO Enhanced Grid :

The below line of code will help us to get the selected rows of the  Enhanced grid

dijit.byId(gridId).selection.getSelected();

Getting the model value of the selected rows.

var selectedRows=dijit.byId(gridId).selection.getSelected();

for(int i=0;i<selectedRows.length;i++)
{
   selectedRows[i].empName;
}



Stopping the Busy Button in DOJO

Stopping the Busy Button in DOJO

Getting the selected rows from DOJO Enhanced Grid :

DOJO busy button will help us to display the Busy Label to user while performing some actions, sometimes we need to stop the busy label and to display the normal button back.

<button data-dojo-type="dojox.form.BusyButton" id="loginButton" style ="margin-top: 10px; margin-right: -8px;" data-dojo-props="busyLabel:'Authenticating...'" onclick="loginForm()">SignIn</button>

If we are clicking on SignIn the button label will be changed to "Authenticating..." and the user will not be able to click the button again but in case of authentication failure the button should be displayed as normal

The below line of code will help as to cancel the busy button.

dijit.byId('loginButton').cancel();   


Wednesday, February 20, 2013

Migrating the BAM objects across environments with the ANT script – Oracle BAM 11g

Migrating the BAM objects across environments with the ANT script – Oracle BAM 11g

This post explains how to use the ANT script to migrate the Oracle BAM objects across the environments.The script can be run remotely from the client machine or from the server machine.
  • Create a folder BAMConfig and create two sub folders BAMObjects and config inside the BAMConfig folder
  • Copy the BAMICommandConfig.xml from $ORACLE_HOME/bam/config folder of the server to the config folder created in the above step.
  • Add the default user name and the password to the BAMICommandConfig.xml file
           <ICommand_Default_User_Name>weblogic</ICommand_Default_User_Name>
           <ICommand_Default_Password>hiyEbs0vwXPQrKh8yE7z3f7JVNhmLLEe+cR3bansiPc=</ICommand_Default_Password>

         Also verify the ADCServerPort - the BAM Server http listening port and   ADCServerName -  BAM Server host name properties.

Content of the configuration file:

<?xml version="1.0" encoding="UTF-8"?><BAMICommand>
<ADCServerPort>9001</ADCServerPort>
<ADCServerName>BAM Server hostname</ADCServerName>
<ICommand_Default_User_Name>weblogic</ICommand_Default_User_Name>
<ICommand_Default_Password>hiyEbs0vwXPQrKh8yE7z3f7JVNhmLLEe+cR3bansiPc=</ICommand_Default_Password>
<Communication_Protocol>t3</Communication_Protocol>
<SensorFactory>oracle.bam.common.statistics.noop.SensorFactoryImpl</SensorFactory>
<GenericSatelliteChannelName>invm:topic/oracle.bam.messaging.systemobjectnotification</GenericSatelliteChannelName>
</BAMICommand>

Default password should be encrypted else you will be receiving “ICommandEngine.MissingCredentials” error.

To encrypt the password configure the BAMICommandConfig.xml file in the $ORACLE_HOME/bam/config folder with the plain text password and run any standard icommand from the server (e.g $ORACLE_HOME/bam/bin/icommand -cmd export -type dataobject -name SampleDO -file C:\temp\SampleDO.xml) that will encrypt the password.
  • Create Export_BAM_Objects.xml file with the BAM export commands and place the same in BAMConfig folder created in the above step, the contents of the file look like below
<OracleBAMCommands>
   <!--import dataobjects-->
    <Export name="/Albin/BAMWebservice" type="dataobject" file="$BAM_PROJ_HOME$/BAMWebservice.xml"/>
    <Export name="/SampleDO" type="dataobject" file="$BAM_PROJ_HOME$/SampleDO.xml"/>
</OracleBAMCommands>
Configure the required export commands (exporting different type of objects) into this file.
  • Create Import_BAM_Objects.xml file with the BAM import commands and place the same in BAMConfig folder created in the above step, the contents of the file look like below
<OracleBAMCommands>
   <!--import dataobjects-->
   <Import file="$BAM_PROJ_HOME$/BAMWebservice.xml"/>
</OracleBAMCommands>
Configure the required import commands into this file.
  • Create the BAMBuild.xml file with the following contents and place the same in the BAMConfig folder created in the above step.
<project name="BAMMigrationProject" basedir="." default="config">
   <!--import the property file-->
   <property environment="env"/>
   <property name="src.dir" value="."/>
   <property name="proj.home" value="${env.BAM_PROJ_HOME}"/>
   <property name="oracle.home" value="${env.ORACLE_HOME}"/>
   <property name="oracle.common.home" value="${env.ORACLE_COMMON_HOME}"/>
   <property name="bam.core.lib.dir" value="${env.ORACLE_HOME}/bam/modules/oracle.bam_11.1.1"/>
   <property name="bam.tp.lib.dir" value="${env.ORACLE_HOME}/bam/modules/oracle.bam.thirdparty_11.1.1"/>
   <property name="dms.lib.dir" value="${env.ORACLE_COMMON_HOME}/modules/oracle.dms_11.1.1"/>
   <!--BAM Classpath required by icommand application-->
   <path id="bamClasspath">
      <fileset file="${bam.core.lib.dir}/oracle-bam-icommand.jar"/>
      <fileset file="${bam.core.lib.dir}/oracle-bam-common.jar"/>
      <fileset file="${bam.core.lib.dir}/oracle-bam-adc-ejb.jar"/>
      <fileset file="${dms.lib.dir}/dms.jar"/>
      <fileset file="${bam.tp.lib.dir}/jgroups-core.jar"/>
      <fileset file="${bam.tp.lib.dir}/xstream-1.3.1.jar"/>
      <fileset file="${bam.tp.lib.dir}/commons-codec-1.3.jar"/>
      <fileset file="${oracle.home}/../wlserver_10.3/server/lib/weblogic.jar"/>
      <fileset file="${oracle.common.home}/modules/org.jaxen_1.1.1.jar"/>
   </path>
   <!--export BAM DOs through icommand-->
   <target name="export" description="Export BAM dataobjects and reports" depends="config">
    <delete dir="${basedir}/BAMObjects" includeemptydirs="true" includes="*/**"></delete>
      <java classname="oracle.bam.icommand.Application" fork="true" dir="${src.dir}" classpathref="bamClasspath">
         <sysproperty key="oracle.bam.debug" value="true"/>
         <arg value="-CmdFile"/>
         <arg value="${basedir}/Export_BAM_Objects.xml"/>
      </java>
   </target>
   <!--import BAM DOs through icommand-->
   <target name="import" description="Import BAM dataobjects and reports" depends="config">
      <java classname="oracle.bam.icommand.Application" fork="true" dir="${src.dir}" classpathref="bamClasspath">
         <sysproperty key="oracle.bam.debug" value="true"/>
         <arg value="-CmdFile"/>
         <arg value="${basedir}/Import_BAM_Objects.xml"/>
      </java>
   </target>
   <!--Modify bam icommand files-->
   <target name="config">
       <!--replace $project.home$ with the actual project directory inside the command file-->
      <replace file="Export_BAM_Objects.xml" token="$BAM_PROJ_HOME$" value="${basedir}/BAMObjects"/>
      <replace file="Import_BAM_Objects.xml" token="$BAM_PROJ_HOME$" value="${basedir}/BAMObjects"/>
   </target>
</project>
  • To run the scripts from the server copy the BAMConfig folder with all the contents to the server.Set the environment variables ORACLE_HOME and ORACLE_COMMON_HOME(e.gORACLE_HOME=/oracle/Middleware/Oracle_SOA1;export ORACLE_HOME;ORACLE_COMMON_HOME=oracle/Middleware/oracle_common;export ORACLE_COMMON_HOME) and also set the PATH to ANT(e.g export PATH=$PATH:$ORACLE_HOME/../modules/org.apache.ant_1.7.1/bin)
         Execute the ant scripts
          ant –f BAMBuild.xml export

        The objects will be exported based on the commands in the Export_BAM_Objects.xml as an xml file   to the BAMObjects folder

         ant –f BAMBuild.xml import

           The xml file contents will be imported to BAM based on the commands in the Import_BAM_Objects.xml
  • To run the script from the client machine the JDeveloper with the same version as the BAM server should be installed.Set the ORACLE_HOME (e.g C:\EnvSetup\MiddlewareBlog\jdeveloper) and ORACLE_COMMON_HOME(e.g C:\EnvSetup\MiddlewareBlog\oracle_common) environment variables and also set the PATH to ANT
        Copy the commons-codec-1.3.jar file from the server location   ${env.ORACLE_HOME}/bam/modules/oracle.bam.thirdparty_11.1.1 to the <JDEV_HOME>\ jdeveloper\bam\modules\oracle.bam.thirdparty_11.1.1

Run the ant script