XMLDecoder returns null pointer exception


Last week, I had to face following scenario.
My application is a client server application. An object of type class A, is encoded using java.beans.XMLEncoder in client side and saved in database. Class A is located in client side. I need to decode that object at server side. When I try to use java.beans.XMLDecoder,xmlDecoder.readObject() method returns null.

So I investigated why it is happening.  It was because class A is not available at server side, when XMLDecorder try to un marshall the object. 


How to fix "0 rows affected issue" in SQL UPDATE

I was trying to update some rows of a table using sql update statement, but it always returned "0 rows affected " message. I was using following syntax for that.

UPDATE table_name
SET column1=value1,column2=value2,...
WHERE column1='AB1 2CD';


The issue was the space inserted within the value I compare in where statement. So I used a column value, which has no spaces within its value for where statement. Then it worked.


You can get more information about this issue from following link.


http://stackoverflow.com/questions/14511018/where-clause-doesnt-work-in-sql-because-of-space-character

How to Debug a Web Service running in Tomcat

Debugging a Web service running in tomcat is really useful some times. Following are the necessary steps for that.

1) Add following line to startup.bat file within  \bin location.

set CATALINA_OPTS=-Xdebug -Xnoagent -DJava.compiler=NONE Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000


2) Create a new eclipse debug configuration of type Remote Java Application for the project  and set its connection properties as below.
     Host: localhost
     Port:8000

3) Start tomcat and run the debug configuration.

Now, you can debug your web service.