【问题标题】:FirestoreException - Could not find TLS ALPN provider - no working netty-tcnativeFirestoreException - 找不到 TLS ALPN 提供程序 - 没有工作的 netty-tcnative
【发布时间】:2019-08-29 22:19:00
【问题描述】:

我有一个用 Java/Kotlin 制作的桌面应用,带有 Firebase(特别是 Firestore 实时)连接。

它在我的笔记本(通过 Parallels 的 Windows)和其他一些经过 Windows 测试的笔记本中都能正常工作。但是,在某些电脑中,我总是会收到错误消息:

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

我尝试了一些 jar 的创建变体,但没有任何帮助。

这是我当前的 build.gradle 连接:

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"
}

【问题讨论】:

    标签: google-cloud-firestore netty alpn


    【解决方案1】:

    我在 Docker 容器中启动 FireBase 应用程序时遇到了同样的问题。

    在我的情况下,我必须更改基本图像 - 从 openjdk:8-jdk-alpineopenjdk:8

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

    【讨论】:

      【解决方案2】:

      我在使用 Firebase-Firestore 时遇到了同样的问题(在 Java 服务器应用程序中,没有 android),它与 Java 版本有关。

      我使用的是 openjdk 8u191-jre-alpine3.9,在切换到 openjdk 13-ea-16-jdk-alpine3.9 后修复。

      P.D:在 Google 上搜索,我发现了一些关于为 grpc、netty 等添加一些依赖项的条目,但它们对我不起作用。

      【讨论】:

        【解决方案3】:

        每个人都一直说要添加库,我的应用程序在 Netbeans 中运行时通过 IDE 运行良好。但是当我通过 Launch4J 编译以制作 .EXE 文件时,它一直抛出这个异常...我提供了我自己的 JRE /JDK 到 .EXE 包装器..

        我读了又读.. 有人说更新 java... 我有 Java 1.8 但它是从 2018 年 1 月开始的或类似的旧版本.. 我更新到最新的 Java 1.8 JDK 以提供给我的.EXE 包装形式的应用程序,并且walla .. 它有效! Firestore 没有 tcnative TLS 异常!

        希望这会有所帮助!

        【讨论】:

          猜你喜欢
          • 2019-07-11
          • 2019-04-27
          • 2017-07-03
          • 2016-11-14
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2021-05-05
          • 2020-04-12
          相关资源
          最近更新 更多