Eclipse 3.0M6 classloader is a little wonky

Jan 6, 2004 18:15 · 104 words · 1 minute read

I had a BeanShell script to configure a Hibernate Session that was working before Christmas. It stopped working, and I just traced the problem to Eclipse.

For those of you following the Eclipse 3.0 track, there appears to have been an odd change to the classloader that can cause problems under certain circumstances… In 3.0M5, SomeClass.class.getClassLoader() returns a reasonable classloader. In M6, that returns null, which can certainly throw things off when they’re expecting a valid classloader.

Hibernate’s Configuration.addClass method calls getClassLoader().getResourceAsStream(…) on the class you pass in. Obviously, this will give you a null pointer exception of the classloader returned is null… gah.