De...a bug

Debugging should be a kind of sports of mind, rather than the labor of coders’ body.

When I used Activiti with Spring frameworks this morning, the console firstly throws an error about ORM, which “friendly” indicates I missed a jar for “ibatis”.

Then, I added ibatis-2.3.0.677.jar and ibatis-common-2.jar to the user library, as well as the build path. However, eclipse cried again, like baby. The error information was ambiguous.

Even worse, I am still enjoying my vocation in China now. Due to gfw(Great Fire Wall), there is no easy way to use google in China. So I tried to find if there is any conflict about the different versions of jars. I tried to replace them with differrent versions. Thanks to Gad, this time the error information became much clear.

1
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/ibatis/type/TypeReference

So, there was no TypeReference class in ibatis. How? I tried 2-3 times by using other ibatis jars, and it still didn’t work!!!

Finally, I went crazy, and spent $10 to buy a VPN account to break the GFW to reach Google. Ohhhhh…The list of the ibatis jar showed it exactly did not have such a class. This was not a version issue.

Only mybatis has the TypeReference class. Therefore, I used mybatis-3.1.0.jar instead.

####Lesson: Don’t blindly try before carefully thinking about the reasons behind the desk. If the method is wrong, you just get a more step further when you try one more time.