Java Google NLP api无法找到TLS ALPN提供商;无可用的netty tcnative、Conscrypt或Jetty NPN/ALPN
我正在尝试使用谷歌自然语言处理api。我使用Maven添加库,并将Java Google NLP api无法找到TLS ALPN提供商;无可用的netty tcnative、Conscrypt或Jetty NPN/ALPN,java,maven,nlp,google-natural-language,Java,Maven,Nlp,Google Natural Language,我正在尝试使用谷歌自然语言处理api。我使用Maven添加库,并将GOOGLE\u应用程序\u凭证添加为环境变量,该变量具有包含我的服务帐户密钥的JSON文件的路径 它给了我一个错误找不到TLS ALPN提供程序;没有可用的netty tcnative、Conscrypt或Jetty NPN/ALPN try (LanguageServiceClient language = LanguageServiceClient.create()) { // The text t
GOOGLE\u应用程序\u凭证
添加为环境变量,该变量具有包含我的服务帐户密钥的JSON文件的路径
它给了我一个错误<代码>找不到TLS ALPN提供程序;没有可用的netty tcnative、Conscrypt或Jetty NPN/ALPN
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 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>
org.apache.maven.plugins
maven编译器插件
2.5.1
1.9
1.9
真的
真的
UTF-8
你能分享你的pom.xml和你用来构建的命令吗?它看起来像一个,你能分享你的依赖文件(pom.xml)和你正在使用的Maven版本吗?