Posted in General

Java Class Not Found

Getting class not found? But the Class is available in classpath? Well it usually should work, but I have seen a senario where it does not. Its because the ClassLoad is null, we had this issue when using Cold Fusion 4.5. One could argue that its bug in Cold Fusion’s class loading mechanisum. Regardless it was not a time to play the blame game, we needed to resolve the issue and we cannot upgrade the Cold Fusion due to Corporate policies & tight deadlines. The hack which worked is:

ClassLoader cl = Thread.currentThread().getContextClassLoader();
if(cl==null)
Thread.currentThread().setContextClassLoader(ClassLoader.getSystemClassLoader());

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s