Google NLP api给出找不到TLS ALPN提供程序;没有可用的netty-tcnative,Conscrypt或Jetty NPN / ALPN

问题描述 投票:5回答:1

我正在尝试使用Google自然语言处理API。我使用Maven添加库,并添加GOOGLE_APPLICATION_CREDENTIALS作为环境变量,该变量具有包含我的服务帐户密钥的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());
        }
java maven nlp google-natural-language
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.