本文介绍了JavaMail API 和 Tomcat 7 实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

有几个 Java EE API 就是这样存在的 - API(接口、域对象、枚举等,但没有事情的实际类).API,如 JPA、JDBC 或 JTA.这些 API 必须有实现;对于 JPA,有像 Hibernate、MyBatis 或 TopLink 这样的实现.对于 JDBC,每个特定的 RDBMS 都有驱动程序.对于 JTA,有 Bitronix 和 Atomikos.

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.

但是 JavaMail 呢?它只是一个API吗?如果是这样,它的一些常见实现是什么?如果我将我的 Java 应用程序(作为 WAR)部署到 Tomcat 7,那么这个实现来自哪里(特别是)?Tomcat 有自己的 JavaMail 实现吗?Tomcat 实现由哪些 JAR/包/类组成?

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?

推荐答案

JavaMail 是一个标准的 JSR 919

JavaMail is a standard JSR 919

TomEE 服务器支持 JavaMail.

TomEE server has support for JavaMail.

配置很简单,就是这样

  1. tomee 已经带有 apache-tomee-plus-1.6.0/lib/geronimo-javamail_1.4_mail-1.8.2.jar
  2. tomee.xml(在 $TOMEE/conf 中配置)中添加一个条目,如 配置 JavaMail
  3. 在您的课程中,您可以通过 @Resource 引用邮件会话,如 javax.mail.Session 资源和 smtp 认证
  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

这篇关于JavaMail API 和 Tomcat 7 实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 21:48