title: Java cryptography library sporadically fails to start
body: <p>We have a Java web application that sporadically fails to find cryptographic libraries.
  Currently restarting the application fixes the issue.</p>
  
  <p>The following expections appear in the logs, see below for full stack trace.</p>
  
  <pre><code>java.lang.InternalError: Could not start up the CDSA libraries.
  java.lang.NoClassDefFoundError: Could not initialize class com.apple.crypto.provider.HmacMD5
  </code></pre>
  
  <p>The application is built using <code>Java 1.6.0_15</code> and is deployed to <code>1.6.0_13</code> running on 
  <code>Mac OS X Server 10.5.8 (9L30)</code></p>
  
  <p>Any ideas ? </p>
  
  <p>Cheers </p>
  
  <p>Jono</p>
  
  <pre><code>Build Java version
  java version "1.6.0_13"
  Java(TM) SE Runtime Environment (build 1.6.0_13-b03-211)
  Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02-83, mixed mode)
  
  Deployed Jave version
  java version "1.6.0_15"
  Java(TM) SE Runtime Environment (build 1.6.0_15-b03-226)
  Java HotSpot(TM) 64-Bit Server VM (build 14.1-b02-92, mixed mode)
  
  Full stack trace:
  
  java.lang.NoClassDefFoundError: Could not initialize class com.apple.crypto.provider.HmacMD5
         at java.lang.ClassLoader$NativeLibrary.load(Native Method)
         at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1881)
         at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1782)
         at java.lang.Runtime.loadLibrary0(Runtime.java:823)
         at java.lang.System.loadLibrary(System.java:1047)
         at com.apple.crypto.provider.HmacCore.&lt;clinit&gt;(HmacCore.java:26)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
         at java.lang.Class.newInstance0(Class.java:355)
         at java.lang.Class.newInstance(Class.java:308)
         at java.security.Provider$Service.newInstance(Provider.java:1221)
         at javax.crypto.Mac.a(DashoA13*..)
         at javax.crypto.Mac.init(DashoA13*..)
         at com.sun.net.ssl.internal.ssl.MAC.&lt;init&gt;(MAC.java:94)
         at com.sun.net.ssl.internal.ssl.CipherSuite$MacAlg.newMac(CipherSuite.java:429)
         at com.sun.net.ssl.internal.ssl.Handshaker.newWriteMAC(Handshaker.java:407)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.changeWriteCiphers(SSLSocketImpl.java:1791)
         at com.sun.net.ssl.internal.ssl.Handshaker.sendChangeCipherSpec(Handshaker.java:607)
         at com.sun.net.ssl.internal.ssl.ClientHandshaker.sendChangeCipherAndFinish(ClientHandshaker.java:868)
         at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:794)
         at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:226)
         at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:516)
         at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:454)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:884)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1112)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:623)
         at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)
         at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
         at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
         at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:506)
         at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114)
         at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096)
         at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
         at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
         at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
         at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
  </code></pre>