How to fix javax.net.ssl.SSLHandshakeException: General OpenSslEngine poblem at io.netty.handler.ssl.ReferenceCountedOpenSslEngine.handshakeException

Jalim Otilio Vera Morales 0 Reputation points
2023-04-13T06:22:40.64+00:00

Hello, I have a problem consuming my cosmos database service, I am using java and Spring as a framework, when I send a request it generates the following error, could someone guide me or help me if I need to install an extra certificate or am i omitting something?

My configuration

package com.techestop.azurecosmosdbcrud.config;

import com.azure.cosmos.CosmosClientBuilder;
import com.azure.cosmos.DirectConnectionConfig;
import com.azure.spring.data.cosmos.config.AbstractCosmosConfiguration;
import com.azure.spring.data.cosmos.config.CosmosConfig;
import com.azure.spring.data.cosmos.core.ResponseDiagnostics;
import com.azure.spring.data.cosmos.core.ResponseDiagnosticsProcessor;
import com.azure.spring.data.cosmos.repository.config.EnableCosmosRepositories;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.lang.Nullable;

@Configuration
@EnableConfigurationProperties(CosmosProperties.class)
@EnableCosmosRepositories(basePackages = "com.techestop.azurecosmosdbcrud.repository")
@PropertySource("classpath:application.properties")
public class CosmosCrudAppConfiguration extends AbstractCosmosConfiguration {
    private static final Logger logger = LoggerFactory.getLogger(CosmosCrudAppConfiguration.class);

    @Autowired
    private CosmosProperties properties;

    @Bean
    public CosmosClientBuilder cosmosClientBuilder() {
        DirectConnectionConfig directConnectionConfig = DirectConnectionConfig.getDefaultConfig();
        return new CosmosClientBuilder()
            .endpoint(properties.getUri())
            .key(properties.getKey())
            .directMode(directConnectionConfig);
    }

    @Bean
    public CosmosConfig cosmosConfig() {
        return CosmosConfig.builder()
                           .responseDiagnosticsProcessor(new ResponseDiagnosticsProcessorImplementation())
                           .enableQueryMetrics(properties.isQueryMetricsEnabled())
                           .build();
    }

    @Override
    protected String getDatabaseName() {
        return "ToDoList";
    }

    private static class ResponseDiagnosticsProcessorImplementation implements ResponseDiagnosticsProcessor {

        @Override
        public void processResponseDiagnostics(@Nullable ResponseDiagnostics responseDiagnostics) {
            logger.info("Response Diagnostics {}", responseDiagnostics);
        }
    }
}

Properties

azure.cosmos.uri=https://myappdbcosmos1.documents.azure.com:443/
azure.cosmos.database=appdb
azure.cosmos.key=UBjQL76YdY44jxw6SZ8t2OCoLJ8MSSDtWpTtvAx8YGx9ZJuJPi6vAZDsw2GLvpQzvM0FyFESzZegACDbvOh36w==
azure.cosmos.secondaryKey=x9Xp6U6ZoNUMdClpxdCvjMls2Weng3TxrzPCgOSdkX46W1fIRK6AxCkdND3Sp7o8MbCcPZzfrUIxACDbN5udFg==

My error


Network failure

javax.net.ssl.SSLHandshakeException: General OpenSslEngine problem
	at io.netty.handler.ssl.ReferenceCountedOpenSslEngine.handshakeException(ReferenceCountedOpenSslEngine.java:1883) ~[netty-handler-4.1.67.Final.jar:4.1.67.Final]
Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,902 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.