Issue
I am facing an issue while trying to use camel debezium sql server connector. I am trying to capture data changes in sql server db table using camel debezium sql server connector and sink them to message broker. I know JDBC sql server connection has option to make encrypt false to prevent this issue. But I can't find a similar way in camel debezium sql server connector.
To use camel debezium sql server connector, I was following this documentation:
https://camel.apache.org/components/3.18.x/debezium-sqlserver-component.html#_samples
When I run the app it shows me following error:
ERROR io.debezium.embedded.EmbeddedEngine - Error while trying to run connector class 'io.debezium.connector.sqlserver.SqlServerConnector'
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target".
My POM is as follows:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
<version>3.18.1-SNAPSHOT</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-main</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-debezium-sqlserver</artifactId>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>11.2.0.jre11</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jackson</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-kafka</artifactId>
</dependency>
</dependencies>
I am using: spring-boot:2.7.2
SQL Server:docker image: mcr.microsoft.com/mssql/server:2022-latest
Kafka image: confluentinc/cp-zookeeper:latest
Can anyone help me to resolve this issue?
Solution
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>9.2.1.jre11</version>
</dependency>
Finally I was able to solve the issue by downgrading the mssql-jdbc driver to the above one.
Answered By - Fly Leaf
Answer Checked By - Katrina (JavaFixing Volunteer)