confluence7.4.6邮件配置

confluence7.4.6邮件配置,第1张

在使用confluence时,准备配置个邮件提醒,如果文章有变化能够比较方便的提醒用户,一开始不是很熟悉JNDI是如何配置的,为了方便直接通过简单的图形界面方式配置的邮件服务器。


1.邮件服务器配置

首先是填写SMTP服务器相关的配置项,具体配置如下图所示:

完了以后再填写邮件服务器信息,配置如下所示:


测试邮件发送

配置好邮件服务器后,发送测试邮件时,一直报发送超时的错误,直接上问题日志吧,

    com.atlassian.mail.MailException: javax.mail.MessagingException: Exception reading response;
      nested exception is:
        java.net.SocketTimeoutException: Read timed out
        at com.atlassian.confluence.jmx.JmxSMTPMailServer.doSendWithMessageIdSupport(JmxSMTPMailServer.java:120)
        at com.atlassian.confluence.jmx.JmxSMTPMailServer.send(JmxSMTPMailServer.java:79)
        at com.atlassian.confluence.admin.actions.mail.SendTestEmailAction.execute(SendTestEmailAction.java:57)
        at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:168)
        at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
        ...........
        ...........
        at org.apache.catalina.valves.StuckThreadDetectionValve.invoke(StuckThreadDetectionValve.java:206)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1533)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1489)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:748)
    Caused by: javax.mail.MessagingException: Exception reading response;
      nested exception is:
        java.net.SocketTimeoutException: Read timed out
        at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:2210)
        at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1950)
        at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:642)
        at javax.mail.Service.connect(Service.java:317)
        at javax.mail.Service.connect(Service.java:176)
        at javax.mail.Service.connect(Service.java:125)
        at com.atlassian.confluence.jmx.JmxSMTPMailServer.doSendWithMessageIdSupport(JmxSMTPMailServer.java:102)
        ... 363 more
    Caused by: java.net.SocketTimeoutException: Read timed out
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
        at java.net.SocketInputStream.read(SocketInputStream.java:171)
        at java.net.SocketInputStream.read(SocketInputStream.java:141)
        at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:110)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
        at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:89)
        at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:2188)
        ... 369 more`

也在百度上找了一圈答案,大部分都是让换端口或者默认端口,基本上没有解决我的问题,后面我打算换成jndi的方式试试运气,步骤如下所示:

第一步:将WEB-INF/lib/邮件发送相关的jar包移到confluence下的lib目录下

关闭confluence服务
/etc/ini.d/confluence stop
迁移jar包,我的安装目录是默认目录:
/opt/atlassian/confluence/confluence/WEB-INF/lib/
所以我需要把这个目录的两个jar包javax.mail-api-1.6.2.jar javax.mail-1.6.2.jar移动到/opt/atlassian/confluence/lib

第二步:修改server.xml配置文件

前添加邮件发送配置信息

mail.debug="true"是为了查看发送邮件的调试信息
然后启动服务
/etc/ini.d/confluence start
然后再回到页面配置jndi

测试时再次报错,说是找不到mail,发现实Resource配置的位置不对,应该放在第一个前面,我放到第二个
修改后再次启动服务,还是报错,提示找不到
Caused by: java.lang.NoClassDefFoundError: javax/activation/DataSource
以前有配置过jira的邮件服务器,于是大概猜测是少了jar包
于是下载activation-1.1.1.jar/opt/atlassian/confluence/lib目录下
将这个jar包的拥有者设置成confluence,执行
chown confluence:confluence activation-1.1.1.jar
再次启动confluence,测试邮件发送成功了
真可谓是一波三折,总算是解决了。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/720006.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-25
下一篇 2022-04-25

发表评论

登录后才能评论

评论列表(0条)

保存