• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Trying to send e-mail using JavaMail, JBoss 5, and JNDI

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello there,

Am using JBoss 5.1.0GA and JDK 1.5.0_19 on OS X Leopard.

Created a working SendMailServlet.

Have now decided to refactor it into two separate classes (extract out JavaMail code to a separate class and create a ServletController).

Am also trying to use JNDI to access the connection properties in the mail-service.xml configuration file residing in JBoss.

The Mailer class contains the reusable functionality needed to send an e-mail:



The MailController class serves as a standard Java Servlet which invokes the Mailer.class's sendMsg() method:



Have the mail configuration set under $JBOSS_HOME/server/default/deploy/mail-service.xml:



web.xml (Deployment Descriptor):



This is what is outputted when I start JBOSS and click point my browser to:

https://localhost:8443/myapp/sendmail



Why am I getting this java.net.ConnectException: Connection refused exception?

Happy programming,

Mike
 
Michael K. Wilson
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I fixed it! It works now!

Solution: Replace the mail.jar file on JBoss with the newest one from Sun and edit the mail configuration file to reflect port 465.

The JavaMail 1.4ea jar is what comes bundled with JBoss 5.1.0.GA inside:

$JBOSS_HOME/common/lib

Replaced it with 1.4.2 and then changed some of the xml config parameters around.

Debug output:



$JBOSS_HOME/server/default/deploy/mail-service.xml:



Please close this topic...

Happy programming,

Mike
 
Get me the mayor's office! I need to tell her about this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic