连接到 Apache James WebAdmin 时未找到错误 404

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

我已成功安装并启动 Apache James。

当我尝试连接 WebAdmin 时,它显示:

{"statusCode":404,"type":"notFound","message":"GET / can not be found","details":null}

所以我无法访问 WebAdmin。我按照官方文档...安装jdk 11,下载JPA Guice二进制文件,配置然后运行。

从文档中我了解到 WebAdmin 的唯一文件conf是conf/webadmin.properties,但在此文件中只有端口和主机的参数。

java mail-server centos8 apache-james
1个回答
0
投票

确保你的java版本是11

$ java -version
openjdk version "11.0.18" 2023-01-17
OpenJDK Runtime Environment Temurin-11.0.18+10 (build 11.0.18+10)
OpenJDK 64-Bit Server VM Temurin-11.0.18+10 (build 11.0.18+10, mixed mode)

下载 james-server-jpa-guice

https://james.apache.org/download.cgi

Apache James 3.8.0 是最新的稳定版本

JPA James 服务器的二进制(ZIP 格式):james-server-jpa-guice.zip

https://www.apache.org/dyn/closer.lua/james/server/3.8.0/james-server-jpa-guice.zip

解压 james-server-jpa-guice.zip

unzip james-server-jpa-guice.zip

转到目录

cd james-server-jpa-guice

生成ketstore文件

keytool -genkey -alias james -keyalg RSA -keystore conf/keystore

输入密钥库密码

输入密码:

james72laBalle
(使用此密码可以找到imapserver.xml)

运行 JPA James 服务器

sudo PATH=$PATH sh -c "java -javaagent:james-server-jpa-app.lib/openjpa-3.2.0.jar \
  -Dworking.directory=. \
  -Djdk.tls.ephemeralDHKeySize=2048 \
  -Dlogback.configurationFile=conf/logback.xml \
  -jar james-server-jpa-app.jar"

参考文档:https://james.apache.org/server/manage-webadmin.html

打开另一个终端

$ curl -XGET http://localhost:8000/healthcheck
{"status":"healthy","checks":[{"componentName":"Guice application lifecycle","escapedComponentName":"Guice%20application%20lifecycle","status":"healthy","cause":null},{"componentName":"MailReceptionCheck","escapedComponentName":"MailReceptionCheck","status":"healthy","cause":null},{"componentName":"EventDeadLettersHealthCheck","escapedComponentName":"EventDeadLettersHealthCheck","status":"healthy","cause":null},{"componentName":"EmptyErrorMailRepository","escapedComponentName":"EmptyErrorMailRepository","status":"healthy","cause":null},{"componentName":"Embedded ActiveMQ","escapedComponentName":"Embedded%20ActiveMQ","status":"healthy","cause":null}]}

您可以将管道添加到jq以获取格式json

$ curl -XGET http://localhost:8000/healthcheck | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   658    0   658    0     0  38705      0 --:--:-- --:--:-- --:--:-- 38705
{
  "status": "healthy",
  "checks": [
    {
      "componentName": "Guice application lifecycle",
      "escapedComponentName": "Guice%20application%20lifecycle",
      "status": "healthy",
      "cause": null
    },
    {
      "componentName": "MailReceptionCheck",
      "escapedComponentName": "MailReceptionCheck",
      "status": "healthy",
      "cause": null
    },
    {
      "componentName": "EventDeadLettersHealthCheck",
      "escapedComponentName": "EventDeadLettersHealthCheck",
      "status": "healthy",
      "cause": null
    },
    {
      "componentName": "EmptyErrorMailRepository",
      "escapedComponentName": "EmptyErrorMailRepository",
      "status": "healthy",
      "cause": null
    },
    {
      "componentName": "Embedded ActiveMQ",
      "escapedComponentName": "Embedded%20ActiveMQ",
      "status": "healthy",
      "cause": null
    }
  ]
}

其他测试命令:

curl -XGET http://localhost:8000/healthcheck | jq
curl -XGET http://localhost:8000/healthcheck/checks | jq
curl -XGET http://localhost:8000/domains | jq
curl -XGET http://localhost:8000/users | jq

创建邮件域

$ curl -XPUT http://localhost:8000/domains/mail123.demo.local

列出邮件域

$ curl -XGET http://localhost:8000/domains | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    34    0    34    0     0   2833      0 --:--:-- --:--:-- --:--:--  2833
[
  "localhost",
  "mail123.demo.local"
]

创建用户:

[email protected]

curl -XPUT http://localhost:8000/users/[email protected] \
  -d '{"password":"password1234567"}' \
  -H "Content-Type: application/json" 
© www.soinside.com 2019 - 2024. All rights reserved.