Register Login
Internet / AI Technology University (ITU/AITU)





|

Top Links: >> 80. Technology >> Internet Technology Summit Program >> 5. Mobile and Cloud Technology >> 5.2. AWS Cloud Technology
Current Topic: 5.2.2. AWS and local mail server
You have a privilege to create a quiz (QnA) related to this subject and obtain creativity score...
AWS and local mail server

Email server is often a necessary addition to cloud and local applications.
One purpose is providing notifications and distributing news.
Besides there might be a need for special features triggered by predefined email recipients or subjects.
We selected the Hedwig Mail Server, free open source in Java: hwmail.sourceforge.net

Installation
Installation process is well described here: http://hwmail.sourceforge.net/doc/installation.html

We recommend to install and play locally before copy to a AWS EC2 instance.

After the installation, if you try to run it, there might be a message about a database related problem.
We used MySQL server, so at least two modifications must be done.
- Modify the default.properies file located in the assembly/src/release/conf - directory.
Comment oracle database and uncomment and modify mysql properties.
- Find and copy mysql driver file (mysql-connector-java-5.1.6.jar) to the assembly/src/release/lib - directory
(Later on you will also need this jar for the hedwig-web part...)

Make sure you have MySQL DB running and follow instructions to set hedwig-schema by using hedwig-schema.sql file located in the assembly/src/release/sql - directory.
Change Directory (cd) to the place where you found this file, login to mysql (must be running) and create the schema by reading this file as a source.

$mysql -u {mysqlUserName} -p
Enter password:
{mySqlUserPassword}

mysql> source hedwig-schema.sql


Before running the hedwig server, we recommend to place several lines of code in the main() method of the SimpleSpringContainer class located in the hedwig-server, com.hs.mail.container.simple - package.
This class is eventually called to initialize the server.


try {
CommandLine line = new PosixParser().parse(OPTS, args);
String configLocation = line.getOptionValue("c", DEFAULT_CONFIG_LOCATION);

// start new linesnew lines
String absPath = (new File(".")).getAbsolutePath();
absPath = absPath.toLowerCase();
System.out.println("absPath="+absPath);
if(absPath.startsWith("c:\\{targetDir}\\")) { // for example, c:/hedwig
// location of hedwig target
//for example, c:/hedwig/conf/applicationContext.xml
configLocation = WINDOWS_CONFIG_LOCATION;
} else if(absPath.startsWith("c:\\{EclipseSourceDir}\\")) { // for example, c:/workspace/hedwig
// location of hedwig source in Eclipse workspace
//for example, c:/workspace/hedwig/src/assembly/src/release/conf/applicationContext.xml
configLocation = ECLIPSE_CONFIG_LOCATION;
} else if(absPath.startsWith("/home/ec2-user/")) {
configLocation = DEFAULT_CONFIG_LOCATION;
}
System.out.println("configLocation="+configLocation);
// end new lines
Was it clear so far? Highlight the text in question Or

These new lines will provide you some visibility in the initiation of application.
Working in Eclipse it is easy to start the server by directly calling the main() method of the SimpleSpringContainer class in the DEBUG mode and check the values.

These lines are also helpful to check initiation process by reading the app.console and general.log files in the hedwig/logs - directory in the AWS.

Building hedwig

After modification finished, buil application by going to the hedwig/src - directory in CMD (or in a shell in Linux) and running:

>mvn clean package -Dmaven.test.skip=true

If there is no success, check carefully the output looking for the errors.

After successful build, find the resulting built file hedwig-0.7-bin.tgz in the workspace/hedwig/src/assembly/target - directory.
Extract this file into hedwig-0.7-bin.tar and then extract hedwig-0.7-bin.tar into the hedwig-0.7- directory.
This directory includes all you need to run the server application.
Copy that directory where you would like to run the application For AWS EC2, this could be /home/ec2-user/hedwig-0.7 - directory.
I the case of running locally on Windows machine, this can be c:/hedwig-0.7 - directory.
At this point I would recommend to drop the version in the directory name and rename it from hedwig-0.7 to headwig.

Running hedwig mail server

Run the server from the hedwig/bin directory as instructed here: http://hwmail.sourceforge.net/doc/running.html
While running in Eclipse, it is easier to start directly the the main() method of the SimpleSpringContainer class in the DEBUG mode.

Check the log files app.console and general.log located in the hedwig/logs - directory for possible errors.

If the error says that the port is already in use, find out which process is running with this port and kill that process.
For example, port 25 is already open and you need to kill a related process in Linux.

$fuser 25/tcp
2224
$kill -9 2224

AWS Security Group to open ports
By default input ports are closed in AWS EC2 instance.
To open the ports and allow incoming traffic for SMTP 25 and IMAP 143 ports - EDIT the Security Group for that instance.

We invite you to create your own questions and answers (QnA) to increase your rank and win the Top Creativity Prize!

Topic Graph | Check Your Progress | Propose QnA | Have a question or comments for open discussion?
<br/>$mysql -u {mysqlUserName} -p
<br/>Enter password:
<br/>{mySqlUserPassword}
<br/>
<br/>mysql> source hedwig-schema.sql
<br/>


Before running the hedwig server, we recommend to place several lines of code in the main() method of the SimpleSpringContainer class located in the hedwig-server, com.hs.mail.container.simple - package.
This class is eventually called to initialize the server.

<br/>		try {
<br/>			CommandLine line = new PosixParser().parse(OPTS, args);
<br/>			String configLocation = line.getOptionValue("c", DEFAULT_CONFIG_LOCATION);
<br/>
<br/>                        // start new linesnew lines
<br/>			String absPath = (new File(".")).getAbsolutePath();
<br/>			absPath = absPath.toLowerCase();
<br/>			System.out.println("absPath="+absPath);
<br/>			if(absPath.startsWith("c:\\{targetDir}\\")) { // for example, c:/hedwig
<br/>// location of hedwig target
<br/>//for example, c:/hedwig/conf/applicationContext.xml 
<br/>				configLocation = WINDOWS_CONFIG_LOCATION;
<br/>			} else if(absPath.startsWith("c:\\{EclipseSourceDir}\\")) { // for example, c:/workspace/hedwig
<br/>// location of hedwig source in Eclipse workspace
<br/>//for example, c:/workspace/hedwig/src/assembly/src/release/conf/applicationContext.xml
<br/>				  configLocation = ECLIPSE_CONFIG_LOCATION;
<br/> 			} else if(absPath.startsWith("/home/ec2-user/")) {
<br/>				configLocation = DEFAULT_CONFIG_LOCATION;
<br/>			}
<br/>			System.out.println("configLocation="+configLocation);
<br/>                        // end new lines
<br/>






Was it clear so far? Highlight the text in question

Or


These new lines will provide you some visibility in the initiation of application.
Working in Eclipse it is easy to start the server by directly calling the main() method of the SimpleSpringContainer class in the DEBUG mode and check the values.

These lines are also helpful to check initiation process by reading the app.console and general.log files in the hedwig/logs - directory in the AWS.

Building hedwig

After modification finished, buil application by going to the hedwig/src - directory in CMD (or in a shell in Linux) and running:

>mvn clean package -Dmaven.test.skip=true

If there is no success, check carefully the output looking for the errors.

After successful build, find the resulting built file hedwig-0.7-bin.tgz in the workspace/hedwig/src/assembly/target - directory.
Extract this file into hedwig-0.7-bin.tar and then extract hedwig-0.7-bin.tar into the hedwig-0.7- directory.
This directory includes all you need to run the server application.
Copy that directory where you would like to run the application For AWS EC2, this could be /home/ec2-user/hedwig-0.7 - directory.
I the case of running locally on Windows machine, this can be c:/hedwig-0.7 - directory.
At this point I would recommend to drop the version in the directory name and rename it from hedwig-0.7 to headwig.

Running hedwig mail server

Run the server from the hedwig/bin directory as instructed here: http://hwmail.sourceforge.net/doc/running.html
While running in Eclipse, it is easier to start directly the the main() method of the SimpleSpringContainer class in the DEBUG mode.

Check the log files app.console and general.log located in the hedwig/logs - directory for possible errors.

If the error says that the port is already in use, find out which process is running with this port and kill that process.
For example, port 25 is already open and you need to kill a related process in Linux.

$fuser 25/tcp
2224
$kill -9 2224

AWS Security Group to open ports
By default input ports are closed in AWS EC2 instance.
To open the ports and allow incoming traffic for SMTP 25 and IMAP 143 ports - EDIT the Security Group for that instance.


We invite you to create your own questions and answers (QnA) to increase your rank and win the Top Creativity Prize!


Topic Graph | Check Your Progress | Propose QnA | Have a question or comments for open discussion?

Have a suggestion? - shoot an email
Looking for something special? - Talk to AI
Read: IT of the future: AI and Semantic Cloud Architecture | Fixing Education
Do you want to move from theory to practice and become a magician? Learn and work with us at Internet Technology University (ITU) - JavaSchool.com.

Technology that we offer and How this works: English | Spanish | Russian | French

Internet Technology University | JavaSchool.com | Copyrights © Since 1997 | All Rights Reserved
Patents: US10956676, US7032006, US7774751, US7966093, US8051026, US8863234
Including conversational semantic decision support systems (CSDS) and bringing us closer to The message from 2040
Privacy Policy