This one took me a while to figure out.
I’m a beginner with the Apache Axis web services platform on the Apache Tomcat 5.5.x container and I’m using version 1.4, so I was delighted when I found it to be so easy to get into. I used this tutorial – the second page is a step-by-step deployment for a simple service.
All was going well, even when I made updates to the classes behind the service. Redeploying the service behaved perfectly. Until… I deployed an update and everything broke.
I mean everything broke. I couldn’t even list the available services, nor view a WSDL. Proper broken. Everything. In the Tomcat logs, all I could see was a NoClassDefFoundError (which means that the class you’re trying to use in your code isn’t available to the JVM).
Which made absolutely no sense. All the classes making up the service were clearly present. I had made a change to the internal logic of one of the classes, but nothing that introduced anything outside the classes present in any JRE.
So I reverted to the previous version and everything was fine again. Which was nice, but less than ideal.
So I went back to basics – what had I changed, as that must be the cause of the problem. In fact, I’d made a socket port number configurable… and in the process, I was trying open a connection to a port north of 65535, which would naturally cause an IllegalArgumentException to be thrown, and a large but silent explosion in my code. So I’m an idiot – I still deserve a half-decent exception. It was only a prototype anyway…
Anyway, having spotted that, I fixed the problem, redeployed and everything was peachy.
The moral of the story… if you’re getting a problem that looks like this, it might just be that your code isn’t able to start up properly – which is very much hidden by a NoClassDefFoundError.
I guess you get this kind of error because Axis relies on reflection for a lot of its magic, but I didn’t find it particularly helpful, and the zillion-call-deep stacktrace didn’t help much either. I still don’t know where the real root cause exception got squirrelled away to, if anywhere.
That said, I’m liking Axis in the main, so I’ll be persevering – as well and trying out other platforms for this brand of magic.