【问题标题】:Connecting to data source using ssl in Karaf, getting java.lang.NoClassDefFoundError: javax/net/ssl/TrustManager在 Karaf 中使用 ssl 连接到数据源,得到 java.lang.NoClassDefFoundError: javax/net/ssl/TrustManager
【发布时间】:2018-03-20 21:22:17
【问题描述】:

我正在运行 Servicemix 6.1.3。我有一个使用 ssl 的数据源(.cfg 文件):

url=jdbc:mysql://mysqlcluster-test.dot.com:3306/mydb?useSSL=true
user=cs_dev
password=mypwd

当我部署我的包时,我收到以下错误消息:

2018-03-20 14:02:51,054 | ERROR | mix-6.1.3/deploy | JdbcMessageIdRepository          | 251 - org.apache.camel.camel-sql - 2.16.4 | Can't create table for JdbcMessageIdRepository with query 'CREATE TABLE  MYTABLE(name VARCHAR(255), id VARCHAR(100), createdAt TIMESTAMP)' because of: Could not get JDBC Connection; nested exception is java.sql.SQLException: java.lang.NoClassDefFoundError: javax/net/ssl/TrustManager. This may be a permissions problem. Please create this table and try again.
2018-03-20 14:02:51,056 | ERROR | mix-6.1.3/deploy | BlueprintCamelContext            | 156 - org.apache.camel.camel-blueprint - 2.16.4 | Error occurred during starting Camel: CamelContext(SystemIntegration.cu) due Could not get JDBC Connection; nested exception is java.sql.SQLException: java.lang.NoClassDefFoundError: javax/net/ssl/TrustManager
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: java.lang.NoClassDefFoundError: javax/net/ssl/TrustManager
    at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)[250:org.apache.servicemix.bundles.spring-jdbc:3.2.17.RELEASE_1]
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:382)[250:org.apache.servicemix.bundles.spring-jdbc:3.2.17.RELEASE_1]
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:428)[250:org.apache.servicemix.bundles.spring-jdbc:3.2.17.RELEASE_1]
    at org.apache.camel.processor.idempotent.jdbc.JdbcMessageIdRepository$1.doInTransaction(JdbcMessageIdRepository.java:70)[251:org.apache.camel.camel-sql:2.16.4]
    at org.apache.camel.processor.idempotent.jdbc.JdbcMessageIdRepository$1.doInTransaction(JdbcMessageIdRepository.java:60)[251:org.apache.camel.camel-sql:2.16.4]
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131)[144:org.apache.servicemix.bundles.spring-tx:3.2.17.RELEASE_1]
    at org.apache.camel.processor.idempotent.jdbc.JdbcMessageIdRepository.doStart(JdbcMessageIdRepository.java:60)[251:org.apache.camel.camel-sql:2.16.4]
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)[151:org.apache.camel.camel-core:2.16.4]
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74)[151:org.apache.camel.camel-core:2.16.4]
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)[151:org.apache.camel.camel-core:2.16.4]
    at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103)[151:org.apache.camel.camel-core:2.16.4]
    ...

为了通过 ssl 使用数据源,我必须做什么?

【问题讨论】:

    标签: java mysql ssl apache-karaf apache-servicemix


    【解决方案1】:

    我认为您可能希望将服务器的证书与您的受信任证书一起添加到 KeyStore。

    有很多方法可以实现,但一个简单的解决方案是编译和运行

    this program

    作为

    java InstallCert hostname
    

    请试一试,让我们知道它是否适合您。

    【讨论】:

    • 谢谢,你写的“服务器”是指数据库服务器吗?
    • 是的.. 数据库服务器主机。请试一试并确认是否适合您。
    • 它在哪里?在 db 服务器上还是在应用程序服务器上?
    • 您需要在应用程序所在的应用服务器(主机)上运行“installcert”。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-24
    相关资源
    最近更新 更多