<?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>Techie-Gyan &#187; debug</title>
	<atom:link href="http://www.techiegyan.com/category/debug/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.techiegyan.com</link>
	<description></description>
	<lastBuildDate>Fri, 25 Nov 2011 05:37:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Add Server address on page &#8211; Troubleshooting Load Balanced cluster</title>
		<link>http://www.techiegyan.com/2010/10/13/add-server-address-on-page-troubleshooting-load-balanced-cluster/</link>
		<comments>http://www.techiegyan.com/2010/10/13/add-server-address-on-page-troubleshooting-load-balanced-cluster/#comments</comments>
		<pubDate>Wed, 13 Oct 2010 09:29:14 +0000</pubDate>
		<dc:creator>Aditya</dc:creator>
				<category><![CDATA[debug]]></category>
		<category><![CDATA[identity]]></category>
		<category><![CDATA[j2ee]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[problem]]></category>
		<category><![CDATA[troubleshooting]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.techiegyan.com/?p=1527</guid>
		<description><![CDATA[It is actually about a trick that can be used in a particular type of environment. When you are running your application in multi-server environment with load balancers enabled to distribute the load, you may require to know which server is serving the request in certain error situations. One very probable scenario is that during [...]]]></description>
			<content:encoded><![CDATA[<p>It is actually about a trick that can be used in a particular type of environment. When you are running your application in multi-server environment with load balancers enabled to distribute the load, you may require to know which server is serving the request in certain error situations.</p>
<p>One very probable scenario is that during the maintenance processes some thing is missed on some server(s). This may cause random issues to the user of the application as requests are distributed and can reach any server.This trick can be used to figure out which server is serving your page. Here i am adding the code which we used recently in our JSP pages to figure it out. </p>
<pre class="brush: java; title: ; notranslate">&lt;%@page import=&quot;java.net.InetAddress;&quot; %&gt;
&lt;%String ip = &quot;&quot;;
  String hostName = &quot;&quot;;
try{
    InetAddress inetAddress = InetAddress.getLocalHost();
    ip = inetAddress.getHostAddress();
	hostName = inetAddress.getHostName();
}catch(Exception e){}
%&gt;
&lt;div style=&quot;display:none;&quot;&gt; Server IP address : &lt;%out.print(ip);%&gt; &lt;br/&gt;
Server Host Name : &lt;%out.print(hostName);%&gt; &lt;br/&gt;
&lt;/div&gt;
</pre>
<p>As you do not want to show this to user, you can add a hidden div element at the end of the page which can contain server address and server name by which you can differentiate servers. This can be accessed by viewing the page source (most of the browsers provide this option on right-click.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techiegyan.com/2010/10/13/add-server-address-on-page-troubleshooting-load-balanced-cluster/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.lang.String</title>
		<link>http://www.techiegyan.com/2010/08/30/java-lang-classcastexception-ljava-lang-string-cannot-be-cast-to-java-lang-string/</link>
		<comments>http://www.techiegyan.com/2010/08/30/java-lang-classcastexception-ljava-lang-string-cannot-be-cast-to-java-lang-string/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 08:00:24 +0000</pubDate>
		<dc:creator>Aditya</dc:creator>
				<category><![CDATA[debug]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[j2ee]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[servlet]]></category>
		<category><![CDATA[troubleshooting]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.techiegyan.com/?p=1468</guid>
		<description><![CDATA[It happened with me while i was trying to extract a HTTPRequest parameter from an ActionInvocation object. I was writing an interceptor in Struts2 and was trying to check a request parameter. This is how you do it when you are in an interceptor: And it gave me following error: According to the Java Doc [...]]]></description>
			<content:encoded><![CDATA[<p>It happened with me while i was trying to extract a HTTPRequest parameter from an ActionInvocation object. I was writing an interceptor in Struts2 and was trying to check a request parameter. This is how you do it when you are in an interceptor:</p>
<pre class="brush: java; title: ; notranslate">
public String intercept(ActionInvocation invocation) throws Exception {
    Map&lt;String,Object&gt; params  = invocation.getInvocationContext().getParameters();
    String param_var= params.get(&quot;parameter_name&quot;);
    /*
        Other stuff
    */
}
</pre>
<p>And it gave me following error:</p>
<pre class="brush: java; title: ; notranslate"> java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.lang.String</pre>
<p>According to the Java Doc it should return an Object and when i tried to debug it. I found that it is actually returning an array object. In some cases it may be correct because a request can contain an array against a key. HttpRequest gives two separate function for this but in this case it was only returning an array. Done following modifications to run the code : </p>
<pre class="brush: java; title: ; notranslate">
public String intercept(ActionInvocation invocation) throws Exception {
    Map&lt;String,Object&gt; params  = invocation.getInvocationContext().getParameters();
    String[] paramArr_var= (String[])params.get(&quot;parameter_name&quot;);
    /*
        Other stuff
    */
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.techiegyan.com/2010/08/30/java-lang-classcastexception-ljava-lang-string-cannot-be-cast-to-java-lang-string/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Adding values to Apache Logging &#8211; httpd</title>
		<link>http://www.techiegyan.com/2010/08/23/adding-values-to-apache-logging-httpd/</link>
		<comments>http://www.techiegyan.com/2010/08/23/adding-values-to-apache-logging-httpd/#comments</comments>
		<pubDate>Mon, 23 Aug 2010 15:10:31 +0000</pubDate>
		<dc:creator>Aditya</dc:creator>
				<category><![CDATA[basics]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[troubleshooting]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.techiegyan.com/?p=1485</guid>
		<description><![CDATA[Apache HTTP server logs are source of very valuable information. Many trends, usage analysis can be extracted from these logs. Some times you may not get the information you require in the logs as it is not logged by the server like time taken by the request or port of the server serving the request. [...]]]></description>
			<content:encoded><![CDATA[<p>Apache HTTP server logs are source of very valuable information. Many trends, usage analysis can be extracted from these logs. Some times you may not get the information you require in the logs as it is not logged by the server like time taken by the request or port of the server serving the request. httpd made it quite simple to change its format of logging. </p>
<p>You can just go to the httpd configuration file and search for LogFormat and you will be able to see some c printf like code there. Generally it is like :  </p>
<pre class="brush: java; title: ; notranslate">LogFormat &quot;%h %l %u %t \&quot;%r\&quot; %&gt;s %b \&quot;%{Referer}i\&quot; \&quot;%{User-Agent}i\&quot;&quot; combined </pre>
<p>It is the part of configuration of mod_log_config which is responsible for httpd logging. You can change the Log format to get the desired fields printed in log files. use following table to add more fields in your log file or check <a href="http://httpd.apache.org/docs/1.3/mod/mod_log_config.html">http://httpd.apache.org/docs/1.3/mod/mod_log_config.html</a>:</p>
<pre class="brush: plain; title: ; notranslate">
%...a:          Remote IP-address
%...A:          Local IP-address
%...B:          Bytes sent, excluding HTTP headers.
%...b:          Bytes sent, excluding HTTP headers. In CLF format
        i.e. a '-' rather than a 0 when no bytes are sent.
%...c:          Connection status when response was completed.
                'X' = connection aborted before the response completed.
                '+' = connection may be kept alive after the response is sent.
                '-' = connection will be closed after the response is sent.
%...{FOOBAR}e:  The contents of the environment variable FOOBAR
%...f:          Filename
%...h:          Remote host
%...H       The request protocol
%...{Foobar}i:  The contents of Foobar: header line(s) in the request
                sent to the server.
%...l:          Remote logname (from identd, if supplied)
%...m       The request method
%...{Foobar}n:  The contents of note &quot;Foobar&quot; from another module.
%...{Foobar}o:  The contents of Foobar: header line(s) in the reply.
%...p:          The canonical Port of the server serving the request
%...P:          The process ID of the child that serviced the request.
%...q       The query string (prepended with a ? if a query string exists,
        otherwise an empty string)
%...r:          First line of request
%...s:          Status.  For requests that got internally redirected, this is
                the status of the *original* request --- %...&gt;s for the last.
%...t:          Time, in common log format time format (standard english format)
%...{format}t:  The time, in the form given by format, which should
                be in strftime(3) format. (potentially localized)
%...T:          The time taken to serve the request, in seconds.
%...u:          Remote user (from auth; may be bogus if return status (%s) is 401)
%...U:          The URL path requested, not including any query string.
%...v:          The canonical ServerName of the server serving the request.
%...V:          The server name according to the UseCanonicalName setting.
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.techiegyan.com/2010/08/23/adding-values-to-apache-logging-httpd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Database page corruption on disk or a failed file read &#8230;. Again – Mysql</title>
		<link>http://www.techiegyan.com/2010/01/31/database-page-corruption-on-disk-or-a-failed-file-read-again-%e2%80%93-mysql/</link>
		<comments>http://www.techiegyan.com/2010/01/31/database-page-corruption-on-disk-or-a-failed-file-read-again-%e2%80%93-mysql/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 06:52:41 +0000</pubDate>
		<dc:creator>Aditya</dc:creator>
				<category><![CDATA[basics]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[problem]]></category>

		<guid isPermaLink="false">http://www.techiegyan.com/?p=1252</guid>
		<description><![CDATA[Again encountered the stopped server in the morning because of page file corruption. Reason was the bad power situation in office during night shifts and which costs us the whole day to repair the testing server. As from the last time learnings of page file corruption (previous post) we knew how to start the server [...]]]></description>
			<content:encoded><![CDATA[<p>Again encountered the stopped server in the morning because of page file corruption. Reason was the bad power situation in office during night shifts and which costs us the whole day to repair the testing server. </p>
<p>As from the last time learnings of page file corruption (<a href="http://www.techiegyan.com/?p=1104">previous post</a>) we knew how to start the server in recovery mode by changing the /etc/my.cnf file, we started it in recorvery mode 3 (innodb_force_recovery = 3) which is  SRV_FORCE_NO_TRX_UNDO i.e. Do not run transaction rollbacks after recovery. </p>
<p>We were able to do few things which are allowed in this recovery mode like checking few databases and integrity of some of the application data. We tried to check mysql tables using mysqlcheck command. </p>
<pre class="brush: sql; title: ; notranslate">
$ mysqlcheck -u root -p --all-databases
</pre>
<p>Using above command it was not not completing the command and was giving following error </p>
<pre class="brush: sql; title: ; notranslate">
RROR 2013 (HY000): Lost connection TO MySQL server during query
</pre>
<p>Same error we got when we tried to backup all database schemas in the DB. It took backup of some of the schemas but soon gives above error. We were stuck as not able to take backup of data and also were not able to repair the tables/databases. </p>
<p>tried following thing and backup was successfully taken after that. Even we figured out which tables got corrupted as we could run mysqlcheck successfully also afterwards. We did following simple thing in /etc/my.cnf and restarted the server:</p>
<pre class="brush: sql; title: ; notranslate">
[mysqld]
innodb_force_recovery = 4
</pre>
<p>Finally recovered all the data using the backup and server came back to life after the whole day of effort. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.techiegyan.com/2010/01/31/database-page-corruption-on-disk-or-a-failed-file-read-again-%e2%80%93-mysql/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Unable to transcode font file &#8212; Flex Builder compilation</title>
		<link>http://www.techiegyan.com/2009/09/16/unable-to-transcode-font-file-flex-builder-compilation/</link>
		<comments>http://www.techiegyan.com/2009/09/16/unable-to-transcode-font-file-flex-builder-compilation/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 12:35:12 +0000</pubDate>
		<dc:creator>Aditya</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[problem]]></category>
		<category><![CDATA[troubleshooting]]></category>

		<guid isPermaLink="false">http://www.techiegyan.com/?p=967</guid>
		<description><![CDATA[I faced this problem recently while working on Flex builder where I wanted to use the free font file with my Flex application. I was using this by adding it in style like below: &#60;mx:Style&#62; @font-face { src: url('assets/fonts/FreeSans.ttf'); font-family: FreeSans; } &#60;/mx:Style&#62; While compiling this msxml file i found the error below: Unable to [...]]]></description>
			<content:encoded><![CDATA[<p>I faced this problem recently while working on Flex builder where I wanted to use the free font file with my Flex application. I was using this by adding it in style like below:</p>
<p><code>&lt;mx:Style&gt;<br />
    @font-face {<br />
            src: url('assets/fonts/FreeSans.ttf');<br />
            font-family: FreeSans;<br />
    }<br />
&lt;/mx:Style&gt; </code></p>
<p>While compiling this msxml file i found the error below:</p>
<p>Unable to transcode assets/fonts/FreeSans.ttf</p>
<p><img src="http://www.techiegyan.com/wp-content/uploads/2009/09/flex-building-error.png" alt="flex-building-error" title="flex-building-error" width="456" height="145" class="aligncenter size-full wp-image-969" /></p>
<p>Spent some time by changing some of the properties and looking into mxml file and ttf file but nothing was wrong, it seemed. </p>
<p>Googled and found the solution: </p>
<p>Right click on the Flex project -> Go to Flex Compiler -> Additional compiler arguments: add &#8220;-managers flash.fonts.AFEFontManager&#8221;. If there is some thing already written there separate it by space. </p>
<p><img src="http://www.techiegyan.com/wp-content/uploads/2009/09/flex-builder.png" alt="flex-builder" title="flex-builder" width="520" height="446" class="aligncenter size-full wp-image-970" /></p>
<p>Try to compile again it will work. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.techiegyan.com/2009/09/16/unable-to-transcode-font-file-flex-builder-compilation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

