println

my day-to-day experiences with software

Mozilla thunderbird was eating the disk space

Posted by rajg on January 15, 2010

While checking my disk space at work I was surprised to see that my .mozilla-thunderbird was whopping 30 GB.  Since I received many mails during the day – some being system monitoring mails – I was keeping all of them. This helped me most of the times since I can check the state of the system over a give period of time.

So I decided to spent some time and find out which of my local mail folders are having what size.  With simple linux/unix command  du -h –max-depth=1 ~/.mozilla-thunderbird, I figured out that there was a filterlog.html file under my mozilla profile which was around 26GB. Tailing the file I found that it had log messages for every mail that was filtered from my INBOX to local folders.

I do not know if this was a default setting or I did it by mistake. But for whatever reason I did not need this log.  So in order to get rid of such message I went to Tools -> Message Filters and for my inbox folder and disabled the FilterLog.

Posted in 1 | Leave a Comment »

Kernel trace and SQL trace in MaxDB 7.7

Posted by rajg on September 10, 2008

How to collect kernel and SQL traces on MaxDB 7.7

Recently while tracking down a weird behavior in my application, SQL traces and MaxDB kernel traces were very useful. This issue is described in my other post here. So I thought I would share my experience with others those that would fall in similar trap.

When you execute any SQL from with a java program your java program acts as a client to the database. In case of MaxDB JDBC driver the SQL traces can be collected at the client side (i.e on your java application side) and the kernel traces on server (i.e. the database side).

SQL Traces

In order to switch on SQL trace for MaxDB JDBC driver you need to locate sapdbc.jar that your java application will use to execute SQL queries on MAxDB database. Launch GUI application with

java -jar sapdbc.jar

or

double click on sapdbc.jar which will also launch GUI application since it is an executable jar. Make sure that java is in your path.

Similar to:

sql trace

sql trace

Then check “Tracing enabled” checkbox, select the trace file folder and hit OK. This would switch on SQL traces on the client side. You may want to switch on kernel trace (explained below) before running your application. After you run your application that executes a SQL it would generate jdbctrace.prt in the speified location, in above example it is d:\temp. jdbctrace.prt is a text file which can be viewed by any text editor. Make sure that you run this configuration GUI with the same user that will execute your java program.

Kernel traces

To switch on kernel traces first locate the MaxDB database installation directory. Open a shell/console and then go to <maxdb-installation-home>\programs\pgm and execute

dbmcli -u <admin-user> -d <database-name>

Then on dbmcli console execute

Util_execute diagnose vtrace clear

Util_execute diagnose vtrace default on

->run your program

Trace_flush

Util_execute diagnose vtrace default off

Trace_prot msakbe

Then the trace would be written to MaxDBs rundirectory ...\wrk\<database-name>\<database-name>.prt

Posted in Java, JDBC, MaxDB | Leave a Comment »

MaxDB 7.7 and JDBC

Posted by rajg on September 10, 2008

With new kernel version MaxDB 7.7 is complaint with JDBC driver specification. Due to this change (or lets say correction from MaxDB ) my application running perfectly fine with MaxDb 7.6 was not running properly with MaxDB 7.7 kernel and the new JDBC driver.

In fact my application was using the misbehavior designed in previous versions of MAxDB. Method ResultSetMetaData.getCoulmnName was returning the label/alias defined in SQL rather than the column name defined in the table.  My result set parsing algorithm was based on the label/alias defined in SQL which was fetched by ResultSetMetaData.getCoulmnName. Since this has been corrected in MaxDB 7.7 my algorithm did not work as expected as the method call ResultSetMetaData.getCoulmnName gave me the column name (which is the correct behavior).  To fix my parser I had to call ResultSetMetaData.getLabelName to get the alias/label defined in SQL.

For example, if the query is:

SELECT X AS Y FROM DUAL

With MaxDB 7.6 ResultSetMetaData.getCoulmnName(1) returned "Y" while MaxDB 7.7 returned "X".

Posted in Java, MaxDB | Leave a Comment »

Getting java thread dump under windows

Posted by rajg on September 9, 2008

When your java application stalls/hangs due to a deadlock you want to get a thread dump. Normally you hit ctrl+break under windows (you hit this on the console) and send signal “kill -3″ to the process under nix systems.

Under windows if you are running your java application as a service or is launched from within an IDE (ItelliJ, Eclipse, etc.) you may not have console.  You are struck with the deadlock but it may be hard to reproduce. Fortunately there is way out. Thanks to the StackTrace application. I found this application very useful and I can recommend every java developer to use this in such or many other situations.

StackTrace is free to use if you use it via java web start. Here are the steps to launch it.

1. Hit the “Launch” button on the download page.

2.You will see “Java Starting…” banner. You will also receive a security warning; ignore that.

3.Then hit the “Select process” wheel.

4.You will see “Running JVM processes” dialog. You have to select your stalled process and hit ok.

5.Then go to the “Process” menu and get the thread dump for you process.

You can also launch java tools like jconsole from StackTrace.

Thats it! Happy debugging!

Posted in Java | 1 Comment »

Porting java 1.5 source code to java 1.4 with ANT

Posted by rajg on September 9, 2008

SAP NetWeaver 6.4 runs with java 1.4. In order deploy my application that was built in java 1.5 on SAP NW 6.4 I needed to first compile it “-target” option from java compile “javac”. So I tried following ant build xml snippet:

<javac srcdir=“${source}” destdir=“${destination}” source=“1.5″ target=“1.4″ debug=“true” optimize=“true” />

But it didn’t work. After looking at http://www.masutti.ch/eel/index.html I found a trick to make to above snippet work with the following change:

<javac srcdir=“${source}” destdir=“${destination}” source=“1.5″ target=“jsr14″ debug=“true” optimize=“true” />

One should keep in mind that you cannot replace new classes from java 1.5 with this technique. If possible you can provide additional jars that work with 1.4 (For e.g. classes from javax.management.* package).

Posted in Java, SAP NetWeaver | Leave a Comment »

“Cannot connect to host” errors with MaxDB JDBC driver

Posted by rajg on September 9, 2008

While scanning through my log files I spotted “SAP DBTech JDBC: Cannot connect to jdbc:sapdb://maxdb/testdb [Cannot connect to host maxdb [no route to host: connect], -813]”. But my application was running normal. I didn’t know if this was any abnormal behavior in my application.

Fortunately I had a break point at the point where the SQLException was raised. And at the same time I could not see my network share. Reason was that my network cable was loose and it kicked my pc in and out of the LAN. It was obvious enough that when my pc was temporarily not connected to the LAN, my application was executing sql query and it could not find the host where my maxdb database was running.

Sometimes you need to be lucky to find the cause of an error :-) .

Posted in Java, MaxDB | Leave a Comment »

XFire web services client and SAP NetWeaver 6.4

Posted by rajg on September 9, 2008

SAP NetWeaver 6.4 run with the old version of javax.naming.QName class. You need to first get the version that works with XFire 1.2.3/1.2.6. You can download it from here http://xfire.codehaus.org/FAQ. There are several ways to force SAP NW use latest QName, but I will choose the simplest one, prepending to the java booth classpath using -Xbootclasspath/p option.

For e.g -Xbootclasspath/p:c:\lib\QName.jar

This is not just sufficient to get XFire client working against web service running on SAP NW. It
seems that the SAP NetWeaver 6.4 does not implement the HTTP protocol feature ‘Expect: 100-continue’ properly. XFire uses http-client internally to make http connections. By default XFire uses ‘Expect: 100-continue’ feature from HTTP/1.1. When XFire executes any web service on SAP NW 6.4 it sends http request which includes an Expect request-header field with the “100-continue” expectation. SAP NW then responds with 100 (Continue) status. XFire now sends the request body and expects the final status code 200. But SAP NW sends http response with the header ‘\u000HTTP 200 OK’. This is an invalid http response since it contains null byte at the beginning. To avoid this you need disable ‘Expect: 100-continue’ by setting http.protocol.expect-continue=false parameter on http client used by XFire.

Posted in Java, SAP NetWeaver | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.