Thursday, August 8, 2013

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



java.lang.IllegalArgumentException: Mapped Statements collection does not contain value - iBatis

java.lang.IllegalArgumentException: Mapped Statements collection does not contain value - iBatis

Sometimes we will be receiving the following exception when executing the iBatis queries.

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.tr.spm.app.persistence.mybatis.clientmgmt.ClientManagmentMapper.getTntGrpid
        at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:178)
Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.tr.spm.app.persistence.mybatis.clientmgmt.ClientManagmentMapper.getTnt
        at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:775)

The issue is due to server could not able to locate the mapper xml file.

Approaches to fix the issue

This might be due to multiple reason, the following are the some of the ways the issue can be fixed.

1. Make sure the mapper xml file is in the same location as the mapper interface



2. Make sure the mapper interface java class name and the mapper xml file is same.

3. When u are using maven make sure the xml files are getting copied when packaging. Make sure we have added the below resource entry under resources section in pom.xml

         <resource>
                <directory>src/main/java</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/*.xml</include>
                </includes>
          </resource>



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.