ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Larry Meadors" <Larry.Mead...@plumcreek.com>
Subject Re: java.lang.NoClassDefFoundError when using ibatis
Date Tue, 04 Jan 2005 04:46:06 GMT
>>> dody@heavyarms.net 01/03/05 7:41 PM >>>
> ...
> I have ibatis jar files in lib and also in shared lib in tomcat :(

OK, this is a bad thing. 

Never, ever put jar files for tomcat in more that one location. The
problem that arises when you do that is that you will get class cast
exceptions comparing classes that are identical, but loaded by different
classloaders. That is a real bugger to track down, I can tell you that
from experience. :-)

IMO, you should almost always put your jars in the WEB-INF/lib
directory. That way, each application can be modified independently, so
if you have an application that *has* to work, you can test different
jars in other applications without the risk of breaking the critical
one. The only exception to that rule may be if you have a JNDI-based
data source that has to have the driver in common/lib, but back to the
problem...  :-)

I have seen cases where a NoClassDefFoundError will be thrown when the
real culprit was an exception in a static initializer - if the static
init fails, the class is not loaded. The first error you will get is the
init exception, but the second it the NCDF error. Is that a possibility

> Perhaps i'm missing something, please let me know.

Perhaps? ;-)

Try recompiling with debugging info, that will provide more information,
and try to figure out where tomcat is putting the logs.

You may also want to try running in a debugger with a breakpoint on
NoClassDefFoundError to see where it is coming from.


View raw message