gpt4 book ai didi

Java Firebase 错误 "NoClassDefFoundError: org/apache/http/conn/ssl/StrictHostnameVerifier"

转载 作者:行者123 更新时间:2023-11-30 03:04:51 25 4
gpt4 key购买 nike

我有一个非常简单的 servlet 程序,可以在谷歌应用程序引擎上正常运行。现在,当我添加 firebase 对象以进行子值更新调用时,它在 appengine 和本地 apache tomcat 上显示服务器错误 500,它还显示一些错误。这是我的代码

package com.example.appengine.helloworld;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.firebase.client.Firebase;
import com.firebase.client.FirebaseException;

@SuppressWarnings("serial")
public class HelloServlet extends HttpServlet {

@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException,FirebaseException {


PrintWriter out = resp.getWriter();
out.println("Hello, world");
Firebase fire = new Firebase("https://fiery-fire-0.firebaseio.com/");
fire.child("hello").setValue("Nothing is in here");
}
}

这是在apache tomcat上运行时出现的错误

    Exception in thread "TubeSockReader-1" java.lang.NoClassDefFoundError: org/apache/http/conn/ssl/StrictHostnameVerifier
at com.firebase.tubesock.WebSocket.verifyHost(WebSocket.java:287)
at com.firebase.tubesock.WebSocket.createSocket(WebSocket.java:271)
at com.firebase.tubesock.WebSocket.runReader(WebSocket.java:306)
at com.firebase.tubesock.WebSocket.access$000(WebSocket.java:30)
at com.firebase.tubesock.WebSocket$2.run(WebSocket.java:108)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.http.conn.ssl.StrictHostnameVerifier
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1854)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1703)
... 6 more

在谷歌应用程序引擎上运行它时,它只是说

Error: Server Error

The server encountered an error and could not complete your request.
Please try again in 30 seconds.

请帮助我!

最佳答案

您的 http 客户端库版本似乎没有(现已弃用)类 StrictHostnameVerifier。

https://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/conn/ssl/StrictHostnameVerifier.html

尝试手动包含 httpclient 4.0.1 而不是“最新”(尽管根据文档它应该出现在 4.5.1 中)。

关于Java Firebase 错误 "NoClassDefFoundError: org/apache/http/conn/ssl/StrictHostnameVerifier",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35045231/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com