James部署及简单使用

一、安装

官方安装部署教程

1.下载

James服务器安装包可在Jmaes官网获取,目前最新的稳定版本为3.0.1。下载二进制包:

James部署及简单使用_第1张图片
下载二进制包

解压后目录:

James部署及简单使用_第2张图片
解压后目录

2. 安装

2.1 环境

  • ubuntu 14.04
  • java version "1.8.0_151"

2.2 安装过程

  1. 使用root权限
  2. 切换到james的bin目录下
  3. 开启james服务器
$./james start
开启服务器
  1. 查看日志判断是否开启成功
vim ../log/james-server.log
James部署及简单使用_第3张图片
启动成功

2.3 配置

  1. 使用james-cli配置domain(域名)与用户
$./james-cli.sh -h localhost -p 9999 adddomain 域名
$./james-cli.sh -h localhost -p 9999 adduser 用户名@域名 密码
配置域名与用户

二、使用网易邮箱大师测试

  1. 为了方便测试,再创建一个[email protected]的用户
  2. 在邮箱大师客户端配置服务器
James部署及简单使用_第4张图片
配置服务器
  1. 发送邮件
James部署及简单使用_第5张图片
发送邮件
  1. 接收成功
James部署及简单使用_第6张图片
接收成功

三、常见问题

1. 启动时报错:

06:43:27,941 | org.apache.james.container.spring.context.JamesServerApplicationContext | Refreshing org.apache.james.container.spring.context.JamesServerApplicationContext@610a6776: startup date [Fri Jan 12 06:43:27 UTC 2018]; root of context hierarchyWARN  06:43:34,537 | org.apache.james.container.spring.context.JamesServerApplicationContext | Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.FatalBeanException: Unable to config the indexer; nested exception is org.apache.commons.configuration.ConfigurationException: Unable to load configuration for component indexer
        at org.apache.james.container.spring.bean.factorypostprocessor.IndexerConfigurationBeanFactoryPostProcessor.postProcessBeanFactory(IndexerConfigurationBeanFactoryPostProcessor.java:70)
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:696)
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:686)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
        at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)
        at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:93)
        at org.apache.james.container.spring.context.JamesServerApplicationContext.(JamesServerApplicationContext.java:40)
        at org.apache.james.app.spring.JamesAppSpringMain.init(JamesAppSpringMain.java:61)
        at org.apache.james.app.spring.JamesAppSpringMain.main(JamesAppSpringMain.java:42)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.commons.configuration.ConfigurationException: Unable to load configuration for component indexer
        at org.apache.james.container.spring.lifecycle.ConfigurationProviderImpl.getConfiguration(ConfigurationProviderImpl.java:135)
        at org.apache.james.container.spring.bean.factorypostprocessor.IndexerConfigurationBeanFactoryPostProcessor.postProcessBeanFactory(IndexerConfigurationBeanFactoryPostProcessor.java:47)
        ... 14 more
INFO  06:45:02,415 | org.apache.james.container.spring.context.JamesServerApplicationContext | Refreshing org.apache.james.container.spring.context.JamesServerApplicationContext@65b83a6b: startup date [Fri Jan 12 06:45:02 UTC 2018]; root of context hierarchy

解决方案:

将james的config目录下所有的*-template.xml改为*.xml,可使用以下脚本进行批量替换:
#!/bin/bash
count=0
for file in `ls $1 | grep 'template'`;
do
        newfile=`echo $file | sed s/-template//g`
        echo $file" -> "$newfile
        cp $1/$file $1/$newfile
        ((count++))
done
echo "has copy "$count" numbers file."
$ bash delete2.sh james/conf

你可能感兴趣的:(James部署及简单使用)