JavaMail

Install Mailer Example

JBoss JavaMail Example converted to Eclipse projects.

  1. Click File, click Import..., click Existing Project into Workspace, click Next, click Browse..., navigate to C:\eclipse\workspace\mailerejb, click Finish.
  2. Click File, click Import..., click Existing Project into Workspace, click Next, click Browse..., navigate to C:\eclipse\workspace\mailerweb, click Finish.
  3. Expand mailerweb project in Eclipse.
  4. Right click on build.xml, click Run Ant..., check ear-dir, jar-dir and war-dir, click Finish.
  5. Click mailerweb project, click Project, click Rebuild Project.  If you are just working with just the Servlet code you do not need to run the Ant script again.  If you want to update the deployment with EJB classes run only the jar-dir target.
  6. From My Computer navigate to %JBOSS_DIST%\server\default\conf, open jboss-service.xml in Wordpad, go to line with:
        <attribute name="URLs">
        ./deploy
        </attribute>


    Right after ./deploy add ,C:\eclipse\workspace\mailerweb\mailer.ear so it should look like:

        <attribute name="URLs">
        ./deploy,
        C:\eclipse\workspace\mailerweb\mailer.ear
        </attribute>
  7. Save changes and exit Wordpad.
  8. From My Computer navigate to %JBOSS_DIST%\server\default\deploy, open mail-service.xml in Wordpad and modify for your account and mail server.  Save changes and exit Wordpad.

Working with the Mailer Example in Eclipse

  1. Run Eclipse, in Package Explorer you should see mailerweb and mailerejb.
    bulletmailerejb contains all the EJBs for the Mailer Example.  It uses the project as the source folder, has one package org.jboss.docs.javamail which contains the EJB source and an ant file build.xml to copy the classes to the mailerweb project.
    bulletmailerweb contains the Servlet code.  It uses one source folder src, has one package org.jboss.docs.javamail which contains the Servlet source.  The output is directed to mailerweb/mailer.ear/mailer.war/WEB-INF/classes which allows hot editing of the Servlet without having to deploy it.
  2. Click JBoss, Start JBoss (if not already started) and wait for:

    10:33:48,077 INFO [Server] JBoss (MX MicroKernel) [3.0.1RC1 Date:200206291622] Started in 0m:12s:125ms

    in the Console output.  This means JBoss is up and running.
  3. Open a web Browser and go to http://localhost:8080/mailer, you should see the Mailer EJB Form.  Enter you email address in Principle field and click Send.  You should get massage with "Test from inside EJB Using JBoss" in the massage body.
Home | JBoss Examples Last updated on 08/07/2002