Wednesday, December 4, 2013

NoClassDefFoundError: Could not initialize class org.apache.axis.client.AxisClient

Have you ever met this Exception while you were running your java program? Were you surprised why the program complied although some class was missing? OK, here is my experience concerning this nice exception, the cause and the treatment.

1- First I double checked that the axis.jar is included in the project (actually if not included it wont compile).
2- I checked  that the mentioned class was there with its correct path.
3- I started googling the problem, got across some solutions, One of which suggested that I was using the wrong version of axis jar, and that the issue arose because the webservice client that was using this Axis class is developed using axis2 while I was using axis1 jar, so I downloaded axis2 jar, tried it, but didn't work for sure. the packages inside are not the same at all - this wasn't my solution
4- Another one suggested it was a problem with plugin activation in eclipse... I didn't get deep into exploring this solution, It seemdd to me out of scope.
5- Another one suggested a good answer, that's instead of missing class definition, It might be rather a duplicate class definition. i.e. you are using another jar that has the same path in it, or a duplicate path for a class that your axis client needs

You noted the red statement? Yes. Although the previous point wasn't the solution, It gave me a clue. the jar might be dependent on some other resource.

6- So, As usual I went to my friend "findjar", and asked him about the jar I was using which was axis1.4, checked Its dependendies (in the "Depends On" section) I found that it was depending the following jars : 

I downloaded the missing jars, tried again and it worked a piece of cake. 

Hope it helps

3 comments:

  1. Thanks. Your solution worked for me.

    ReplyDelete
  2. Thanks a ton!!! Your solution worked for me too.

    ReplyDelete
  3. thank very so much for your help. Your tip saved me, God bless you.

    ReplyDelete