JavaMail API and Tomcat 7 Implementation

只谈情不闲聊 提交于 2019-12-20 03:04:08

问题


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?


回答1:


JavaMail is a standard JSR 919

TomEE server has support for JavaMail.

The configuration is very easy and goes like this

  1. tomee already comes with apache-tomee-plus-1.6.0/lib/geronimo-javamail_1.4_mail-1.8.2.jar
  2. in tomee.xml (configured at $TOMEE/conf) you add an entry as described by Configuring JavaMail
  3. from inside your classes you can reference the mail session via @Resource like described at javax.mail.Session resource and smtp authentication


来源:https://stackoverflow.com/questions/22002170/javamail-api-and-tomcat-7-implementation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!