【问题标题】:Google NLP api gives Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN availableGoogle NLP api 给出了 找不到 TLS ALPN 提供者;没有可用的 netty-tcnative、Conscrypt 或 Jetty NPN/ALPN
【发布时间】:2019-04-27 15:13:54
【问题描述】:

我正在尝试使用谷歌自然语言处理 api。我使用 Maven 添加库并添加 GOOGLE_APPLICATION_CREDENTIALSas 环境变量,该变量具有包含我的服务帐户密钥的 JSON 文件的路径。

这给了我一个错误; Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available

try (LanguageServiceClient language = LanguageServiceClient.create()) {

            // The text to analyze
            String text = "Hello, world!";
            Document doc = Document.newBuilder()
                    .setContent(text).setType(Type.PLAIN_TEXT).build();

            // Detects the sentiment of the text
            Sentiment sentiment = language.analyzeSentiment(doc).getDocumentSentiment();

            System.out.printf("Text: %s%n", text);
            System.out.printf("Sentiment: %s, %s%n", sentiment.getScore(), sentiment.getMagnitude());
        }catch(Exception e){
            System.out.println("Gevindu Error "+ e.getMessage());
        }

【问题讨论】:

  • 你能分享你的 pom.xml 和你用来构建的命令吗?
  • 它看起来像dependencies issue,你能分享你的依赖文件(pom.xml)和你正在使用的Maven版本吗?

标签: java maven nlp google-natural-language


【解决方案1】:

没有太多数据可以确定正确答案,但在我的情况下,错误是因为我使用的是 java 1.8 版,我将编译属性更改为 1.9 并且错误消失了:

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.5.1</version>
        <configuration>
            <source>1.9</source>
            <target>1.9</target>
            <optimize>true</optimize>
            <debug>true</debug>
            <encoding>UTF-8</encoding>
        </configuration>
    </plugin>

【讨论】:

    猜你喜欢
    • 2019-07-11
    • 2019-08-29
    • 2018-07-23
    • 2016-11-14
    • 2017-10-07
    • 1970-01-01
    • 1970-01-01
    • 2017-09-07
    • 2017-07-03
    相关资源
    最近更新 更多