FirestoreException - Could not find TLS ALPN provider - no working netty-tcnative
Asked Answered
B

4

5

I have a desktop app made in Java/Kotlin with Firebase (specifically Firestore realtime) connection.

It works properly in my notebook (Windows via Parallels) and in some others Windows tested. But, in some pcs I always get an error:

com.google.cloud.firestore.FirestoreException: java.lang.IllegalStateException: Could not find TLS ALPN provider; no working netty tcnative, Conscrypt, or Jetty NPN/ALPN available.

I tried some jar`s creation variations and nothing helped me.

It's my current build.gradle connection:

plugins {
    id 'java'
    id 'org.jetbrains.kotlin.jvm' version '1.3.21'
}

jar {
    manifest {
        attributes 'Main-Class': 'main.LoginActivity'
    }
}

// java -cp Y:\Desktop\nwebprint\out\artifacts\nwebprint_main_jar\nwebprint.main.jar main.LoginActivity

group 'nwebprint'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

version = '1.0'
sourceCompatibility = 1.7
targetCompatibility = 1.7

//create a single Jar with all dependencies
task fatJar(type: Jar) {
    manifest {
        attributes 'Implementation-Title': 'Notary Web Service',
                'Implementation-Version': version,
                'Main-Class': 'main.LoginActivity'
    }
    baseName = project.name + '-all'
    from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
    with jar
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
    testCompile group: 'junit', name: 'junit', version: '4.12'

    compile ('com.google.firebase:firebase-admin:6.8.0') {
        exclude( group: 'com.google.guava')
    }

    compile 'com.google.guava:guava:20.0'

    // compile 'io.grpc:grpc-netty-shaded'
}

compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
Besides answered 8/4, 2019 at 17:43 Comment(0)
H
4

I had the same problem when was starting FireBase application in Docker container.

In my case i had to change base image - from openjdk:8-jdk-alpine to openjdk:8

source: https://gitmemory.com/issue/grpc/grpc-java/5369/493463266

Houdan answered 20/10, 2019 at 10:21 Comment(0)
B
1

I had the same issue with Firebase-Firestore (in a Java server application, no android) and it was related to the Java version.

I was using openjdk 8u191-jre-alpine3.9 and it was fixed after switching to openjdk 13-ea-16-jdk-alpine3.9.

P.D: searching on Google, I found some entries about adding some dependencies for grpc, netty, etc but they didn't work for me.

Butternut answered 29/4, 2019 at 23:46 Comment(0)
A
1

Everyone kept saying to add libraries, my app works fine in Netbeans when ran through the IDE.. but when I compile through Launch4J to make a .EXE file, it kept throwing this exception... I was supplying my own JRE/JDK to the .EXE wrapper..

I read and read.. somewhere there was someone saying update java... I had Java 1.8 but it was from Jan 2018 or something old like that.. I updated to the latest Java 1.8 JDK for what I supply to my app in .EXE wrapper form, and walla.. it works! no tcnative TLS exception from Firestore!

Hope this helps!

Aran answered 6/6, 2019 at 16:14 Comment(0)
V
0

I have the same problem. This is the stacktrace I have in my linux alpine 3.9:

2022-12-22 18:56:25,126 ERROR BaseQueueProcessCallback:41 - Error en 
ejecucion cola:java.lang.IllegalStateException: Could not find TLS ALPN 
provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN 
available
com.google.cloud.firestore.FirestoreException: 
java.lang.IllegalStateException: Could not find TLS ALPN provider; no 
working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available
    at 
  com.google.cloud.firestore.FirestoreException.forIOException(FirestoreException.java:94)
    at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreRpcFactory.create(FirestoreOptions.java:91)
    at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreRpcFactory.create(FirestoreOptions.java:81)
    at com.google.cloud.ServiceOptions.getRpc(ServiceOptions.java:560)
    at com.google.cloud.firestore.FirestoreOptions.getFirestoreRpc(FirestoreOptions.java:365)
    at com.google.cloud.firestore.FirestoreImpl.<init>(FirestoreImpl.java:72)
    at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreFactory.create(FirestoreOptions.java:72)
    at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreFactory.create(FirestoreOptions.java:65)
    at com.google.cloud.ServiceOptions.getService(ServiceOptions.java:540)
    at com.google.firebase.cloud.FirestoreClient.<init>(FirestoreClient.java:51)
    at com.google.firebase.cloud.FirestoreClient.<init>(FirestoreClient.java:29)
    at com.google.firebase.cloud.FirestoreClient$FirestoreClientService.<init>(FirestoreClient.java:95)
    at com.google.firebase.cloud.FirestoreClient.getInstance(FirestoreClient.java:85)
    at com.google.firebase.cloud.FirestoreClient.getFirestore(FirestoreClient.java:78)
    at com.google.firebase.cloud.FirestoreClient.getFirestore(FirestoreClient.java:64)
    at com.areateclab.survey.server.firebase.FirebaseDAO.getDB(FirebaseDAO.java:36)
    at com.areateclab.survey.server.firebase.FirebaseDAO.createDocument(FirebaseDAO.java:42)
    at com.areateclab.survey.server.queue.survey.SurveyQueueProcess.execute(SurveyQueueProcess.java:26)
    at com.areateclab.survey.server.queue.survey.SurveyQueueProcess.execute(SurveyQueueProcess.java:15)
    at com.areateclab.survey.server.queue.QueueRecord.execute(QueueRecord.java:49)
    at com.areateclab.survey.server.queue.QueueProcessConsumer.run(QueueProcessConsumer.java:59)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: java.lang.IllegalStateException: Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available
    at com.google.cloud.firestore.spi.v1.GrpcFirestoreRpc.<init>(GrpcFirestoreRpc.java:141)
    at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreRpcFactory.create(FirestoreOptions.java:89)
    ... 20 more
 Caused by: java.lang.IllegalStateException: Could not find TLS ALPN 
 provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available
    at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.defaultSslProvider(GrpcSslContexts.java:246)
    at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:146)
    at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.forClient(GrpcSslContexts.java:95)
    at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder$DefaultProtocolNegotiator.newNegotiator(NettyChannelBuilder.java:623)
    at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder.buildTransportFactory(NettyChannelBuilder.java:529)
    at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder$NettyChannelTransportFactoryBuilder.buildClientTransportFactory(NettyChannelBuilder.java:188)
    at io.grpc.internal.ManagedChannelImplBuilder.build(ManagedChannelImplBuilder.java:630)
    at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:264)
    at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createSingleChannel(InstantiatingGrpcChannelProvider.java:360)
    at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.access$1800(InstantiatingGrpcChannelProvider.java:81)
    at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider$1.createSingleChannel(InstantiatingGrpcChannelProvider.java:231)
    at com.google.api.gax.grpc.ChannelPool.create(ChannelPool.java:72)
    at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createChannel(InstantiatingGrpcChannelProvider.java:241)
    at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.getTransportChannel(InstantiatingGrpcChannelProvider.java:219)
    at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:199)
    at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:133)
    at com.google.cloud.firestore.spi.v1.GrpcFirestoreRpc.<init>(GrpcFirestoreRpc.java:126)
    ... 21 more

My environment is:

Azure app service Linux Alpine 3.9

Tomcat 8.5

Java server app connected to Firebase thru Firestore Admin SDK

Java version running on my linux report:

02c3d1e2371f:/home# java -version
Picked up JAVA_TOOL_OPTIONS:  -Djava.net.preferIPv4Stack=true
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (Zulu 8.38.0.13-linux-musl-x64)-Microsoft- 
Azure-restricted (build 1.8.0_212-b04)
OpenJDK 64-Bit Server VM (Zulu 8.38.0.13-linux-musl-x64)-Microsoft-Azure- 
restricted (build 25.212-b04, mixed mode)

I am still having this issue, don't know how to solved it.

Var answered 23/12, 2022 at 13:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.