JavaMail API and Tomcat 7 Implementation
api, jakarta-ee, jakarta-mail, java, smtp
Solution
JavaMail is a standard JSR 919
TomEE server has support for JavaMail.
The configuration is very easy and goes like this
- tomee already comes with `apache-tomee-plus-1.6.0/lib/geronimo-javamail_1.4_mail-1.8.2.jar`
- in `tomee.xml` (configured at `$TOMEE/conf`) you add an entry as described by Configuring JavaMail
- from inside your classes you can reference the mail session via `@Resource` like described at javax.mail.Session resource and smtp authentication
Problem
There are several Java EE APIs that exist as just that - APIs (interfaces, domain objects, enums, etc. but no actual classes that do stuff). APIs like JPA, JDBC or JTA. These APIs must then have implementations; for JPA there are impls like Hibernate, MyBatis or TopLink. For JDBC there are drivers for each specific RDBMS. For JTA there is Bitronix and Atomikos. But what about JavaMail? Is it just an API? If so, what are some common implementations of it? If I deploy my Java app (as a WAR) to Tomcat 7, where does this implementation come from (specifically)? Does Tomcat have its own JavaMail impl? What JARs/packages/classes compose the Tomcat impl?