<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Pramati News &#38; Blogs</title>
	<atom:link href="http://server.pramati.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://server.pramati.com/blog</link>
	<description>Java, J2EE, Middleware &#38; more..</description>
	<lastBuildDate>Mon, 12 Sep 2011 17:33:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Adding multiple parameters in the request using displaytag</title>
		<link>http://server.pramati.com/blog/2011/09/12/adding-multiple-parameters-in-the-request-using-displaytag/</link>
		<comments>http://server.pramati.com/blog/2011/09/12/adding-multiple-parameters-in-the-request-using-displaytag/#comments</comments>
		<pubDate>Mon, 12 Sep 2011 17:10:50 +0000</pubDate>
		<dc:creator>vinod</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://server.pramati.com/blog/?p=414</guid>
		<description><![CDATA[I was struggled a lot and facing difficulties to add multiple parameters in the request while the displaytag option. Finally, able to find some useful links about it after a long struggle. Hence, decided to write a blog with all the possibilities together in detailed with samples.
In this blog, we have used mysql database to [...]]]></description>
			<content:encoded><![CDATA[<p>I was struggled a lot and facing difficulties to add multiple parameters in the request while the displaytag option. Finally, able to find some useful links about it after a long struggle. Hence, decided to write a blog with all the possibilities together in detailed with samples.</p>
<p>In this blog, we have used mysql database to store and retrieve the data in the application.  Database Table structure is as follows:</p>
<p>Employee:</p>
<p><code>Id INT NOT NULL AUTO_INCREMENT PRIMARY KEY<br />
FirstName VARCHAR(20)<br />
MiddleName  VARCHAR(20)<br />
LastName VARCHAR(20)<br />
Adress VARCHAR(50)<br />
City VARCHAR(30)<br />
</code></p>
<p>Upon a successful creation of a table with the above structure, inserted some sample values into the database.</p>
<p>Upon a successful access of this table from the application tier, saved the data into List as follows:</p>
<pre class="brush: java">
while(rs.next()) {
   if(list == null) {
      list = new ArrayList&lt;EmployeesResultBean&gt;();
   }
   list.add(new EmployeesResultBean(rs.getInt(1),rs.getString(2),rs.getString(3),rs.getString(4),rs.getString(5),rs.getString(6)));
}
</pre>
<pre class="brush: java">
request.setAttribute( &quot;result&quot;, list );
</pre>
<p><strong>EmployeesResultBean</strong> class is as follows:</p>
<pre class="brush: java">
public class EmployeesResultBean{
int id;
String firstName, lastName, middleName, address, city;

/**
* @return the id
*/
   public int getId() {
      return id;
   }

/**
* @param id the id to set
*/
   public void setId(int id) {
      this.id = id;
   }

/**
* @return the firstName
*/
   public String getFirstName() {
      return firstName;
   }

/**
* @param firstName the firstName to set
*/
   public void setFirstName(String firstName) {
      this.firstName = firstName;
   }

/**
* @return the lastName
*/
   public String getLastName() {
      return lastName;
   }

/**
* @param lastName the lastName to set
*/
   public void setLastName(String lastName) {
      this.lastName = lastName;
   }

/**
* @return the middleName
*/
   public String getMiddleName() {
      return middleName;
   }

/**
* @param middleName the middleName to set
*/
   public void setMiddleName(String middleName) {
      this.middleName = middleName;
   }

/**
* @return the address
*/
   public String getAddress() {
      return address;
   }

/**
* @param address the address to set
*/
   public void setAddress(String address) {
      this.address = address;
   }

/**
* @return the city
*/
   public String getCity() {
      return city;
   }

/**
* @param city the city to set
*/
   public void setCity(String city) {
      this.city = city;
   }

/**
* @param id
* @param firstName
* @param lastNamae
* @param middleName
* @param address
* @param city
*/
   public EmployeesBean(int id, String firstName, String lastName,String middleName, String address, String city) {
      super();
      this.id = id;
      this.firstName = firstName;
      this.lastName = lastName;
      this.middleName = middleName;
      this.address = address;
      this.city = city;
   }
}
</pre>
<p>Now, the result has been stored in the list and placed in the  request attribute to access further.</p>
<p>Following are the various options to display the result using displaytag options:<br />
Basic table:</p>
<pre class="brush: java">
&lt;display:table name=&quot;result&quot; /&gt;
</pre>
<p>Basic, columns:</p>
<pre class="brush: java">

&lt;display:table name=&quot;result&quot;&gt;
&lt;display:column property=&quot;id&quot; title=&quot;ID&quot; /&gt;
&lt;display:column property=&quot;firstName&quot; title=&quot;First Name&quot;/&gt;
&lt;display:column property=&quot;middleName&quot; title=&quot;Middle Name&quot;/&gt;
&lt;display:column property=&quot;lastName&quot;  title=&quot;Last Name&quot;/&gt;
&lt;display:column property=&quot;address&quot; title=&quot;Address&quot;/&gt;
&lt;display:column property=&quot;city&quot; title=&quot;City&quot;/&gt;
&lt;/display:table&gt;
</pre>
<p>Sending the value as a parameter:</p>
<pre class="brush: java">
&lt;display:table name=&quot;result&quot;&gt;
&lt;display:column property=&quot;id&quot; title=&quot;ID&quot; href=&quot;nextpage.jsp&quot; paramId=&quot;id&quot; paramProperty=&quot;id&quot;/&gt;
&lt;display:column property=&quot;firstName&quot; title=&quot;First Name&quot;/&gt;
&lt;display:column property=&quot;middleName&quot; title=&quot;Middle Name&quot;/&gt;
&lt;display:column property=&quot;lastName&quot;  title=&quot;Last Name&quot;/&gt;
&lt;display:column property=&quot;address&quot; title=&quot;Address&quot;/&gt;
&lt;display:column property=&quot;city&quot; title=&quot;City&quot;/&gt;
&lt;/display:table&gt;
</pre>
<p>The hyperlink will point to &#8216;http://&lt;$IP&gt;:&lt;$PORT&gt;/&lt;$CONTEXT&gt;/nextpage.jsp?id=&lt;$ID&gt;&#8217;</p>
<p>Sending multiple parameters for another page:</p>
<p>To implement this, we need to use a decorator that can be used to create dynamic links on the fly so that you can either click on a particular column value and &#8220;drill down&#8221; for more information, or you can create a column of text labels which are hyperlinks that perform some action on the object in that row. These dynamic links can be created based on some primary key of the object, or they can make use of the object List index.</p>
<pre class="brush: java">
&lt;display:table name=&quot;result&quot; pagesize=&quot;15&quot; decorator=&quot;com.samples.LinkDecorator&quot;&gt;
&lt;display:column property=&quot;link&quot; title=&quot;ID&quot; /&gt;
&lt;display:column property=&quot;firstName&quot; title=&quot;First Name&quot;/&gt;
&lt;display:column property=&quot;middleName&quot; title=&quot;Middle Name&quot;/&gt;
&lt;display:column property=&quot;lastName&quot;  title=&quot;Last Name&quot;/&gt;
&lt;display:column property=&quot;address&quot; title=&quot;Address&quot;/&gt;
&lt;display:column property=&quot;city&quot; title=&quot;City&quot;/&gt;
&lt;/display:table&gt;
</pre>
<p>If we have observed clearly, we have used the property called &#8216;link&#8217; and the decorator class &#8216;com.samples.LinkDecorator&#8217;. So, the decorator class appears as follows:</p>
<pre class="brush: java">
package com.samples;
import org.displaytag.decorator.TableDecorator;

/**
* @author vinod@pramati.com
* Sep 11, 2011
*/
public class LinkDecorator extends TableDecorator {
   public String getLink(){
      EmployeesBean empData = (EmployeesBean) getCurrentRowObject();
      String link = &quot;&lt;a href=\&quot;nextpage.jsp?id=&quot; + empData.getId() + &quot;&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;fname=&quot;+ empData.getFirstName()+&quot;\&quot;&gt;&quot; + empData.getId() +&quot;&lt;/a&gt;&quot;;
      return link;
   }
}
</pre>
<p>The hyperlink(ID) will point to &#8216;http://&lt;$IP&gt;:&lt;$PORT&gt;/&lt;$CONTEXT&gt;/nextpage.jsp?id=&lt;$ID&gt;&amp;fname=&lt;$FirstName&gt;&#8217;</p>
<p>Display using the group of details:</p>
<p>In this scenario, assume need to display the data based on city and first name. For this, the display tag appears as:</p>
<pre class="brush: java">
&lt;display:table name=&quot;result&quot;&gt;
&lt;display:column property=&quot;id&quot; title=&quot;ID&quot; href=&quot;nextpage.jsp&quot; paramId=&quot;id&quot; paramProperty=&quot;id&quot;/&gt;
&lt;display:column property=&quot;firstName&quot; title=&quot;First Name&quot; group=&quot;2&quot;/&gt;
&lt;display:column property=&quot;middleName&quot; title=&quot;Middle Name&quot;/&gt;
&lt;display:column property=&quot;lastName&quot;  title=&quot;Last Name&quot;/&gt;
&lt;display:column property=&quot;address&quot; title=&quot;Address&quot;/&gt;
&lt;display:column property=&quot;city&quot; title=&quot;City&quot; group=&quot;1&quot;/&gt;
&lt;/display:table&gt;
</pre>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fserver.pramati.com%2Fblog%2F2011%2F09%2F12%2Fadding-multiple-parameters-in-the-request-using-displaytag%2F', 'Adding+multiple+parameters+in+the+request+using+displaytag')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fserver.pramati.com%2Fblog%2F2011%2F09%2F12%2Fadding-multiple-parameters-in-the-request-using-displaytag%2F', title: '+Adding+multiple+parameters+in+the+request+using+displaytag+' })"/></div>]]></content:encoded>
			<wfw:commentRss>http://server.pramati.com/blog/2011/09/12/adding-multiple-parameters-in-the-request-using-displaytag/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Specified VM Args like Xmx in the java command multiple times</title>
		<link>http://server.pramati.com/blog/2011/07/07/specified-vm-args-like-xmx-in-the-java-command-multiple-times/</link>
		<comments>http://server.pramati.com/blog/2011/07/07/specified-vm-args-like-xmx-in-the-java-command-multiple-times/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 09:23:50 +0000</pubDate>
		<dc:creator>vinod</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[java command]]></category>
		<category><![CDATA[Xmx]]></category>

		<guid isPermaLink="false">http://server.pramati.com/blog/?p=408</guid>
		<description><![CDATA[One day during the discussion with our colleagues received the following query:
Q:
If we specify -Xms and -Xmx values twice/more in the java command, which one will reflect?
We thought for some time and come out with different answers for the same. Hence, decided to test in detailed for the proper answer. Hence, started the testing as [...]]]></description>
			<content:encoded><![CDATA[<p>One day during the discussion with our colleagues received the following query:</p>
<p>Q:</p>
<p>If we specify -Xms and -Xmx values twice/more in the java command, which one will reflect?</p>
<p>We thought for some time and come out with different answers for the same. Hence, decided to test in detailed for the proper answer. Hence, started the testing as follows:</p>
<p>1. java -Xms256m -Xmx256m -XX:PermSize=128m -XX:MaxPermSize=256m -Xms256m -Xmx256m Test</p>
<p>Fortunatly, we are using JDK 1.6 which contains jconsole utility to identify the memory utilization details. We see the following:</p>
<p>Maximum heap size: 253,440 kbytes</p>
<p>2. java -Xms256m -Xmx256m -XX:PermSize=128m -XX:MaxPermSize=256m -Xms256m -Xmx512m Test</p>
<p>Maximum heap size: 506,816 kbytes</p>
<p>3. java -Xms256m -Xmx256m -XX:PermSize=128m -XX:MaxPermSize=256m -Xms256m -Xmx1024m Test</p>
<p>Maximum heap size: 1,013,632 kbytes</p>
<p>4. java -Xms256m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=256m -Xms256m -Xmx256m Test</p>
<p>Maximum heap size: 253,440 kbytes</p>
<p>5. java -Xms256m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=256m -Xms256m -Xmx256m Test</p>
<p>Maximum heap size: 253,440 kbytes</p>
<p>6. java -Xms256m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=256m -Xms512m -Xmx512m -Xms256m -Xmx256m Test</p>
<p>Maximum heap size: 253,440 kbytes</p>
<p>From the above experiment, it confirms that the Xms and Xmx values are reflected which comes in the last position of command. From this, it appears that the values are pushed in to the stack and pop the values using LIFO method.</p>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fserver.pramati.com%2Fblog%2F2011%2F07%2F07%2Fspecified-vm-args-like-xmx-in-the-java-command-multiple-times%2F', 'Specified+VM+Args+like+Xmx+in+the+java+command+multiple+times')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fserver.pramati.com%2Fblog%2F2011%2F07%2F07%2Fspecified-vm-args-like-xmx-in-the-java-command-multiple-times%2F', title: '+Specified+VM+Args+like+Xmx+in+the+java+command+multiple+times+' })"/></div>]]></content:encoded>
			<wfw:commentRss>http://server.pramati.com/blog/2011/07/07/specified-vm-args-like-xmx-in-the-java-command-multiple-times/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Customize MySQL data directory from default location to user defined location</title>
		<link>http://server.pramati.com/blog/2011/06/06/customize-mysql-data-directory-from-default-location-to-user-defined-location/</link>
		<comments>http://server.pramati.com/blog/2011/06/06/customize-mysql-data-directory-from-default-location-to-user-defined-location/#comments</comments>
		<pubDate>Mon, 06 Jun 2011 08:34:14 +0000</pubDate>
		<dc:creator>vinod</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[modify the location of mysql]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://server.pramati.com/blog/?p=401</guid>
		<description><![CDATA[MySQL  is a widely used open source database. Generally, the data stored in the database is very huge. Depends on the information stored in the database, most of the times user faces an issue with the space allocated for the default partition. In the scenario of running out of space, need to move the [...]]]></description>
			<content:encoded><![CDATA[<p><em>MySQL </em> is a widely used open source database. Generally, the data stored in the database is very huge. Depends on the information stored in the database, most of the times user faces an issue with the space allocated for the default partition. In the scenario of running out of space, need to move the data directory from default location to user specific location. This is a short little guide to show you how to move mysql to another partition on the system.<br />
<code><br />
1. Collect complete backup of current database using </code></p>
<p><code><strong>mysqldump -u root -p --all-databases &gt; &lt;$TEMP-DIR&gt;/mysqldump.sql</strong></code></p>
<p><code>2. Now, stop mysql service using '<strong>/etc/init.d/mysqld stop</strong>'.<br />
3. By default, MySQL data directory is <strong>/var/lib/mysql</strong>. Hence, copy MySQL directory to custom location using '<strong>cp -R /var/lib/mysql &lt;$CUSTOM-DIR&gt;</strong>'<br />
4. Modify the owner to mysql using '<strong>chown -R mysql:mysql &lt;$CUSTOM-DIR&gt;/mysql</strong>'(Installed directory owner should equal to the user specified in the my.cnf file. By default 'mysql' is the user specified in the file).<br />
5. Remove <em>ibdata1</em>,<em>ib_logfile0</em> and <em>ib_logfile1</em> if exist under '&lt;$CUSTOM-DIR&gt;/mysql' directory.<br />
6. Now, edit '<strong>/etc/my.cnf</strong>' file and modify the datadir value to custom directory as '<em><strong>datadir = &lt;$CUSTOM-DIR&gt;/mysql</strong></em>'.</code></p>
<p><span style="text-decoration: underline;"><em><code>Sample my.cnf file for reference:</code></em></span></p>
<p><code><strong><br />
[mysqld]<br />
#datadir=/var/lib/mysql<br />
datadir=&lt;$CUSTOM-DIR&gt;/mysql<br />
socket=/var/lib/mysql/mysql.sock<br />
user=mysql<br />
# Default to using old password format for compatibility with mysql 3.x<br />
# clients (those using the mysqlclient10 compatibility package).<br />
old_passwords=1</strong></code><strong></strong><br />
<strong><code><br />
[mysqld_safe]<br />
log-error=&lt;$CUSTOM-DIR&gt;/mysql/logs/startmysql.log<br />
pid-file=/var/run/mysqld/mysqld.pid<br />
</code></strong><br />
7. Start mysql service using &#8216;<strong>/etc/init.d/mysqld start</strong>&#8216;.<br />
<strong><br />
Known issues:</strong></p>
<p>1.</p>
<p><code>110215 11:30:11 [ERROR] /usr/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13)<br />
110215 11:30:11 [ERROR] /usr/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13)<br />
110215 11:30:11 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)</code></p>
<p>Sol:</p>
<p>Check the permissions for configured directory. Owner for this directory should be a mysql instead of root.</p>
<p>2.<br />
<code><br />
# /etc/init.d/mysqld start<br />
Timeout error occurred trying to start MySQL Daemon.<br />
Starting MySQL:                                            [FAILED]</code><br />
<code><br />
During the access of Database :</code></p>
<p><code>ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)</code></p>
<p>Sol:</p>
<p>If no exceptions are reported in the log file at this point of time, cross check the mysql.sock path in /etc/my.cnf file. It should point to /var/lib/mysql/mysql.sock. Should not modify this path and also verify the existance of mysql directory in the specified location.</p>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fserver.pramati.com%2Fblog%2F2011%2F06%2F06%2Fcustomize-mysql-data-directory-from-default-location-to-user-defined-location%2F', 'Customize+MySQL+data+directory+from+default+location+to+user+defined+location')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fserver.pramati.com%2Fblog%2F2011%2F06%2F06%2Fcustomize-mysql-data-directory-from-default-location-to-user-defined-location%2F', title: '+Customize+MySQL+data+directory+from+default+location+to+user+defined+location+' })"/></div>]]></content:encoded>
			<wfw:commentRss>http://server.pramati.com/blog/2011/06/06/customize-mysql-data-directory-from-default-location-to-user-defined-location/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Memory Leak with Oracle 10g JDBC drivers</title>
		<link>http://server.pramati.com/blog/2010/12/14/memory-leak-with-oracle-10g-jdbc-drivers/</link>
		<comments>http://server.pramati.com/blog/2010/12/14/memory-leak-with-oracle-10g-jdbc-drivers/#comments</comments>
		<pubDate>Tue, 14 Dec 2010 11:32:28 +0000</pubDate>
		<dc:creator>Ravikiran Noothi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://server.pramati.com/blog/?p=344</guid>
		<description><![CDATA[When Application server’s prepared statement cache is enabled with Oracle 10g JDBC driver, few of our customers reported high memory usage as well as memory leaks in some cases. We have observed that the prepared statements returned back to server cache still hold onto the result set values, even on closing the Result Set.
Memory architectures [...]]]></description>
			<content:encoded><![CDATA[<p>When Application server’s prepared statement cache is enabled with Oracle 10g JDBC driver, few of our customers reported high memory usage as well as memory leaks in some cases. We have observed that the prepared statements returned back to server cache still hold onto the result set values, even on closing the Result Set.</p>
<p>Memory architectures of 9i and 10g drivers are completely different. Since  10g, prepared statements hold the fetched result set values even after  closing the result set. This is done to make subsequent query executions  faster, as releasing the memory back to the system and acquiring it in the next execution cycle is very expensive. You can find more explanation in the <a href="http://www.oracle.com/technetwork/database/enterprise-edition/memory.pdf">document</a>.</p>
<p>Let us consider a situation, where we have around 100 connections in  the pool and each connection has a statement cache of size 100, and  assume 100 result set rows have been cached, each of 1KB. Each prepared  statement would hold on to 100KB of results and for each connection  ~10MB (100 x 100KB). And for the entire pool of connections it would be  close to ~1GB (100 x 10MB). This explains the high memory usage situation with Oracle 10g drivers.</p>
<p>Oracle driver’s Implicit cache implementation seems to workaround  this problem, by clearing up the Result Set values through an additional  configuration parameter.</p>
<p><strong>Implicit Statement Cache</strong></p>
<p>Implicit cache is provided by the JDBC Driver implementation and when enabled, implicitly caches the prepared  statement objects. But, Implicit statement cache stores only meta data  not the statement data and state required for a prepared statement.  Oracle driver documentation discusses about performance degradation when  using Implicit cache. We verified this by comparing the standard  performance benchmark SpecjAppServer 2004 with Application Server caching against Oracle’s implicit cache.<strong> </strong></p>
<p><strong>Memory Leak Fix</strong></p>
<p><strong>For 10g driver</strong><br />
Oracle implicit statement cache provides connection property, <code>oracle.jdbc.FreeMemoryOnEnterImplicitCache</code> which when set to true clears the cached result set values, when the  statement is returned back to cache. The following are the comparison  results for SpecJ benchmark, and we haven’t observed any considerable  performance degradation using Driver’s implicit cache.</p>
<p><strong>SpecJ Results comparison with Server Statement Cache and Oracle Implicit Statement Cache</strong></p>
<p><img src="http://server.pramati.com/blog/wp-content/uploads/2011/03/SpecJSummary.png" alt="SpecJSummary" width="375" height="300" class="alignnone size-full wp-image-388" /></p>
<p><img src="http://server.pramati.com/blog/wp-content/uploads/2011/03/DealerSummary.png" alt="DealerSummary" width="375" height="300" class="alignnone size-full wp-image-389" /></p>
<p><strong>For 11g driver</strong><br />
From 11g driver onwards there is no need to set <code>oracle.jdbc.FreeMemoryOnEnterImplicitCache</code> connection property to true. If we use implicit statement cache, automatically result set values are cleared.</p>
<p><strong>Conclusion</strong><br />
To avoid oracle driver’s memory leak  issue in pramati server,</p>
<p>1. Enable oracle implicit statement cache by writing a custom validator class.<br />
2. Set pramati server’s statement cache size to zero and add the    connection initialization validator class.<br />
3. Pass the <code>oracle.jdbc.FreeMemoryOnEnterImplicitCache</code> property or as one of connection property(this property is applicable only for 10.2.0.4.0 jdbc drivers).</p>
<p>In the connection intialialization validator class, we could add below code to enable the Oracle Implicit Cache,</p>
<pre class="brush: java">
public class CustomConnectionValidator implements ObjectValidator {

    public boolean isValid(Object obj) {
        System.out.println(&quot;Custom Connection Validation&quot;);
        try {
            OracleConnection ocon = (OracleConnection)obj;
            ocon.setImplicitCachingEnabled(true);
            ocon.setStatementCacheSize(300);
        } catch (Throwable e) {
            e.printStackTrace();
        }
        return true;
    }

    public int getModeOfValidation() {
        return CHECK_UNTIL_INVALID;
    }
}
</pre>
<p>Make the statement cache size as zero and add the connection intialization validator class,</p>
<pre class="brush: java">
&lt;datasource connection-factory=&quot;cf&quot; description=&quot;No Description&quot;
         name=&quot;ds_spec&quot; system-managed=&quot;false&quot; transaction-isolation=&quot;&quot;
         transaction-participation=&quot;true&quot;&gt;
     &lt;pool-properties cache-size=&quot;0&quot; connection-request-timeout-seconds=&quot;&quot;
         idle-timeout-seconds=&quot;&quot; initial-pool-size=&quot;100&quot;
         max-pool-size=&quot;100&quot; min-pool-size=&quot;100&quot;
         refresh-interval-seconds=&quot;5600&quot;/&gt;
     &lt;connection-initialization class=&quot;CustomConnectionValidator&quot;
         db-retrials=&quot;0&quot; db-retry-interval-millis=&quot;0&quot;/&gt;
     &lt;connection-validation on-acquire=&quot;false&quot; on-release=&quot;false&quot; sql=&quot;&quot;/&gt;
     &lt;connection-tracking enable=&quot;false&quot;/&gt;
 &lt;/datasource&gt;
</pre>
<p>We should pass <code>oracle.jdbc.FreeMemoryOnEnterImplicitCache</code> property as one of connection property for connection factory as follows,</p>
<pre class="brush: java">
&lt;connection-factory authorized-by=&quot;container&quot; classname=&quot;oracle.jdbc.driver.OracleDriver&quot;
         classpath=&quot;&quot; description=&quot;No Description&quot; name=&quot;cf&quot;
         url=&quot;jdbc:oracle:thin:@192.168.1.81:1521:specdb&quot;&gt;
    &lt;login-parameters mask-password=&quot;true&quot; password=&quot;dGlnZXI=&quot; user=&quot;scott&quot;/&gt;
    &lt;properties&gt;
        &lt;property name=&quot;protocol&quot; value=&quot;thin&quot;/&gt;
&lt;property name=&quot;oracle.jdbc.freeMemoryOnEnterImplicitCache&quot; value=&quot;true&quot;/&gt;
    &lt;/properties&gt;
 &lt;/connection-factory&gt;
</pre>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fserver.pramati.com%2Fblog%2F2010%2F12%2F14%2Fmemory-leak-with-oracle-10g-jdbc-drivers%2F', 'Memory+Leak+with+Oracle+10g+JDBC+drivers')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fserver.pramati.com%2Fblog%2F2010%2F12%2F14%2Fmemory-leak-with-oracle-10g-jdbc-drivers%2F', title: '+Memory+Leak+with+Oracle+10g+JDBC+drivers+' })"/></div>]]></content:encoded>
			<wfw:commentRss>http://server.pramati.com/blog/2010/12/14/memory-leak-with-oracle-10g-jdbc-drivers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Server socket JVM_Bind issue in Windows Vista</title>
		<link>http://server.pramati.com/blog/2010/11/02/server-socket-jvm_bind-issue-in-windows-vista/</link>
		<comments>http://server.pramati.com/blog/2010/11/02/server-socket-jvm_bind-issue-in-windows-vista/#comments</comments>
		<pubDate>Tue, 02 Nov 2010 11:09:31 +0000</pubDate>
		<dc:creator>Ravikiran Noothi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://server.pramati.com/blog/?p=272</guid>
		<description><![CDATA[Recently, one of our customers reported an “Unrecognized Windows Sockets error: 0: JVM_Bind” during application deployment.

Exception in thread &#34;main&#34; java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
at java.net.ServerSocket.bind(ServerSocket.java:319)
at java.net.ServerSocket.&#60;init&#62;(ServerSocket.java:185)
at java.net.ServerSocket.&#60;init&#62;(ServerSocket.java:97)
......

From the exception stack trace it is evident that the Server socket is bound to an already used up port. In our case it [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, one of our customers reported an “<strong>Unrecognized Windows Sockets error: 0: JVM_Bind</strong>” during application deployment.</p>
<pre class="brush: java">
Exception in thread &quot;main&quot; java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
at java.net.ServerSocket.bind(ServerSocket.java:319)
at java.net.ServerSocket.&lt;init&gt;(ServerSocket.java:185)
at java.net.ServerSocket.&lt;init&gt;(ServerSocket.java:97)
......
</pre>
<p>From the exception stack trace it is evident that the Server socket is bound to an already used up port. In our case it was re-deployment which is failing, so we took <code>netstat</code> after the first successful deployment. In the netstat report, to our  surprise we observed that the port is bound to two different network  interfaces.</p>
<pre class="brush: java">
Active Connections
TCP    0.0.0.0:4445           test:0           LISTENING
TCP    [::]:4445              test:0           LISTENING
</pre>
<p>The is because, on Windows Vista every socket is bound to both IPv4  and IPv6 network interfaces by default. (IPv6 interface is denoted by  the [::] convention in the output).</p>
<p><code>netstat</code> report after stopping the application, still shows the port listening on the IPv6 interface.</p>
<pre class="brush: java">
Active Connections
TCP    [::]:4445               test:0          LISTENING
</pre>
<p>This clearly indicates that the port is not getting released from the  IPv6 interface on stopping the application. Hence, the second  deployment which uses the same port fails.</p>
<p>Windows XP, 2003 or 2008 by default comes with IPv4 network interface  only, where as Vista comes with both IPv4 and IPv6 interfaces enabled.  When the Server socket is created without any bind address, the socket is bound to all  the network interfaces available on the system. To find out all the  interfaces available on a system we can use JDK’s <code>NetworkInterface.getNetworkInterfaces()</code> method. The following is the output on XP and Vista systems respectively,</p>
<p>XP:</p>
<pre class="brush: java">
MS TCP Loopback interface
Host Name : localhost                         Addresss : 127.0.0.1

Broadcom NetXtreme 57xx Gigabit Controller - Packet Scheduler Miniport
Host Name : test-n.pramati.com                Addresss : 192.168.1.31
</pre>
<p>Vista:</p>
<pre class="brush: java">
Software Loopback Interface 1
Host Name : 0:0:0:0:0:0:0:1                  Addresss : 0:0:0:0:0:0:0:1
Host Name : 127.0.0.1                        Addresss : 127.0.0.1

Realtek RTL8169/8110 Family PCI Gigabit Ethernet NIC (NDIS 6.0)
Host Name : fe80:0:0:0:c00a:dda9:3eb8:49ac%8   Addresss : fe80:0:0:0:c00a:dda9:3eb8:49ac%8
Host Name : test.pramati.com                 Addresss : 192.168.1.82
</pre>
<p>After going through the JDK bugs database, we found bug ID <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6598160">6598160</a> reported. To understand the above issue, let us try the example quoted in the bug description,</p>
<pre class="brush: java">
ServerSocket ss = null;
try {
   ss = new ServerSocket(5252);
   Runtime.getRuntime().exec(new String[] {&quot;notepad.exe&quot;});
   System.in.read();
} finally  {
   ss.close();
}
</pre>
<p>While running the above code on Windows Vista, notepad application is  opened and socket doesn’t close until we press a key and enter. Taking <code>netstat </code>before stopping the process, we can see port 5252 listening on all available network interfaces,</p>
<pre class="brush: java">
Active Connections
TCP    0.0.0.0:5252           test:0           LISTENING
TCP    [::]:5252              test:0           LISTENING
</pre>
<p>After stopping the process, but not closing the launched notepad application, <code>netstat </code>still shows the port 5252 listening on IPv6 interface. This is an issue with JDK 1.6 on Windows with IPv6 enabled.</p>
<pre class="brush: java">
Active Connections
TCP    [::]:5252               test:0           LISTENING
</pre>
<p>This is because in JDK for Vista, IPv4 socket has it’s handles set to  non-inherit while creation, but not for the IPv6 stack. So, this allows  the child process i.e. notepad, to inherit the handle to the socket for  IPv6 interfaces. So, while child process is still alive, even if the  parent process stops  port is still not freed. As soon as notepad is  closed, port is released on IPv6 interfaces.</p>
<p>We can run java application with system property <code>-Djava.net.preferIPv4Stack=true</code> to avoid socket listening on IPv6 interfaces, but this will make the  application not able to communicate through IPv6 protocol. This issue  has been fixed in JDK 1.6 update 10 on Windows.</p>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fserver.pramati.com%2Fblog%2F2010%2F11%2F02%2Fserver-socket-jvm_bind-issue-in-windows-vista%2F', 'Server+socket+JVM_Bind+issue+in+Windows+Vista')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fserver.pramati.com%2Fblog%2F2010%2F11%2F02%2Fserver-socket-jvm_bind-issue-in-windows-vista%2F', title: '+Server+socket+JVM_Bind+issue+in+Windows+Vista+' })"/></div>]]></content:encoded>
			<wfw:commentRss>http://server.pramati.com/blog/2010/11/02/server-socket-jvm_bind-issue-in-windows-vista/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disabling Unsafe SSL Session Renegotiation on Pramati Server</title>
		<link>http://server.pramati.com/blog/2010/08/10/disabling-unsafe-ssl-session-renegotiation-on-pramati-server/</link>
		<comments>http://server.pramati.com/blog/2010/08/10/disabling-unsafe-ssl-session-renegotiation-on-pramati-server/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 06:50:22 +0000</pubDate>
		<dc:creator>tribikram</dc:creator>
				<category><![CDATA[Pramati Server]]></category>

		<guid isPermaLink="false">http://server.pramati.com/blog/?p=263</guid>
		<description><![CDATA[Pramati Server internally uses, JDK SSL sockets to communicate over https. The underlying JDK in use, handles ssl handshake and re-negotiation if required. Hence to disable session renegotiation, one must use a JDK which has the issue addressed (for Example JDK 1.6 update 21). For already installed pramati servers, one can change the JDK in [...]]]></description>
			<content:encoded><![CDATA[<p>Pramati Server internally uses, JDK SSL sockets to communicate over https. The underlying JDK in use, handles ssl handshake and re-negotiation if required. Hence to disable session renegotiation, one must use a JDK which has the issue addressed (for Example JDK 1.6 update 21). For already installed pramati servers, one can change the JDK in use by changing JAVA_HOME variable in the file &lt;server-install&gt;/server/bin/setup.bat (or setup.sh in UNIX OS).</p>
<p>@ ECHO Generated batch file to setup Environment Variables for Pramati Server 6.0<br />
set install_root=D:\Pserver60_1091_SP3\server<br />
set JAVA_HOME=D:\Java\jdk1.6.0_21<br />
set PATH=%JAVA_HOME%\bin;%PATH%<br />
set CLASSPATH=%JAVA_HOME%\lib\tools.jar;%install_root%\lib\pramati\classpath.jar;</p>
<p>Now the nodes can be started using the runserver script file as usual and SSL Session renegotiation shall be disabled by default.</p>
<p>Testing SSL Session renegotiation:<br />
For my test case I have used the instructions at http://blog.ivanristic.com/2009/12/testing-for-ssl-renegotiation.html</p>
<p>The Console output:</p>
<p>C:\OpenSSL098a\bin&amp;gt;openssl s_client -connect localhost:443<br />
Loading &#8217;screen&#8217; into random state &#8211; done<br />
CONNECTED(00000784)<br />
depth=0 /C=India/ST=AP/L=Hyderabad/O=Pramati/OU=Engineering/CN=test certificate<br />
verify error:num=18:self signed certificate<br />
verify return:1<br />
depth=0 /C=India/ST=AP/L=Hyderabad/O=Pramati/OU=Engineering/CN=test certificate<br />
verify return:1<br />
&#8212;</p>
<p>. . .<br />
[SSL-Handshake-Messages]</p>
<p>. . .<br />
&#8212;<br />
HEAD / HTTP/1.0<br />
R<br />
RENEGOTIATING<br />
6776:error:1409E0E5:SSL routines:SSL3_WRITE_BYTES:ssl handshake failure:.\ssl\s3_pkt.c:534:</p>
<p>closed</p>
<p>C:\OpenSSL098a\bin&amp;gt;</p>
<p>Step By Step:<br />
1. Navigate to the OpenSSL bin directory on a Command Prompt<br />
2. Execute command to connect to running web server using command</p>
<p>openssl s_client -connect localhost:443</p>
<p>3. If the server IP and Port are correct, connection will be through and a lot of SSL handshake messages shall be printed on console.</p>
<p>Loading &#8217;screen&#8217; into random state &#8211; done<br />
CONNECTED(00000784)<br />
depth=0 /C=India/ST=AP/L=Hyderabad/O=Pramati/OU=Engineering/CN=test certificate<br />
verify error:num=18:self signed certificate<br />
verify return:1<br />
depth=0 /C=India/ST=AP/L=Hyderabad/O=Pramati/OU=Engineering/CN=test certificate<br />
verify return:1<br />
&#8212;<br />
Certificate chain<br />
0 s:/C=India/ST=AP/L=Hyderabad/O=Pramati/OU=Engineering/CN=test certificate<br />
i:/C=India/ST=AP/L=Hyderabad/O=Pramati/OU=Engineering/CN=test certificate<br />
&#8212;<br />
Server certificate<br />
&#8212;&#8211;BEGIN CERTIFICATE&#8212;&#8211;<br />
MIICXzCCAcigAwIBAgIES6tMbTANBgkqhkiG9w0BAQUFADB0MQ4wDAYDVQQGEwVJ<br />
bmRpYTELMAkGA1UECBMCQVAxEjAQBgNVBAcTCUh5ZGVyYWJhZDEQMA4GA1UEChMH<br />
UHJhbWF0aTEUMBIGA1UECxMLRW5naW5lZXJpbmcxGTAXBgNVBAMTEHRlc3QgY2Vy<br />
dGlmaWNhdGUwHhcNMTAwMzI1MTE0MzQxWhcNMTEwMzI1MTE0MzQxWjB0MQ4wDAYD<br />
VQQGEwVJbmRpYTELMAkGA1UECBMCQVAxEjAQBgNVBAcTCUh5ZGVyYWJhZDEQMA4G<br />
A1UEChMHUHJhbWF0aTEUMBIGA1UECxMLRW5naW5lZXJpbmcxGTAXBgNVBAMTEHRl<br />
c3QgY2VydGlmaWNhdGUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALi1cXLT<br />
TxkqxCcHVm/7JcoRn3uJlex3NAnEMYNLTopf2SOzdJDYRjd3MHY3JcT+yEtvfNSR<br />
Vpj7KyDTD0Up2XDZyk0+yJAI6DqLelmfak4/uDbXMW9T7jW7Gu2jbJA5WJD5oyHF<br />
MuiWRAu3xdL049H5uRDJpUN2ckVGBN/eBdOnAgMBAAEwDQYJKoZIhvcNAQEFBQAD<br />
gYEASdTN256auusTcKOReeh2OW8y0PS6kI4eSPjAWCqI+bnixtxc5bhNp/p2kjbL<br />
IqcfpQnRmffbMLXlHJgV03DL4jUTXQCwJu6Jw4fHwiUnU+prcruVDSPT9pNZbEId<br />
ou8CYYE5ISVz+wWSXv6tXRDVhLjj4JZVOl58p9DqzUR+Evc=<br />
&#8212;&#8211;END CERTIFICATE&#8212;&#8211;<br />
subject=/C=India/ST=AP/L=Hyderabad/O=Pramati/OU=Engineering/CN=test certificate<br />
issuer=/C=India/ST=AP/L=Hyderabad/O=Pramati/OU=Engineering/CN=test certificate<br />
&#8212;<br />
No client certificate CA names sent<br />
&#8212;<br />
SSL handshake has read 1152 bytes and written 338 bytes<br />
&#8212;<br />
New, TLSv1/SSLv3, Cipher is EDH-RSA-DES-CBC3-SHA<br />
Server public key is 1024 bit<br />
Compression: NONE<br />
Expansion: NONE<br />
SSL-Session:<br />
Protocol  : TLSv1<br />
Cipher    : EDH-RSA-DES-CBC3-SHA<br />
Session-ID: 4C5027FBD785EA3AAAB4ACBB45A1426E52D5DF829DD13D1B9CDF25C6266D6FC6<br />
Session-ID-ctx:<br />
Master-Key: 291247553A11AF4AC9FB54DE32D677ACE804605675D3EC58B72572D31E831EFB4D2E6C339AB39458E56E8650D2FF8253<br />
Key-Arg   : None<br />
Start Time: 1280321531<br />
Timeout   : 300 (sec)<br />
Verify return code: 18 (self signed certificate)<br />
&#8212;</p>
<p>4. Now, the connection shall remain active for the socket idle timeout seconds, which is usually 3 seconds for default Pramati Server node.<br />
5. We can send first line of Request header now. Paste the following at command prompt and press enter (before the time out happens of-course).</p>
<p>HEAD / HTTP/1.0</p>
<p>6. Now we can initiate a renegotiation by typing R and pressing enter.</p>
<p>R</p>
<p>(The time out sure applies here as well. So make sure you key in R and press enter before the time out of 3 seconds starting from the point we pressed enter for the HEAD line above)</p>
<p>7. A renegotiation request is now initiated. Now is the time for results. If JDK does not allow renegotiation, the output on the same window shall be as given below:</p>
<p>RENEGOTIATING<br />
6776:error:1409E0E5:SSL routines:SSL3_WRITE_BYTES:ssl handshake failure:.\ssl\s3_pkt.c:534:</p>
<p>8. If the JDK allows renegotiation, the output shall be like :</p>
<p>RENEGOTIATING<br />
depth=0 /C=India/ST=AP/L=Hyderabad/O=Pramati/OU=Engineering/CN=test certificate<br />
verify error:num=18:self signed certificate<br />
verify return:1<br />
depth=0 /C=India/ST=AP/L=Hyderabad/O=Pramati/OU=Engineering/CN=test certificate<br />
verify return:1</p>
<p>9. We can leave the prompt now as it is, and the connection shall be closed automatically by time-out</p>
<p>closed</p>
<p>JDK also provides a system property to re-enable SSL re-negotiation, which can be configured in the server startup script runserver.bat / runserver.sh.</p>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fserver.pramati.com%2Fblog%2F2010%2F08%2F10%2Fdisabling-unsafe-ssl-session-renegotiation-on-pramati-server%2F', 'Disabling+Unsafe+SSL+Session+Renegotiation+on+Pramati+Server')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fserver.pramati.com%2Fblog%2F2010%2F08%2F10%2Fdisabling-unsafe-ssl-session-renegotiation-on-pramati-server%2F', title: '+Disabling+Unsafe+SSL+Session+Renegotiation+on+Pramati+Server+' })"/></div>]]></content:encoded>
			<wfw:commentRss>http://server.pramati.com/blog/2010/08/10/disabling-unsafe-ssl-session-renegotiation-on-pramati-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extending Java URLs to support your own protocol</title>
		<link>http://server.pramati.com/blog/2010/07/21/extending-java-urls-to-support-your-own-protocol/</link>
		<comments>http://server.pramati.com/blog/2010/07/21/extending-java-urls-to-support-your-own-protocol/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 06:00:22 +0000</pubDate>
		<dc:creator>Deepak Anupalli</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://server.pramati.com/blog/?p=268</guid>
		<description><![CDATA[We have been evaluating to support deploying applications that are uploaded to ftp/http Servers. Usually to deploy an application, you need to download or copy the archive to the same machine where your Application Server runs. And using one of the various deployment tools provided by the Server, deploy application by specifying the file path.
To [...]]]></description>
			<content:encoded><![CDATA[<p>We have been evaluating to support deploying applications that are uploaded to ftp/http Servers. Usually to deploy an application, you need to download or copy the archive to the same machine where your Application Server runs. And using one of the various deployment tools provided by the Server, deploy application by specifying the file path.</p>
<p>To make the deployment process much simpler, we can now directly deploy the archive using URL spec. Java URLs can be made to work with protocols like <code>http, ftp</code>, etc., with support for introspection of standard headers and authentication mechanisms. For example, you can download an archive uploaded to ftp site as shown below.</p>
<pre class="brush: java">
URL url = new URL(&quot;ftp://guest:guest@ftp.mysite.com/apps/myapp.war&quot;);
URLConnection conn = url.openConnection();
InputStream is = conn.getInputStream();
</pre>
<p>You can see that the user &amp; password are also included within the URL, as it requires authentication. Now, all that we need to deploy application is the URL spec., <code>ftp://guest:guest@ftp.mysite.com/apps/myapp.war</code>. This is not just enough, with the growing adoption towards cloud storage services like Amazon S3, there is need to support more protocols. Java allows configuring custom protocol handlers by implementing <code>java.net.URLStreamHandler</code> and placing it in the classpath. The following is a protocol handler for Amazon S3.</p>
<pre class="brush: java">
package sun.net.www.protocol.s3;

public class Handler extends URLStreamHandler {

   protected URLConnection openConnection(URL u) throws IOException {
      InputStream is;
      try {
         RestS3Service s3Service = new RestS3Service(
               new AWSCredentials(accessKey, secretAccessKey));
         S3Object s3obj = s3Service.getObject(
               new S3Bucket(u.getHost()), u.getPath().substring(1));
         is = s3obj.getDataInputStream();
      }catch (S3ServiceException e){
         throw new IOException(e);
      }
      final InputStream inputStream = is;
      return new URLConnection(u) {
         public InputStream getInputStream() throws IOException {
            return this.inputStream;
         }
         public void connect() throws IOException {
            // Nothing to do. When we give back this object
         }
      };
   }
}
</pre>
<p>The package name for the handler class, <code>sun.net.www.protocol.s3</code> indicates URL mechanism to use this handler for S3 protocol, i.e. for all URLs of the form <code>s3://s3.amazon.com/mybucket/myapp.war</code>, and most importantly the class name should be named as Handler. The package name convention is enforced to make sure the standard protocol handlers are always loaded by the Java boot strap classloaders. However, there is an antidote if you intend to override the default behaviour through system property <code>java.protocol.handler.pkgs</code>, which allows specifying a comma separated list of packages to look for the protocol handlers.</p>
<p>However, the above approach requires protocol handler classes to be placed in system classpath only. There is another approach to control the protocol handling mechanism through the <code>java.net.URLStreamHandlerFactory</code> class, which can be set through a public static method in <code>java.net.URL</code>.</p>
<pre class="brush: java">
URL.setURLStreamHandlerFactory(new URLStreamHandlerFactory() {
   public URLStreamHandler createURLStreamHandler(String protocol) {
      ...
      return null;//if you do not intend to create handler for this protocol
   }
});
</pre>
<p>With the Factory approach we can completely customize the class loading mechanism, package and class name conventions and overriding the default protocol handlers. But the downside is, once the Factory is set, it cannot be reset within the JVM. Especially, if running within a Container or Server environment which has the <code>URLStreamHandlerFactory</code> already set, there is no way of setting our own factory again.</p>
<p>Using the above approaches, we can support deploying applications from one of your favourite storage services through its own protocol.</p>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fserver.pramati.com%2Fblog%2F2010%2F07%2F21%2Fextending-java-urls-to-support-your-own-protocol%2F', 'Extending+Java+URLs+to+support+your+own+protocol')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fserver.pramati.com%2Fblog%2F2010%2F07%2F21%2Fextending-java-urls-to-support-your-own-protocol%2F', title: '+Extending+Java+URLs+to+support+your+own+protocol+' })"/></div>]]></content:encoded>
			<wfw:commentRss>http://server.pramati.com/blog/2010/07/21/extending-java-urls-to-support-your-own-protocol/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Performance issues with JDBC drivers&#8217; for MS SQL Server</title>
		<link>http://server.pramati.com/blog/2010/06/02/perfissues-jdbcdrivers-mssqlserver/</link>
		<comments>http://server.pramati.com/blog/2010/06/02/perfissues-jdbcdrivers-mssqlserver/#comments</comments>
		<pubDate>Wed, 02 Jun 2010 07:32:33 +0000</pubDate>
		<dc:creator>Shaik Emran Sharif</dc:creator>
				<category><![CDATA[Pramati Server]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[mssqlserver]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://server.pramati.com/blog/?p=245</guid>
		<description><![CDATA[Recently one of our customers reported that their JMS server startup was taking long time, when they restart the server after a downtime. They were using MS SQL Server 2005 as the persistent store for JMS and Microsoft&#8217;s JDBC driver to connect to the database. Upon initial analysis, we figured that there were incomplete transactions [...]]]></description>
			<content:encoded><![CDATA[<p>Recently one of our customers reported that their JMS server startup was taking long time, when they restart the server after a downtime. They were using MS SQL Server 2005 as the persistent store for JMS and Microsoft&#8217;s JDBC driver to connect to the database. Upon initial analysis, we figured that there were incomplete transactions present in the DB during the server restart. JMS Server loads all these transactions in-memory during the startup. The delay was around 20 minutes for 20K incomplete transactions. Ideally, as per our tests with other DBs, this should be done in 15-20 seconds. The thread dumps revealed us that even simple delete queries that are part of this transaction loading step were taking substantial amount of time. We started digging into the database and driver configuration and found that it was JDBC driver which was causing the whole slow-down.</p>
<p>SQL Server differentiates its data types that support Unicode from the ones that just support ASCII. For example, the character data types that support Unicode are nchar, nvarchar, longnvarchar where as their ASCII counter parts are char, varchar and longvarchar respectively. By default, all Microsoft&#8217;s JDBC drivers send the strings in Unicode format to the SQL Server, irrespective of whether the datatype of the corresponding column defined in the SQL Server supports Unicode or not. In the case where the data types of the columns support Unicode, everything is smooth. But, in cases where the data types of the columns do not support Unicode, serious performance issues arise especially during data fetches. SQL Server tries to convert non-unicode datatypes in the table to unicode datatypes before doing the comparison. Moreover, if an index exists on the non-unicode column, it will be ignored. This would ultimately lead to a whole table scan during data fetch, thereby slowing down the search queries drastically.</p>
<p>All the tables created by the JMS Server have non-unicode datatypes and hence will be the indexes on non-unicode datatypes. With this, we fell in the trap of the MS JDBC driver&#8217;s default behaviour, facing a performance degradation.</p>
<p>On digging the driver&#8217;s configuration, we figured that there is a property called <strong>sendStringParametersAsUnicode</strong> which helps in getting rid of this unicode conversion. This property defaults to &#8216;true&#8217; which makes the JDBC driver send every string in Unicode format to the database by default. We switched off this property and achieved two improvements in our use-case:<br />
1) All string parameters of our prepared statements are being sent to the database in ASCII format. This helped us overcome the Unicode conversion overhead.<br />
2) Since Unicode conversion isn&#8217;t happening, all our indexes on varchar columns are being used during data fetches instead of whole table scans.</p>
<p>With this, we were able to get our JMS server started in less than 30 sec.</p>
<p>This performance degradation is quite possible with other driver&#8217;s for Microsoft SQL Server also as the default behaviour in the well-known drivers for MS SQL Server is to send strings as Unicode by default. However, all these drivers have a similar property to tweak the default behaviour. Here is a list of these of properties by vendor:</p>
<table border="1">
<tbody>
<tr>
<th>Vendor</th>
<th>Parameter</th>
</tr>
<tr>
<td>JSQLConnect</td>
<td>asciiStringParameters</td>
</tr>
<tr>
<td>JTDS</td>
<td>sendStringParametersAsUnicode</td>
</tr>
<tr>
<td>DataDirectConnect</td>
<td>sendStringParametersAsUnicode</td>
</tr>
<tr>
<td>Microsoft JDBC</td>
<td>sendStringParametersAsUnicode</td>
</tr>
<tr>
<td>WebLogic Type 4 JDBC SQL Server driver</td>
<td>sendStringParametersAsUnicode</td>
</tr>
</tbody>
</table>
<p></p>
<p>How to apply the property in Pramati Server?<br />
Pramati Server maintains all datasources, jdbc connection factories in an xml file called resource-config.xml. The property <strong>sendStringParametersAsUnicode </strong> has to be added under the &#8216;properties&#8217; element of the corresponding jdbc connection factory.</p>
<p>Example:<br />
&lt;connection-factory authorized-by=&#8221;Container&#8221; classname=&#8221;com.microsoft.sqlserver.jdbc.SQLServerDriver&#8221; description=&#8221;" name=&#8221;jmsdb-cf&#8221; url=&#8221;jdbc:sqlserver://localhost\SQLEXPRESS;DatabaseName=TESTDB&#8221;&gt;<br />
&lt;login-parameters mask-password=&#8221;false&#8221; password=&#8221;pramati&#8221; user=&#8221;sa&#8221;/&gt;<br />
&lt;properties&gt;<br />
<em>&lt;property name=&#8221;sendStringParametersAsUnicode&#8221; value=&#8221;false&#8221;/&gt;</em><br />
&lt;/properties&gt;<br />
&lt;/connection-factory&gt;</p>
<p>Alternately, the property can also be added to the connection url string as shown below:</p>
<p>&lt;connection-factory authorized-by=&#8221;Container&#8221; classname=&#8221;com.microsoft.sqlserver.jdbc.SQLServerDriver&#8221; description=&#8221;" name=&#8221;jmsdb-cf&#8221;<br />
url=&#8221;jdbc:sqlserver://localhost\SQLEXPRESS;DatabaseName=TESTDB;<em>sendStringParametersAsUnicode=false</em>&#8220;&gt;<br />
&lt;login-parameters mask-password=&#8221;false&#8221; password=&#8221;pramati&#8221; user=&#8221;sa&#8221;/&gt;<br />
&lt;properties/&gt;<br />
&lt;/connection-factory&gt;</p>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fserver.pramati.com%2Fblog%2F2010%2F06%2F02%2Fperfissues-jdbcdrivers-mssqlserver%2F', 'Performance+issues+with+JDBC+drivers%26%238217%3B+for+MS+SQL+Server')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fserver.pramati.com%2Fblog%2F2010%2F06%2F02%2Fperfissues-jdbcdrivers-mssqlserver%2F', title: '+Performance+issues+with+JDBC+drivers%26%238217%3B+for+MS+SQL+Server+' })"/></div>]]></content:encoded>
			<wfw:commentRss>http://server.pramati.com/blog/2010/06/02/perfissues-jdbcdrivers-mssqlserver/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Working with Pramati Server MBeans</title>
		<link>http://server.pramati.com/blog/2010/04/09/working-with-pramati-server-mbeans/</link>
		<comments>http://server.pramati.com/blog/2010/04/09/working-with-pramati-server-mbeans/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 06:46:55 +0000</pubDate>
		<dc:creator>tanuja</dc:creator>
				<category><![CDATA[Pramati Server]]></category>

		<guid isPermaLink="false">http://server.pramati.com/blog/?p=232</guid>
		<description><![CDATA[Like other Application servers, Pramati Server have Management Console, through which you can monitor server health, configure JDBC, JMS resources and much more  management/administrative activities. All these are done through Management Bean, popularly known as MBeans. Pramati Server&#8217;s Management Console implements Java Management Extensions (JMX) specifications (JSR 77). It also exposes Management APIs to facilitate [...]]]></description>
			<content:encoded><![CDATA[<p>Like other Application servers, Pramati Server have Management Console, through which you can monitor server health, configure JDBC, JMS resources and much more  management/administrative activities. All these are done through Management Bean, popularly known as MBeans. Pramati Server&#8217;s Management Console implements Java Management Extensions (JMX) specifications (JSR 77). It also exposes Management APIs to facilitate server management through custom tools and applications. You can refer to the link <a href="http://www.pramati.com/docstore/1230006/help/mbeanbrowser/working.htm">here </a> to have more idea on it.</p>
<p>If you have installed Pramati Server, then access the Management console through &#8220;http://&lt;host_name&gt;:&lt;port_name&gt;/admin&#8221; and login with default user name, password as &#8220;root&#8221; and &#8220;pramati&#8221; respectively.</p>
<p>where,</p>
<ol>
<li><em>&lt;host_name&gt;</em> :  Is your host name where server is installed</li>
<li> <em>&lt;port_name&gt;</em> :  HTTP listener port value, default is 8181</li>
</ol>
<p>After logging in, on the left navigation panel, click on &#8220;Utilities&#8221;. Now you can see &#8220;MBean Viewer&#8221; link there. MBean Viewer is a utility provided in the Console to allow you to view details about all the MBeans present in and being used by the various Domains. Further expanding the Domain will list all the MBeans related to it. Clicking on a listed MBean will display the following three tabs for the same MBean:</p>
<ol>
<li><em>attributes</em></li>
<li><em>operations</em></li>
<li><em>notifications</em></li>
</ol>
<p>You can also avail the Management APIs for particular MBean, by clicking on the link provided under &#8220;JavaDoc&#8221; section. You can use them as per requirement. Click on the &#8220;Help?&#8221; icon present on MBean Viewer page to know more about it.</p>
<p>Now, lets see a sample which shows the status of the Datasource configured on the Pramati Server. I assume that you already have a DataSource configured on server. Find more information on configuring DataSources <a href="http://www.pramati.com/docstore/1500003/forAdmin/WorkingWithPResources/HowToConfigureDatasourceForJ2EEApps.htm">here</a>.  Now coming to our sample with MBean, here is the snippet of code:</p>
<p><code>import java.util.Properties;</code></p>
<p><code>import javax.management.MBeanServer;<br />
import javax.management.ObjectName;<br />
import javax.naming.InitialContext;</code></p>
<p><code>import com.pramati.services.admin.base.StatisticsProvider;<br />
import com.pramati.services.admin.stat.Statistic;<br />
import com.pramati.services.admin.stat.StatisticMetadata;<br />
import com.pramati.services.admin.stat.Stats;<br />
import com.pramati.services.admin.util.PoolStatus;<br />
import com.pramati.services.j2ee.spi.admin.J2EEServerMBean;<br />
import com.pramati.services.resource.spi.admin.JDBCResourceMBean;<br />
import com.pramati.services.resource.spi.admin.JDBCSelfManagedDataSourceMBean;<br />
</code><br />
<code>public class MyMBeanLookup {</code></p>
<p><code>public static void main(String args[]) {<br />
try {</code></p>
<p><code>//Create Initial Context to the server where we want to lookup the resources<br />
Properties props = new java.util.Properties();<br />
props.put("java.naming.factory.initial","com.pramati.naming.client.PramatiClientContextFactory");<br />
props.put("java.naming.provider.url", "rmi://127.0.0.1:9191");<br />
InitialContext ic = new javax.naming.InitialContext(props);<br />
J2EEServerMBean mBeanServer = (J2EEServerMBean) ic.lookup("root-server-mbean");</code></p>
<p><code>//Get Name of Node<br />
System.out.println("The Server Node Name is :: " + mBeanServer.getServerName());</code></p>
<p><code>//Get hold of JDBCResourceMBean<br />
JDBCResourceMBean myResourceMbean = mBeanServer.getJDBCResourceService();</code></p>
<p><code>//Get all Container Managed DataSources<br />
JDBCSelfManagedDataSourceMBean[] dataSources = myResourceMbean.getJDBCSelfManagedDataSources();<br />
</code><br />
<code>//Iterate the datasources to get the stats<br />
for (JDBCSelfManagedDataSourceMBean dataSource : dataSources) {<br />
Stats getMyStats = dataSource.getStats();<br />
System.out.println("The DS name :: " + dataSource.getJNDIName());<br />
System.out.println("ConnectionRefreshRate in Minutes :: "+ dataSource.getConnectionRefreshRateMinutes());<br />
System.out.println("ConnectionRequestTimeout in Seconds :: "+ dataSource.getConnectionRequestTimeout());</code></p>
<p><code>//Get Pool statistics<br />
PoolStatus poolStat = dataSource.getCurrentPoolStatus();<br />
System.out.println("Total Pool size :: " + poolStat.getPoolSize());<br />
System.out.println("Free Pool size :: "+ poolStat.getFreePoolSize());<br />
System.out.println("in Use Pool size :: "+ poolStat.getInUsePoolSize());<br />
}<br />
} catch (Exception e) {<br />
e.printStackTrace();<br />
}<br />
}</code></p>
<p><code>}</code></p>
<p>Change the following line of code with appropriate host-name and naming port value for successful lookup on server.</p>
<p>props.put(&#8221;java.naming.provider.url&#8221;, &#8220;rmi://127.0.0.1:9191&#8243;);</p>
<p>To compile and execute the class successfully, you need to have following list of jar files in classpath:</p>
<ol>
<li> <em>pramati_client_all.jar </em>:   located at &lt;$pserver_install&gt;\server\lib\pramati_client</li>
<li><em>pramati_client_all_jms.jar</em> :   located at &lt;$pserver_install&gt;\server\lib\pramati_client</li>
<li><em>pramati_jmsconn.jar</em> :   located at &lt;$pserver_install&gt;\server\lib\pramati</li>
<li><em>pramati_serveradmin.jar </em>:   located at &lt;$pserver_install&gt;\server\lib\pramati</li>
<li><em>pramati_util.jar</em> :   located at &lt;$pserver_install&gt;\server\lib\pramati</li>
</ol>
<p>On successful execution, you should see the status of the configured DataSource. Similarly you can view other services status through <em></em></p>
<p><em> com.pramati.services.j2ee.spi.admin.J2EEServerMBean</em><br />
or<br />
<em> com.pramati.services.jms.spi.admin.JMSServerMBean</em></p>
<p>by looking up &#8220;root-server-mbean&#8221; or &#8220;jms-server-mbean&#8221; either from the same VM or remotely.</p>
<p>The sample was for viewing the statistics. You can also make any configurational changes through MBean. Changes can not be done through anonymous login. That means in the above example, user is an anonymous user. You must provide administrative credential details to do so. For this, add following three lines to your code:</p>
<p>props.put(&#8221;java.naming.security.principal&#8221;, &#8220;root&#8221;);<br />
props.put(&#8221;java.naming.security.credentials&#8221;, &#8220;pramati&#8221;);<br />
props.put(&#8221;com.pramati.naming.realm&#8221;, &#8220;system&#8221;);</p>
<p>where,</p>
<ol>
<li> <em>root</em> :   default user name</li>
<li> <em>pramati </em>:   default password</li>
<li> <em>system</em> :   default realm configured on Pramati Server</li>
</ol>
<p>If you are not using the default values of these properties, then replace them with your customized ones.</p>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fserver.pramati.com%2Fblog%2F2010%2F04%2F09%2Fworking-with-pramati-server-mbeans%2F', 'Working+with+Pramati+Server+MBeans')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fserver.pramati.com%2Fblog%2F2010%2F04%2F09%2Fworking-with-pramati-server-mbeans%2F', title: '+Working+with+Pramati+Server+MBeans+' })"/></div>]]></content:encoded>
			<wfw:commentRss>http://server.pramati.com/blog/2010/04/09/working-with-pramati-server-mbeans/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configure SSL on Pramati Server using Admin Console</title>
		<link>http://server.pramati.com/blog/2010/04/03/configure-ssl-on-pramati-server-using-admin-console/</link>
		<comments>http://server.pramati.com/blog/2010/04/03/configure-ssl-on-pramati-server-using-admin-console/#comments</comments>
		<pubDate>Sat, 03 Apr 2010 11:54:12 +0000</pubDate>
		<dc:creator>vinod</dc:creator>
				<category><![CDATA[Pramati Server]]></category>

		<guid isPermaLink="false">http://server.pramati.com/blog/?p=198</guid>
		<description><![CDATA[SSL (Secure Socket Layer), is a request/response protocol that involves public and private keys, as well as a digital certificate. SSL technology allows web browsers and web servers to communicate over a secure connection. In this secure connection, the data that is being sent is encrypted before being sent and then is decrypted upon receipt [...]]]></description>
			<content:encoded><![CDATA[<p><em><strong>SSL</strong></em> (Secure Socket Layer), is a request/response protocol that involves public and private keys, as well as a digital certificate. SSL technology allows web browsers and web servers to communicate over a secure connection. In this secure connection, the data that is being sent is encrypted before being sent and then is decrypted upon receipt and before processing. Both the browser and the server encrypt all traffic before sending any data. An SSL connector is pre-configured for the Application Server. By default this feature is disabled on Pramati Server. To configure SSL support on Pramati Server, you need to follow the simple steps:</p>
<p><strong>Configure/Enable Server for HTTPS Requests </strong>:</p>
<p>1. If Pramati Server is already up and running and you want to configure SSL support on the fly with the default (https-port value 443) configuration, execute the following command at Server Shell prompt:</p>
<p>j2eeadmin@default&gt; ssl_accept start</p>
<p>Eg:</p>
<p>Refer the following screen-shot for the details:</p>
<p><img src="/DOCUME%7E1/vinod/LOCALS%7E1/Temp/moz-screenshot-4.jpg" alt="" /><a href="http://server.pramati.com/blog/wp-content/uploads/2010/04/screen1.jpg"><img class="alignnone size-full wp-image-199" src="http://server.pramati.com/blog/wp-content/uploads/2010/04/screen1.jpg" alt="screen1" width="689" height="82" /></a></p>
<p>2.  If you want to configure SSL support with your own configuration:</p>
<p>* Edit server-config.xml file located at <em>&lt;install_dir&gt;/server/nodes/&lt;node_name&gt;/config/ directory.</em></p>
<p>* Locate the following under the services tag:</p>
<p>&lt;service name=&#8221;WebContainer&#8221; enabled=&#8221;true&#8221; class-name=&#8221;com.pramati.web.WebServer&#8221;&gt;<br />
&lt;property name=&#8221;https-port&#8221; value=&#8221;443&#8243;/&gt;<br />
&lt;/service&gt;</p>
<p>* By default, https-port is set as 443. Set this value to the required HTTPS port as you want to modify and save this file.</p>
<p>* Now, edit web-config.xml file located at <em>&lt;install_dir&gt;/server/nodes/&lt;node_name&gt;/config/ directory.</em></p>
<p>* By default,</p>
<p><code>&lt;protocol http-enabled="true" ssl-enabled="false"/&gt;</code>.</p>
<p>Set <code>ssl-enabled</code> to <code>true</code> as</p>
<p><code>&lt;protocol http-enabled="true" ssl-enabled="true"/&gt;</code>.</p>
<p>* Save the changes and restart Server.</p>
<p>* Note that, you will see the following information during the restart of Pramati Server on the server console:</p>
<p style="text-align: center;"><a href="http://server.pramati.com/blog/wp-content/uploads/2010/04/screen2.jpg"><img class="size-full wp-image-200 aligncenter" src="http://server.pramati.com/blog/wp-content/uploads/2010/04/screen2.jpg" alt="screen2" width="590" height="86" /></a></p>
<p>This confirms that SSL support is enabled successfully on Pramati Server.</p>
<h3>Manage Security Certificates using Management Console:</h3>
<p>1. Start Pramati Server and access the following url:</p>
<p>http://localhost:8181/admin/</p>
<p>2. Provide the required credentials and navigate to &#8220;<em><strong>Configure &#8211;&gt; Security Certificates</strong></em>&#8221; available in the left panel of management console .</p>
<p>3. By default, you see a test certificate called &#8220;<em><strong>default</strong></em>&#8221; under &#8220;<strong>Server Certificates</strong>&#8221; section.  Click on &#8220;Add&#8221; button:</p>
<p style="text-align: center;"><a href="http://server.pramati.com/blog/wp-content/uploads/2010/04/screen3.jpg"><img class="size-full wp-image-201 aligncenter" src="http://server.pramati.com/blog/wp-content/uploads/2010/04/screen3.jpg" alt="screen3" width="710" height="242" /></a></p>
<p>4. Once you have clicked &#8220;Add&#8221; button, the following screen will display for the details. Fill the details as per the requirement and click &#8220;<strong>Save</strong>&#8221; button:</p>
<p style="text-align: center;"><a href="http://server.pramati.com/blog/wp-content/uploads/2010/04/screen4.jpg"><img class="size-full wp-image-204 aligncenter" src="http://server.pramati.com/blog/wp-content/uploads/2010/04/screen4.jpg" alt="screen4" width="731" height="338" /></a></p>
<p>5. Make sure that the certificate name should be equal to the domain name of the site for which you are trying to configure https. In the above example it is test.pramati.com.  Here, you can ignore the port numbers on which you are going to access the application.</p>
<p>6. The created certificate will appear as shown in the following screen-shot:</p>
<p style="text-align: center;"><a href="http://server.pramati.com/blog/wp-content/uploads/2010/04/screen5.jpg"><img class="size-full wp-image-205 aligncenter" src="http://server.pramati.com/blog/wp-content/uploads/2010/04/screen5.jpg" alt="screen5" width="732" height="173" /></a></p>
<p>The created certificate contains &#8220;Alias&#8221; name with Issued By and Issued To information. Presently both the entries are equal to the target domain name. This indicates that the certificate is generated for this domain and not yet signed by CA.</p>
<p>7.  The server certificates are loaded during the startup of Pramati Server. By default test certificate is the one which is available, can be picked up. Hence, it is suggested that delete the existing test certificate with alias &#8220;<strong>default</strong>&#8221; after creating a new certificate (Eg: samplecert). To delete &#8220;default&#8221; certificate, check the box available against to alias name &#8220;default&#8221;  and click &#8220;<strong>Delete</strong>&#8221; button. Once you have deleted the existing default certificate, restart Pramati Server to use the newly created certificate.</p>
<p><strong>Note</strong>:</p>
<p>It is always recommended that you should have only one certificate under &#8220;<strong>Server Certificate</strong>&#8221; section.</p>
<p>8. The certificate that is generated using Server is a self-signed certificate. For getting the certificate signed by a CA, a Certificate Signing Request (CSR) must be sent to the CA. To obtain the CSR,  click on the certificate&#8217;s alias name (samplecert) and select &#8220;Save CSR&#8221;  option in the next screen.</p>
<p>* In case of <strong>InternetExplorer</strong>, you will get a prompt for saving the file. Click on &#8220;<strong>Save</strong>&#8221; and provide the name as &#8220;<strong>CSRReply.cer</strong>&#8220;.</p>
<p>* In case of <strong>Firefox</strong>, CSR details will be displayed directly in right panel of management console.  Copy the content and paste in a notepad. Save this file as &#8220;<strong>CSRReply.cer</strong>&#8220;.</p>
<p>9.  Once the CSR is generated, the CSR file has to be mailed to the CA. The CA signs the same and sends back the same.</p>
<p>10. Once you have received the mail from CA, extract the CSRReply certificate and save it on the localmachine as &#8220;<strong>CSRReply.cer</strong>&#8220;.</p>
<p>11. As most of the CA&#8217;s are already listed in Pramati Server under &#8220;<strong>Certification Authorities trusted by Server</strong>&#8221; section, you can import the CSRReply on the generated self-signed certificate.</p>
<p>Note:</p>
<p>If the CA is not listed in the trusted certs of Pramati Server, you will get &#8220;<strong>Exception while importing the CSR reply in the store&#8230;</strong>&#8221; exception. To overcome this problem, refer &#8220;<strong>General Exceptions with solutions</strong>&#8221; section which is explained after the completion of the current steps in this post.</p>
<p>12. To import CSRReply, click on alias (samplecert) name and browse for the CSRReply.cer file under &#8220;<strong>Certificate Signing Request Reply</strong>&#8221; section and click &#8220;<strong>Import</strong>&#8220;.</p>
<p>13. Upon the successful import of certificate, the following information(as shown in the screen-shot) will be displayed against the alias name under &#8220;<strong>Server Certificates</strong>&#8221; section:</p>
<p style="text-align: center;"><a href="http://server.pramati.com/blog/wp-content/uploads/2010/04/screen6.jpg"><img class="size-full wp-image-206 aligncenter" src="http://server.pramati.com/blog/wp-content/uploads/2010/04/screen6.jpg" alt="screen6" width="733" height="164" /></a></p>
<p>14. This confirms that the certificate is issued to domain(test.pramati.com) by CA (verisign).</p>
<p>15. Now, access the following URL to confirm the same:</p>
<p>https://test.pramati.com/admin/ (if you have configured https-port as 443 else you have to access this url with port number specified). Make sure that <strong>test.pramati.com</strong> should points the machine where you have installed the certificate.</p>
<p><strong>General Exceptions with solutions:</strong></p>
<p>1.<br />
<strong>File uploaded. Now putting certificate in store&#8230;</strong></p>
<p><strong>Exception while importing the CSR reply in the store&#8230;:Error while importing the CSR reply. &#8211; Could not establish the certificate chain. </strong></p>
<p>Solution:</p>
<p>The above exception clearly indicates that the certificate chain is incomplete.  A <span>certificate chain</span> is a sequence of certificates, where each certificate in the chain is signed by the subsequent certificate. The last certificate in the chain is normally a <span>self-signed certificate</span>-a certificate that signs itself.</p>
<p>Following is the exception while trying with <strong>verisign trial certificate</strong>:</p>
<p><strong>Exception while importing the CSR reply in the store&#8230;:Error while importing the CSR reply. &#8211; Could not establish the certificate chain. Missing certificate for issuer &#8216;CN=VeriSign Trial Secure Server CA &#8211; G2, OU=Terms of use at https://www.verisign.com/cps/testca (c)09, OU=&#8221;For Test Purposes Only. No assurances.&#8221;, O=&#8221;VeriSign, Inc.&#8221;, C=US&#8217;</strong></p>
<p>*To resolve this problem, firstly, double click on &#8220;CSRReply.cer&#8221; certificate which you have received from CA and saved on the local machine. This certificate contains the information as shown below:</p>
<p><img class="alignnone size-full wp-image-218" src="http://server.pramati.com/blog/wp-content/uploads/2010/04/screen8.jpg" alt="screen8" /></p>
<p>* This certificate is issued by &#8220;<strong>Verisign Trial Secure Server CA &#8211; G2</strong>&#8220;. So, you need to import root/intermediate certificate for &#8220;<strong>Verisign Trial Secure Server CA &#8211; G2</strong>&#8220;  into &#8220;<strong>Certification Authorities trusted by Server</strong>&#8221; section. You can get these root/intermediate certificates from respective CA. Mostly, all the instructions (download locations) are explained in the CSR reply mail sent by CA.</p>
<p>* Once you have download the root/intermediate certifcate from the respective locations, save this certificate as &#8220;<strong>inter.cer</strong>&#8221; and double click this certificate for the details. Details are as follows:</p>
<p><img class="alignnone size-full wp-image-219" src="http://server.pramati.com/blog/wp-content/uploads/2010/04/screen9.jpg" alt="screen9" /></p>
<p>* As this certificate is issued by &#8220;<strong>Verisign Trial Secure Server Root CA &#8211; G2</strong>&#8220;, you need to import root/intermediate certificates for &#8220;<strong>Verisign Trial Secure Server Root CA &#8211; G2</strong>&#8221; into &#8220;<strong>Certification Authorities trusted by Server</strong>&#8221; section.</p>
<p>* Once you have download the Root CA certificate from repsective location, save this file as &#8220;<strong>RootCA</strong>.<strong>cer</strong>&#8221; and double click this certificate to view the details. Details are as follows:</p>
<p><img class="alignnone size-full wp-image-220" src="http://server.pramati.com/blog/wp-content/uploads/2010/04/screen10.jpg" alt="screen10" /></p>
<p>* This indicates clearly that the &#8220;issued by&#8221; and &#8220;issued to&#8221; are same. This conclude that the chain completes if you have the above specified two root/intermediate certificates in the Pramati Server&#8217;s trusted store. To import these files, click on &#8220;<strong>Add</strong>&#8221; button under &#8220;<strong>Certification Authorities trusted by Server</strong>&#8221; section and browse for files and click &#8220;import&#8221; button to import the intermediate certificates.</p>
<p>* Once you have imported these files under &#8220;<strong>Certification Authorities trusted by Server</strong>&#8221; section, import CSRReply, by clicking on alias (samplecert) name and browse for the CSRReply.cer file under &#8220;<strong>Certificate Signing Request Reply</strong>&#8221; section and click &#8220;<strong>Import</strong>&#8220;.</p>
<p><img src="/DOCUME%7E1/vinod/LOCALS%7E1/Temp/moz-screenshot-1.jpg" alt="" /><img src="/DOCUME%7E1/vinod/LOCALS%7E1/Temp/moz-screenshot-2.jpg" alt="" /><img src="/DOCUME%7E1/vinod/LOCALS%7E1/Temp/moz-screenshot-3.jpg" alt="" /><img src="/DOCUME%7E1/vinod/LOCALS%7E1/Temp/moz-screenshot.jpg" alt="" /></p>
<div id="st0000000001" class="st-taf"><script src="http://taf.socialtwist.com:80/taf/js/shoppr.core.js?id=0000000001"></script><img style="border:0;margin:0;padding:0;" src="http://tellafriend.socialtwist.com:80/wizard/images/tafbutton_blue16.png" onmouseout="hideHoverMap(this)" onmouseover="showHoverMap(this, '0000000001', 'http%3A%2F%2Fserver.pramati.com%2Fblog%2F2010%2F04%2F03%2Fconfigure-ssl-on-pramati-server-using-admin-console%2F', 'Configure+SSL+on+Pramati+Server+using+Admin+Console')" onclick="cw(this, {id:'0000000001',link: 'http%3A%2F%2Fserver.pramati.com%2Fblog%2F2010%2F04%2F03%2Fconfigure-ssl-on-pramati-server-using-admin-console%2F', title: '+Configure+SSL+on+Pramati+Server+using+Admin+Console+' })"/></div>]]></content:encoded>
			<wfw:commentRss>http://server.pramati.com/blog/2010/04/03/configure-ssl-on-pramati-server-using-admin-console/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

