【问题标题】:OpenGrok And Tomcat 404 not found未找到 OpenGrok 和 Tomcat 404
【发布时间】:2023-06-19 19:58:01
【问题描述】:

我正在尝试在全新的 Linux 环境中设置 OpenGrok。我已按照以下说明进行操作:https://github.com/oracle/opengrok/wiki/How-to-setup-OpenGrok

设置 OpenGrok 和 Tomcat 后,我​​已将 source.war 从 Opengrok 复制到 Tomcat/webapps。当我尝试连接 http://localhost:8080/source 时复制后它总是给我这个 404 not found 错误:

HTTP Status 404 – Not Found
Type Status Report

Message The requested resource [/source] is not available

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

Apache Tomcat/9.0.48

我使用的是最新的 OpenGrok 版本和 Tomcat 版本:Apache Tomcat/9.0.48

这是来自 OpenGrok 日志的详细错误:

11:49:08 SEVERE: Couldn't notify the webapp on http://localhost:8080/source.
jakarta.ws.rs.NotFoundException: HTTP 404 Not Found
        at org.glassfish.jersey.client.JerseyInvocation.convertToException(JerseyInvocation.java:916)
        at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:723)
        at org.glassfish.jersey.client.JerseyInvocation.lambda$invoke$1(JerseyInvocation.java:643)
        at org.glassfish.jersey.client.JerseyInvocation.call(JerseyInvocation.java:665)
        at org.glassfish.jersey.client.JerseyInvocation.lambda$runInScope$3(JerseyInvocation.java:659)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:205)
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:390)
        at org.glassfish.jersey.client.JerseyInvocation.runInScope(JerseyInvocation.java:659)
        at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:642)
        at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:417)
        at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:313)
        at org.opengrok.indexer.index.IndexerUtil.enableProjects(IndexerUtil.java:79)
        at org.opengrok.indexer.index.Indexer.main(Indexer.java:334)

Couldn't notify the webapp on http://localhost:8080/source: HTTP 404 Not Found.
11:49:09 SEVERE: Failed to send configuration to http://localhost:8080/source (is web application server running with opengrok deployed?)
java.io.IOException: InboundJaxrsResponse{context=ClientResponse{method=PUT, uri=http://localhost:8080/source/api/v1/configuration?reindex=true, status=405, reason=Method Not Allowed}}
        at org.opengrok.indexer.configuration.RuntimeEnvironment.writeConfiguration(RuntimeEnvironment.java:1427)
        at org.opengrok.indexer.index.Indexer.sendToConfigHost(Indexer.java:1149)
        at org.opengrok.indexer.index.Indexer.main(Indexer.java:378)

需要帮助来解决这个 404 tomcat 错误并设置 opengrok。

提前致谢

【问题讨论】:

    标签: tomcat servlets tomcat9 opengrok


    【解决方案1】:

    在您引用的installation page 上,根据要求您发现:

    像 GlassFish 或 Tomcat 这样的 servlet 容器10.0 或更高版本

    (强调我的)。

    source.war 是 Jakarta EE 9 应用程序,它不适用于 Tomcat 9.0。由于version 1.6.0 OpenGrok 需要一个 Servlet 5.0 容器。

    【讨论】:

    • 就是这样,我更改了 Tomcat 版本,它工作。那是一个愚蠢的错误。谢谢 Piotr P.