java.security.NoSuchAlgorithmException:为SSLContext配置的类

时间:2013-08-26 18:01:54

标签: java security database-connection

我正在开发一个独立的Java应用程序,它将被打包为一个jar文件(OSGi插件),并将在Jboss AS 7.1上部署的EAR中运行当我尝试连接到Microsoft SQLServer 10时使用JDBC type 4驱动程序(sqljdbc4.jar)我得到以下Exception

    com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish   
   a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption.   
   Error: "class configured for SSLContext:  
  sun.security.ssl.SSLContextImpl$TLS10Context not a SSLContext".

    Caused by: java.security.NoSuchAlgorithmException: class configured for 
     SSLContext:  sun.security.ssl.SSLContextImpl$TLS10Context not a SSLContext

  C14:30:34,169 ERROR [stderr] (default-short-running-threads-threads - 13)            
    at sun.security.jca.GetInstance.checkSuperClass(GetInstance.java:258).

注意:应用程序在eclipse中运行正常。但是在将它作为一个jar并部署到Jboss之后它会抛出异常

我的jar目录结构

 MYApp
 |
 |src
  |  
  |   
  | 
   META-INF
   |
    lib
     | 
       sqljdbc4.jar
       rt.jar
       jsse.jar

1 个答案:

答案 0 :(得分:0)

从您的案例rt.jarjsse.jar中的lib目录中删除与java相关的jar,并将xmlbeans.jar, xbean.jar, xml-apis添加到您的库中。