windows安装运行Apache James(基于guide的版本)

下载地址

下载列表
https://james.apache.org/download.cgi

直接下载基于guide版本
https://www.apache.org/dyn/closer.lua/james/server/3.8.0/james-server-jpa-guice.zip

设置签名

解压,并切换到james-server-jpa-guice目录下,在powershellli执行

bash 复制代码
keytool -genkey -alias james -keyalg RSA -keystore conf/keystore

密码设置为:

bash 复制代码
james72laBalle

默认使用derby,如果需要切换到MYSQL数据库的话,放到后面讲

修改domainlist.xml文件

原内容

xml 复制代码
<domainlist class="org.apache.james.domainlist.jpa.JPADomainList">
   <autodetect>false</autodetect>
   <autodetectIP>false</autodetectIP>
   <defaultDomain>localhost</defaultDomain>
</domainlist>

修改为

xml 复制代码
<domainlist class="org.apache.james.domainlist.jpa.JPADomainList">
   <autodetect>false</autodetect>
   <autodetectIP>false</autodetectIP>
   <defaultDomain>bo.com</defaultDomain>
</domainlist>

修改mailetcontainer.xml文件

原内容

xml 复制代码
    <context>
        <!-- When the domain part of the postmaster mailAddress is missing, the default domain is appended.
        You can configure it to (for example) <postmaster>postmaster@myDomain.com</postmaster> -->
        <postmaster>postmaster</postmaster>
    </context>

修改为

xml 复制代码
    <context>
        <!-- When the domain part of the postmaster mailAddress is missing, the default domain is appended.
        You can configure it to (for example) <postmaster>postmaster@myDomain.com</postmaster> -->
        <postmaster>postmaster@bo.com</postmaster>
    </context>

修改pop3server.xml文件(可选)(默认是关闭的)

开启pop3协议

原内容

xml 复制代码
    <pop3server enabled="false">

修改为

xml 复制代码
    <pop3server enabled="true">

启动

在james-server-jpa-guice目录下执行

bash 复制代码
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

使用mysql数据库

吐槽

放到后面来讲是因为引入jdbc这块浪费了很长时间

官网推荐是使用 -cp的命令引入jdbc的jar包来启动,我捣鼓了很久都没有启动成功,一直提示找不到main方法所以放弃了-cp的方式。

bash 复制代码
java -javaagent:james-server-jpa-app.lib/openjpa-3.2.0.jar -Dworking.directory=. -Djdk.tls.ephemeralDHKeySize=2048 -Dlogback.configurationFile=conf/logback.xml -cp "james-server-jpa-app.jar:james-server-jpa-app.lib/*:jdbc-driver.jar" org.apache.james.JPAJamesServerMain

解决

修改文件

1、将mysql的jdbc的jar包放到james-server-jpa-app.lib下,并命名为jdbc.jar

2、使用工具打开james-server-jpa-app.jar文件,定位到META-INF目录下,编辑MANIFEST.MF文件

3、滚动到最下方,在Main-Class: org.apache.james.JPAJamesServerMain的上方,james-ser

ver-jpa-app.lib/awaitility-4.2.0.jar后面增加一句 james-server-jpa-app.lib/jdbc.jar

如下图

创建数据库

在数据库中创建名为james的数据库

修改 conf/james-database.properties
注释
java 复制代码
#database.driverClassName=org.apache.derby.jdbc.EmbeddedDriver
#database.url=jdbc:derby:../var/store/derby;create=true
#database.username=app
#database.password=app
#vendorAdapter.database=DERBY
添加
java 复制代码
database.driverClassName=com.mysql.cj.jdbc.Driver
database.url=jdbc:mysql://192.168.xx.xx:3306/james?zeroDateTimeBehavior=convertToNull
database.username=root
database.password=root
vendorAdapter.database=MYSQL
相关推荐
喂完待续8 小时前
Apache Hudi:数据湖的实时革命
大数据·数据仓库·分布式·架构·apache·数据库架构
数据爬坡ing2 天前
过程设计工具深度解析-软件工程之详细设计(补充篇)
大数据·数据结构·算法·apache·软件工程·软件构建·设计语言
运维行者_2 天前
使用Applications Manager进行 Apache Solr 监控
运维·网络·数据库·网络安全·云计算·apache·solr
皓空揽月2 天前
php+apache+nginx 更换域名
nginx·php·apache
求知若渴,虚心若愚。4 天前
高可用实战之Nginx + Apache篇
运维·nginx·apache
阿里云云原生5 天前
Apache RocketMQ EventBridge:为什么 GenAI 需要 EDA?
apache·rocketmq
沈健_算法小生5 天前
Apache RocketMQ:消息可靠性、顺序性与幂等处理的全面实践
apache·rocketmq
老虎06275 天前
JavaWeb(苍穹外卖)--学习笔记17(Apache Echarts)
笔记·学习·apache
Bruce_Liuxiaowei6 天前
绕过文件上传漏洞并利用文件包含漏洞获取系统信息的技术分析
运维·网络安全·php·apache
lifallen6 天前
Hadoop MapReduce过程
大数据·数据结构·hadoop·分布式·apache