• 1 reply
  • Latest Post - ‏2010-03-26T09:02:31Z by SystemAdmin
1 Post

Pinned topic Getting the error Exception in thread "main" java.lang.NoClassDefFoundError

‏2010-03-25T19:31:38Z |

I am working on AIX-IBM box with java 1.4.2. Am trying to run a program which basically is written with sun jre in mind, however in this special case I need to run the program on the Aix box.

Initially I was getting the error,
"Caused by: java.lang.RuntimeException: cannot find JSSE security provider: check CLASSPATH"

This was resolved by adding the sun providers onto the file,

Now however I am getting the below error message,
TibjmsSSL: client identity not set, using empty identity.
Exception in thread "main" java.lang.NoClassDefFoundError: sun/security/validator/KeyStores
I am guessing it could be something to with the following line inthe file,
but not sure what needs to be changed.

Can anybody help me out on this.
Updated on 2010-03-26T09:02:31Z at 2010-03-26T09:02:31Z by SystemAdmin
  • SystemAdmin
    2262 Posts

    Re: Getting the error Exception in thread "main" java.lang.NoClassDefFoundError

    All these problems come due to directly invoking Sun provider classes in your code. That is not a good move if you require portability between JDK vendors or even Java versions. For example, the same code that worked on IBM JDK 5 may not work on 6 if you explicitly call provider classes, because they can vary widely between vendors/releases.

    I don't know what you're trying to do in your program- but the simplest way to make it work across JDK versions/distributions is to remove explicit invocations to security providers.

    For example, if you want to create a MessageDigest with the SHA algorithm, you can initialize it by using
    . If you use the first version, the security architecture will simply query all providers listed in the file and automatically pick the first one that can support the requested algorithm. Whereas if you specify the provider class, your code will break if you move it to another JDK that uses a different set of providers.
    Updated on 2014-03-24T22:06:41Z at 2014-03-24T22:06:41Z by iron-man