Wednesday, June 11, 2014

Configuring JAXB2-Maven-Plugin not to clear the outputdirectory

Configuring JAXB2-Maven-Plugin not to clear the outputdirectory

JAXB2-Maven-Plugin will help us to generate the java classes from the xsd.
By default the plugin clears the existing contents in the ouputdirectory and generate the new java classes into the outputdirectory.

Some cases we may need to generate the java classes from multiple source xsd's so we have to configure the plugin not to clear the outputdirectory.

Yo have to add <clearOutputDir>false</clearOutputDir> in the plugin configuration.

<plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxb2-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>xjc</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <!-- The schema directory or xsd files. -->
                <schemaDirectory>${basedir}/src/main/resources</schemaDirectory>
                <!-- The package in which the source files will be generated. -->
                <packageName>com.service.bean.demo</packageName>
                 <clearOutputDir>false</clearOutputDir>
                <!-- The working directory to create the generated java source files. -->
                <outputDirectory>${basedir}/src/main/java</outputDirectory>
            </configuration>
        </plugin>


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();