| <!DOCTYPE html> |
| <html lang="en"> |
| |
| <head> |
| <meta charset="UTF-8"> |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| <meta name="viewport" content="width=device-width, initial-scale=1"> |
| <title>Apache TomEE</title> |
| <meta name="description" |
| content="Apache TomEE is a lightweight, yet powerful, JavaEE Application server with feature rich tooling." /> |
| <meta name="keywords" content="tomee,asf,apache,javaee,jee,shade,embedded,test,junit,applicationcomposer,maven,arquillian" /> |
| <meta name="author" content="Luka Cvetinovic for Codrops" /> |
| <link rel="icon" href="../../favicon.ico"> |
| <link rel="icon" type="image/png" href="../../favicon.png"> |
| <meta name="msapplication-TileColor" content="#80287a"> |
| <meta name="theme-color" content="#80287a"> |
| <link rel="stylesheet" type="text/css" href="../../css/normalize.css"> |
| <link rel="stylesheet" type="text/css" href="../../css/bootstrap.css"> |
| <link rel="stylesheet" type="text/css" href="../../css/owl.css"> |
| <link rel="stylesheet" type="text/css" href="../../css/animate.css"> |
| <link rel="stylesheet" type="text/css" href="../../fonts/font-awesome-4.1.0/css/font-awesome.min.css"> |
| <link rel="stylesheet" type="text/css" href="../../fonts/eleganticons/et-icons.css"> |
| <link rel="stylesheet" type="text/css" href="../../css/jqtree.css"> |
| <link rel="stylesheet" type="text/css" href="../../css/idea.css"> |
| <link rel="stylesheet" type="text/css" href="../../css/cardio.css"> |
| |
| <script type="text/javascript"> |
| <!-- Matomo --> |
| var _paq = window._paq = window._paq || []; |
| /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ |
| /* We explicitly disable cookie tracking to avoid privacy issues */ |
| _paq.push(['disableCookies']); |
| _paq.push(['trackPageView']); |
| _paq.push(['enableLinkTracking']); |
| (function () { |
| var u = "//matomo.privacy.apache.org/"; |
| _paq.push(['setTrackerUrl', u + 'matomo.php']); |
| _paq.push(['setSiteId', '5']); |
| var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0]; |
| g.async = true; |
| g.src = u + 'matomo.js'; |
| s.parentNode.insertBefore(g, s); |
| })(); |
| <!-- End Matomo Code --> |
| </script> |
| </head> |
| |
| <body> |
| <div class="preloader"> |
| <img src="../../img/loader.gif" alt="Preloader image"> |
| </div> |
| <nav class="navbar"> |
| <div class="container"> |
| <div class="row"> <div class="col-md-12"> |
| |
| <!-- Brand and toggle get grouped for better mobile display --> |
| <div class="navbar-header"> |
| <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> |
| <span class="sr-only">Toggle navigation</span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| </button> |
| <a class="navbar-brand" href="/" title="Apache TomEE"> |
| <span> |
| |
| |
| <img |
| src="../../img/apache_tomee-logo.svg" |
| onerror="this.src='../../img/apache_tomee-logo.jpg'" |
| height="50" |
| > |
| |
| |
| </span> |
| </a> |
| </div> |
| <!-- Collect the nav links, forms, and other content for toggling --> |
| <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> |
| <ul class="nav navbar-nav navbar-right main-nav"> |
| <li><a href="../../docs.html">Documentation</a></li> |
| <li><a href="../../community/index.html">Community</a></li> |
| <li><a href="../../security/security.html">Security</a></li> |
| <li><a class="btn btn-accent accent-orange no-shadow" href="../../download.html">Downloads</a></li> |
| </ul> |
| </div> |
| <!-- /.navbar-collapse --> |
| </div></div> |
| </div> |
| <!-- /.container-fluid --> |
| </nav> |
| |
| |
| <div id="main-block" class="container main-block"> |
| <div class="row title"> |
| <div class="col-md-12"> |
| <div class='page-header'> |
| |
| <h1>Jakarta Mail API</h1> |
| </div> |
| </div> |
| </div> |
| <div class="row"> |
| |
| <div class="col-md-12"> |
| <div id="preamble"> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>This is just a simple example to demonstrate a very basic usage of the |
| API. It should be enough to get you started using the java mail |
| packages.</p> |
| </div> |
| <div class="paragraph"> |
| <p>#The Code</p> |
| </div> |
| </div> |
| </div> |
| <div class="sect1"> |
| <h2 id="_a_simple_rest_service_using_the_jakarta_mail_api">A simple REST service using the Jakarta Mail API</h2> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>Here we see a very simple RESTful endpoint that can be called with a |
| message to send by Email. It would not be hard to modify the application |
| to provide more useful configuration options. As is, this will not send |
| anything, but if you change the parameters to match your mail server |
| then you’ll see the message being sent. You can find much more detailed |
| information on the |
| <a href="https://java.net/projects/javamail/pages/Home#Samples">Javamail API here</a></p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlight"><code class="language-java" data-lang="java">package org.superbiz.rest; |
| |
| import jakarta.annotation.Resource; |
| import jakarta.mail.Message; |
| import jakarta.mail.MessagingException; |
| import jakarta.mail.PasswordAuthentication; |
| import jakarta.mail.Session; |
| import jakarta.mail.Transport; |
| import jakarta.mail.URLName; |
| import jakarta.mail.internet.InternetAddress; |
| import jakarta.mail.internet.MimeMessage; |
| import jakarta.ws.rs.POST; |
| import jakarta.ws.rs.Path; |
| import java.util.Date; |
| |
| @Path("/email") |
| public class EmailService { |
| |
| @Resource(mappedName = "java:comp/env/tomee/mail/exampleSMTP") |
| private Session mailSession; |
| |
| @POST |
| public String lowerCase(final String message) { |
| |
| try { |
| |
| /* Ensures that smtp authentication mechanism works as configured */ |
| boolean authenticate = "true".equals(mailSession.getProperty("mail.smtp.auth")); |
| if (authenticate) { |
| final String username = mailSession.getProperty("mail.smtp.user"); |
| final String password = mailSession.getProperty("mail.smtp.password"); |
| |
| final URLName url = new URLName( |
| mailSession.getProperty("mail.transport.protocol"), |
| mailSession.getProperty("mail.smtp.host"), -1, null, |
| username, null); |
| |
| mailSession.setPasswordAuthentication(url, new PasswordAuthentication(username, password)); |
| } else { |
| return "Using EMailService without SMTP auth configured. This might be valid, but could also be dangerous!"; |
| } |
| |
| //Set this just to see some internal logging |
| mailSession.setDebug(true); |
| |
| //Create a message |
| final MimeMessage msg = new MimeMessage(mailSession); |
| msg.setFrom(new InternetAddress("admin@localhost")); //your e-mail address |
| final InternetAddress[] address = {new InternetAddress("user@provider.com")}; |
| msg.setRecipients(Message.RecipientType.TO, address); |
| msg.setSubject("JavaMail API test"); |
| msg.setSentDate(new Date()); |
| msg.setText(message, "UTF-8"); |
| |
| Transport.send(msg); |
| } catch (final MessagingException e) { |
| return "Failed to send message: " + e.getMessage(); |
| } |
| |
| return "Sent"; |
| } |
| }</code></pre> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="sect1"> |
| <h2 id="_testing">Testing</h2> |
| <div class="sectionbody"> |
| <div class="sect2"> |
| <h3 id="_test_for_the_jaxrs_service">Test for the JAXRS service</h3> |
| <div class="paragraph"> |
| <p>The test uses the OpenEJB ApplicationComposer to make it trivial.</p> |
| </div> |
| <div class="paragraph"> |
| <p>The idea is first to activate the jaxrs services. This is done using |
| @EnableServices annotation.</p> |
| </div> |
| <div class="paragraph"> |
| <p>Then we create on the fly the application simply returning an object |
| representing the web.xml. Here we simply use it to define the context |
| root but you can use it to define your REST Application too. And to |
| complete the application definition we add @Classes annotation to define |
| the set of classes to use in this app.</p> |
| </div> |
| <div class="paragraph"> |
| <p>Finally to test it we use cxf client API to call the REST service post() |
| method.</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlight"><code class="language-java" data-lang="java">package org.superbiz.rest; |
| |
| import com.icegreen.greenmail.util.GreenMail; |
| import com.icegreen.greenmail.util.ServerSetup; |
| import org.apache.cxf.jaxrs.client.WebClient; |
| import org.apache.openejb.jee.WebApp; |
| import org.apache.openejb.junit.ApplicationComposer; |
| import org.apache.openejb.testing.Classes; |
| import org.apache.openejb.testing.Configuration; |
| import org.apache.openejb.testing.EnableServices; |
| import org.apache.openejb.testing.Module; |
| import org.apache.openejb.util.NetworkUtil; |
| import org.junit.AfterClass; |
| import org.junit.BeforeClass; |
| import org.junit.Test; |
| import org.junit.runner.RunWith; |
| |
| import java.io.IOException; |
| import java.util.Properties; |
| import java.util.concurrent.CountDownLatch; |
| |
| import static org.junit.Assert.assertEquals; |
| |
| @EnableServices(value = "jaxrs") |
| @RunWith(ApplicationComposer.class) |
| public class EmailServiceTest { |
| |
| private static final int SMTP_TEST_PORT = NetworkUtil.getNextAvailablePort(); |
| |
| private static final String USER_PASSWORD = "s3cr3t"; |
| private static final String USER_NAME = "admin@localhost"; |
| private static final String EMAIL_USER_ADDRESS = "admin@localhost"; |
| |
| private static GreenMail mailServer; |
| private static CountDownLatch started = new CountDownLatch(1); |
| |
| @Module |
| @Classes(EmailService.class) |
| public WebApp app() { |
| return new WebApp().contextRoot("test"); |
| } |
| |
| @Configuration |
| public Properties config() { |
| //Note: We can also configure this via a resource.xml or via tomee.xml |
| Properties properties = new Properties(); |
| properties.put("tomee/mail/mySMTP", "new://Resource?type=jakarta.mail.Session"); |
| properties.put("tomee/mail/mySMTP.mail.debug", "false"); |
| properties.put("tomee/mail/mySMTP.mail.transport.protocol", "smtp"); |
| properties.put("tomee/mail/mySMTP.mail.smtp.host", "localhost"); |
| properties.put("tomee/mail/mySMTP.mail.smtp.port", SMTP_TEST_PORT); |
| properties.put("tomee/mail/mySMTP.mail.smtp.auth", "true"); |
| properties.put("tomee/mail/mySMTP.mail.smtp.user", USER_NAME); |
| properties.put("tomee/mail/mySMTP.password", USER_PASSWORD); |
| return properties; |
| } |
| |
| @BeforeClass |
| public static void setUp() throws InterruptedException { |
| mailServer = new CustomGreenMailServer(new ServerSetup(SMTP_TEST_PORT, null, "smtp")); |
| mailServer.start(); |
| |
| //wait for the server startup... |
| started.await(); |
| |
| // create user on mail server |
| mailServer.setUser(EMAIL_USER_ADDRESS, USER_NAME, USER_PASSWORD); |
| } |
| |
| @AfterClass |
| public static void tearDown() { |
| if (mailServer != null) { |
| mailServer.stop(); |
| } |
| } |
| |
| @Test |
| public void post() throws IOException { |
| final String message = WebClient.create("http://localhost:4204").path("/test/email/").post("Hello TomEE", String.class); |
| assertEquals("Sent", message); |
| } |
| |
| public static class CustomGreenMailServer extends GreenMail { |
| |
| public CustomGreenMailServer(ServerSetup config) { |
| super(new ServerSetup[]{config}); |
| } |
| |
| public synchronized void start() { |
| super.start(); |
| started.countDown(); |
| } |
| } |
| }</code></pre> |
| </div> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="sect1"> |
| <h2 id="_running">Running</h2> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>Running the example is fairly simple. In the ``javamail-api'' directory |
| run:</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlight"><code class="language-java" data-lang="java">$ mvn clean install</code></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>Which should create output like the following.</p> |
| </div> |
| <div class="listingblock"> |
| <div class="content"> |
| <pre class="highlight"><code class="language-java" data-lang="java">Running org.superbiz.rest.EmailServiceTest |
| Mai 06, 2022 8:22:00 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Created new singletonService org.apache.openejb.cdi.ThreadSingletonServiceImpl@5db250b4 |
| Mai 06, 2022 8:22:00 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Succeeded in installing singleton service |
| Mai 06, 2022 8:22:00 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Cannot find the configuration file [conf/openejb.xml]. Will attempt to create one for the beans deployed. |
| Mai 06, 2022 8:22:00 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service) |
| Mai 06, 2022 8:22:00 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager) |
| Mai 06, 2022 8:22:00 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Configuring Service(id=tomee/mail/mySMTP, type=Resource, provider-id=Default Mail Session) |
| Mai 06, 2022 8:22:00 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Creating TransactionManager(id=Default Transaction Manager) |
| Mai 06, 2022 8:22:00 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Creating SecurityService(id=Default Security Service) |
| Mai 06, 2022 8:22:00 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Creating Resource(id=tomee/mail/mySMTP) |
| Mai 06, 2022 8:22:00 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Initializing network services |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Creating ServerService(id=cxf-rs) |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Creating ServerService(id=httpejbd) |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Created ServicePool 'httpejbd' with (10) core threads, limited to (200) threads with a queue of (9) |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Initializing network services |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: ** Bound Services ** |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: NAME IP PORT |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: httpejbd 127.0.0.1 4204 |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: ------- |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Ready! |
| WARNING: An illegal reflective access operation has occurred |
| WARNING: Illegal reflective access by org.apache.openejb.server.httpd.util.HttpUtil (file:/home/zowallar/.m2/repository/org/apache/tomee/openejb-http/9.0.0-M9-SNAPSHOT/openejb-http-9.0.0-M9-SNAPSHOT.jar) to field java.lang.reflect.Field.modifiers |
| WARNING: Please consider reporting this to the maintainers of org.apache.openejb.server.httpd.util.HttpUtil |
| WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations |
| WARNING: All illegal access operations will be denied in a future release |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Configuring enterprise application: /home/zowallar/Downloads/tomee/examples/javamail/EmailServiceTest |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Configuring Service(id=Default Managed Container, type=Container, provider-id=Default Managed Container) |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Auto-creating a container for bean org.superbiz.rest.EmailServiceTest: Container(type=MANAGED, id=Default Managed Container) |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Creating Container(id=Default Managed Container) |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Using directory /tmp for stateful session passivation |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Enterprise application "/home/zowallar/Downloads/tomee/examples/javamail/EmailServiceTest" loaded. |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Creating dedicated application classloader for EmailServiceTest |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Assembling app: /home/zowallar/Downloads/tomee/examples/javamail/EmailServiceTest |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Ignoring XML Configuration for validator org.apache.bval.jsr.ConfigurationImpl |
| Mai 06, 2022 8:22:01 VORM. org.apache.batchee.container.services.ServicesManager init |
| WARNUNG: You didn't specify org.apache.batchee.jmx.application and JMX is already registered, skipping |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Application{path='http://127.0.0.1:4204/test/', class=org.apache.openejb.server.rest.InternalApplication, resources=1, providers=0, invalids=0} |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Resource{clazz=org.superbiz.rest.EmailService, discovered=false, singleton=false} |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Using readers: |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.cxf.jaxrs.provider.PrimitiveTextProvider@71ad3d8a |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.cxf.jaxrs.provider.FormEncodingProvider@5477a1ca |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.cxf.jaxrs.provider.MultipartProvider@3ae9d1e2 |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.cxf.jaxrs.provider.SourceProvider@41522537 |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.cxf.jaxrs.provider.JAXBElementTypedProvider@e9dc4d0 |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.cxf.jaxrs.provider.JAXBElementProvider@670d4d38 |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.openejb.server.cxf.rs.johnzon.TomEEJsonpProvider@47af099e |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.openejb.server.cxf.rs.johnzon.TomEEJsonbProvider@131ff6fa |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.cxf.jaxrs.provider.StringTextProvider@700f518a |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.cxf.jaxrs.provider.BinaryDataProvider@b835727 |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.cxf.jaxrs.provider.DataSourceProvider@13da7ab0 |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Using writers: |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.cxf.jaxrs.provider.JAXBElementTypedProvider@e9dc4d0 |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.openejb.server.cxf.rs.johnzon.TomEEJsonpProvider@47af099e |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.johnzon.jaxrs.WadlDocumentMessageBodyWriter@2c8662ac |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.cxf.jaxrs.nio.NioMessageBodyWriter@260ff5b7 |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.cxf.jaxrs.provider.StringTextProvider@700f518a |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.cxf.jaxrs.provider.PrimitiveTextProvider@71ad3d8a |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.cxf.jaxrs.provider.FormEncodingProvider@5477a1ca |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.cxf.jaxrs.provider.MultipartProvider@3ae9d1e2 |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.cxf.jaxrs.provider.JAXBElementProvider@670d4d38 |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.cxf.jaxrs.provider.SourceProvider@41522537 |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.openejb.server.cxf.rs.johnzon.TomEEJsonbProvider@131ff6fa |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.cxf.jaxrs.provider.BinaryDataProvider@b835727 |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.cxf.jaxrs.provider.DataSourceProvider@13da7ab0 |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Using exception mappers: |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper@150ede8b |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.openejb.server.cxf.rs.EJBExceptionMapper@d8d9199 |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.cxf.jaxrs.validation.ValidationExceptionMapper@161f6623 |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: org.apache.openejb.server.cxf.rs.CxfRsHttpListener$CxfResponseValidationExceptionMapper@3e15bb06 |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: REST Application: http://127.0.0.1:4204/test/ -> org.apache.openejb.server.rest.InternalApplication@72456279 |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Service URI: http://127.0.0.1:4204/test/email -> Pojo org.superbiz.rest.EmailService |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: POST http://127.0.0.1:4204/test/email -> String lowerCase(String) |
| Mai 06, 2022 8:22:01 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Deployed Application(path=/home/zowallar/Downloads/tomee/examples/javamail/EmailServiceTest) |
| Loading javamail.default.providers from jar:file:/home/zowallar/.m2/repository/org/apache/geronimo/mail/geronimo-mail_2.1_provider/1.0.0-SNAPSHOT/geronimo-mail_2.1_provider-1.0.0-SNAPSHOT.jar!/META-INF/javamail.default.providers |
| DEBUG: loading new provider protocol=smtp, className=org.apache.geronimo.mail.transport.smtp.SMTPTransport, vendor=Apache Software Foundation, version=1.0 |
| DEBUG: loading new provider protocol=smtps, className=org.apache.geronimo.mail.transport.smtp.SMTPSTransport, vendor=Apache Software Foundation, version=1.0 |
| DEBUG: loading new provider protocol=nntp-post, className=org.apache.geronimo.mail.transport.nntp.NNTPTransport, vendor=Apache Software Foundation, version=1.0 |
| DEBUG: loading new provider protocol=nntp-posts, className=org.apache.geronimo.mail.transport.nntp.NNTPSSLTransport, vendor=Apache Software Foundation, version=1.0 |
| DEBUG: loading new provider protocol=nntp, className=org.apache.geronimo.mail.store.nntp.NNTPStore, vendor=Apache Software Foundation, version=1.0 |
| DEBUG: loading new provider protocol=nntps, className=org.apache.geronimo.mail.store.nntp.NNTPSSLStore, vendor=Apache Software Foundation, version=1.0 |
| DEBUG: loading new provider protocol=pop3, className=org.apache.geronimo.mail.store.pop3.POP3Store, vendor=Apache Software Foundation, version=1.0 |
| DEBUG: loading new provider protocol=pop3s, className=org.apache.geronimo.mail.store.pop3.POP3SSLStore, vendor=Apache Software Foundation, version=1.0 |
| DEBUG: loading new provider protocol=imap, className=org.apache.geronimo.mail.store.imap.IMAPStore, vendor=Apache Software Foundation, version=1.0 |
| DEBUG: loading new provider protocol=imaps, className=org.apache.geronimo.mail.store.imap.IMAPSSLStore, vendor=Apache Software Foundation, version=1.0 |
| Loading javamail.default.providers from jar:file:/home/zowallar/.m2/repository/com/sun/mail/jakarta.mail/2.0.1/jakarta.mail-2.0.1.jar!/META-INF/javamail.default.providers |
| DEBUG: loading new provider protocol=imap, className=com.sun.mail.imap.IMAPStore, vendor=Oracle, version=null |
| DEBUG: loading new provider protocol=imaps, className=com.sun.mail.imap.IMAPSSLStore, vendor=Oracle, version=null |
| DEBUG: loading new provider protocol=smtp, className=com.sun.mail.smtp.SMTPTransport, vendor=Oracle, version=null |
| DEBUG: loading new provider protocol=smtps, className=com.sun.mail.smtp.SMTPSSLTransport, vendor=Oracle, version=null |
| DEBUG: loading new provider protocol=pop3, className=com.sun.mail.pop3.POP3Store, vendor=Oracle, version=null |
| DEBUG: loading new provider protocol=pop3s, className=com.sun.mail.pop3.POP3SSLStore, vendor=Oracle, version=null |
| Loading javamail.default.providers from jar:file:/home/zowallar/.m2/repository/org/apache/geronimo/mail/geronimo-mail_2.1_provider/1.0.0-SNAPSHOT/geronimo-mail_2.1_provider-1.0.0-SNAPSHOT.jar!/META-INF/javamail.default.providers |
| DEBUG: loading new provider protocol=smtp, className=org.apache.geronimo.mail.transport.smtp.SMTPTransport, vendor=Apache Software Foundation, version=1.0 |
| DEBUG: loading new provider protocol=smtps, className=org.apache.geronimo.mail.transport.smtp.SMTPSTransport, vendor=Apache Software Foundation, version=1.0 |
| DEBUG: loading new provider protocol=nntp-post, className=org.apache.geronimo.mail.transport.nntp.NNTPTransport, vendor=Apache Software Foundation, version=1.0 |
| DEBUG: loading new provider protocol=nntp-posts, className=org.apache.geronimo.mail.transport.nntp.NNTPSSLTransport, vendor=Apache Software Foundation, version=1.0 |
| DEBUG: loading new provider protocol=nntp, className=org.apache.geronimo.mail.store.nntp.NNTPStore, vendor=Apache Software Foundation, version=1.0 |
| DEBUG: loading new provider protocol=nntps, className=org.apache.geronimo.mail.store.nntp.NNTPSSLStore, vendor=Apache Software Foundation, version=1.0 |
| DEBUG: loading new provider protocol=pop3, className=org.apache.geronimo.mail.store.pop3.POP3Store, vendor=Apache Software Foundation, version=1.0 |
| DEBUG: loading new provider protocol=pop3s, className=org.apache.geronimo.mail.store.pop3.POP3SSLStore, vendor=Apache Software Foundation, version=1.0 |
| DEBUG: loading new provider protocol=imap, className=org.apache.geronimo.mail.store.imap.IMAPStore, vendor=Apache Software Foundation, version=1.0 |
| DEBUG: loading new provider protocol=imaps, className=org.apache.geronimo.mail.store.imap.IMAPSSLStore, vendor=Apache Software Foundation, version=1.0 |
| Loading javamail.default.providers from jar:file:/home/zowallar/.m2/repository/com/sun/mail/jakarta.mail/2.0.1/jakarta.mail-2.0.1.jar!/META-INF/javamail.default.providers |
| DEBUG: loading new provider protocol=imap, className=com.sun.mail.imap.IMAPStore, vendor=Oracle, version=null |
| DEBUG: loading new provider protocol=imaps, className=com.sun.mail.imap.IMAPSSLStore, vendor=Oracle, version=null |
| DEBUG: loading new provider protocol=smtp, className=com.sun.mail.smtp.SMTPTransport, vendor=Oracle, version=null |
| DEBUG: loading new provider protocol=smtps, className=com.sun.mail.smtp.SMTPSSLTransport, vendor=Oracle, version=null |
| DEBUG: loading new provider protocol=pop3, className=com.sun.mail.pop3.POP3Store, vendor=Oracle, version=null |
| DEBUG: loading new provider protocol=pop3s, className=com.sun.mail.pop3.POP3SSLStore, vendor=Oracle, version=null |
| DEBUG: getProvider() returning provider protocol=smtp; type=jakarta.mail.Provider$Type@38dbbb2d; class=org.apache.geronimo.mail.transport.smtp.SMTPTransport; vendor=Apache Software Foundation;version=1.0 |
| smtp DEBUG: Failing connection for missing authentication information |
| smtp DEBUG: Attempting plain socket connection to server localhost:44959 |
| 220 /127.0.0.1 GreenMail SMTP Service v2.0.0-alpha-2 ready |
| EHLO node-147 |
| 250-/127.0.0.1 |
| 250 AUTH PLAIN LOGIN |
| smtp DEBUG: Processing extension AUTH PLAIN LOGIN |
| smtp DEBUG: Authenticating for user: admin@localhost using LOGIN |
| AUTH LOGIN |
| 334 VXNlcm5hbWU6 |
| YWRtaW5AbG9jYWxob3N0 |
| 334 UGFzc3dvcmQ6 |
| czNjcjN0 |
| 235 2.7.0 Authentication Succeeded |
| smtp DEBUG: Successful SMTP authentication |
| smtp DEBUG: Successful connection |
| MAIL FROM: <admin@localhost> |
| 250 OK |
| RCPT TO: <user@provider.com> |
| 250 OK |
| DATA |
| 354 Start mail input; end with <CRLF>.<CRLF> |
| Date: Fri, 6 May 2022 08:22:02 +0200 (CEST) |
| From: admin@localhost |
| To: user@provider.com |
| Message-ID: <1276594763.01651818122213.JavaMail.zowallar@node-147> |
| Subject: JavaMail API test |
| MIME-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 7bit |
| |
| Hello TomEE |
| . |
| 250 OK |
| QUIT |
| 221 /127.0.0.1 Service closing transmission channel |
| Mai 06, 2022 8:22:02 VORM. com.icegreen.greenmail.user.UserManager$1 handle |
| INFORMATION: Created user login user@provider.com for address user@provider.com with password user@provider.com because it didn't exist before. |
| Mai 06, 2022 8:22:02 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Undeploying app: /home/zowallar/Downloads/tomee/examples/javamail/EmailServiceTest |
| Mai 06, 2022 8:22:02 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Stopping network services |
| Mai 06, 2022 8:22:02 VORM. org.apache.openejb.util.LogStreamAsync run |
| INFORMATION: Stopping server services</code></pre> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="sect1"> |
| <h2 id="_apis_used">APIs Used</h2> |
| <div class="sectionbody"> |
| <div class="ulist"> |
| <ul> |
| <li> |
| <p><a href="../../tomee-9.0/javadoc/org/apache/openejb/jee/WebApp.html">org.apache.openejb.jee.WebApp</a></p> |
| </li> |
| <li> |
| <p><a href="../../tomee-9.0/javadoc/org/apache/openejb/junit/ApplicationComposer.html">org.apache.openejb.junit.ApplicationComposer</a></p> |
| </li> |
| <li> |
| <p><a href="../../tomee-9.0/javadoc/org/apache/openejb/testing/Classes.html">org.apache.openejb.testing.Classes</a></p> |
| </li> |
| <li> |
| <p><a href="../../tomee-9.0/javadoc/org/apache/openejb/testing/Configuration.html">org.apache.openejb.testing.Configuration</a></p> |
| </li> |
| <li> |
| <p><a href="../../tomee-9.0/javadoc/org/apache/openejb/testing/EnableServices.html">org.apache.openejb.testing.EnableServices</a></p> |
| </li> |
| <li> |
| <p><a href="../../tomee-9.0/javadoc/org/apache/openejb/testing/Module.html">org.apache.openejb.testing.Module</a></p> |
| </li> |
| <li> |
| <p><a href="../../tomee-9.0/javadoc/org/apache/openejb/util/NetworkUtil.html">org.apache.openejb.util.NetworkUtil</a></p> |
| </li> |
| <li> |
| <p><a href="../../jakartaee-10.0/javadoc/jakarta/annotation/Resource.html">jakarta.annotation.Resource</a></p> |
| </li> |
| <li> |
| <p><a href="../../jakartaee-10.0/javadoc/jakarta/ws/rs/POST.html">jakarta.ws.rs.POST</a></p> |
| </li> |
| <li> |
| <p><a href="../../jakartaee-10.0/javadoc/jakarta/ws/rs/Path.html">jakarta.ws.rs.Path</a></p> |
| </li> |
| </ul> |
| </div> |
| </div> |
| </div> |
| </div> |
| |
| </div> |
| </div> |
| <div style="margin-bottom: 30px;"></div> |
| <footer> |
| <div class="container"> |
| <div class="row"> |
| <div class="col-sm-6 text-center-mobile"> |
| <h3 class="white">Be simple. Be certified. Be Tomcat.</h3> |
| <h5 class="light regular light-white">"A good application in a good server"</h5> |
| <ul class="social-footer"> |
| <li><a href="https://www.facebook.com/ApacheTomEE/"><i class="fa fa-facebook"></i></a></li> |
| <li><a href="https://twitter.com/apachetomee"><i class="fa fa-twitter"></i></a></li> |
| </ul> |
| <h5 class="light regular light-white"> |
| <a href="../../privacy-policy.html" class="white">Privacy Policy</a> |
| </h5> |
| </div> |
| <div class="col-sm-6 text-center-mobile"> |
| <div class="row opening-hours"> |
| <div class="col-sm-3 text-center-mobile"> |
| <h5><a href="../../latest/docs/" class="white">Documentation</a></h5> |
| <ul class="list-unstyled"> |
| <li><a href="../../latest/docs/admin/configuration/index.html" class="regular light-white">How to configure</a></li> |
| <li><a href="../../latest/docs/admin/file-layout.html" class="regular light-white">Dir. Structure</a></li> |
| <li><a href="../../latest/docs/developer/testing/index.html" class="regular light-white">Testing</a></li> |
| <li><a href="../../latest/docs/admin/cluster/index.html" class="regular light-white">Clustering</a></li> |
| </ul> |
| </div> |
| <div class="col-sm-3 text-center-mobile"> |
| <h5><a href="../../latest/examples/" class="white">Examples</a></h5> |
| <ul class="list-unstyled"> |
| <li><a href="../../latest/examples/simple-cdi-interceptor.html" class="regular light-white">CDI Interceptor</a></li> |
| <li><a href="../../latest/examples/rest-cdi.html" class="regular light-white">REST with CDI</a></li> |
| <li><a href="../../latest/examples/ejb-examples.html" class="regular light-white">EJB</a></li> |
| <li><a href="../../latest/examples/jsf-managedBean-and-ejb.html" class="regular light-white">JSF</a></li> |
| </ul> |
| </div> |
| <div class="col-sm-3 text-center-mobile"> |
| <h5><a href="../../community/index.html" class="white">Community</a></h5> |
| <ul class="list-unstyled"> |
| <li><a href="../../community/contributors.html" class="regular light-white">Contributors</a></li> |
| <li><a href="../../community/social.html" class="regular light-white">Social</a></li> |
| <li><a href="../../community/sources.html" class="regular light-white">Sources</a></li> |
| </ul> |
| </div> |
| <div class="col-sm-3 text-center-mobile"> |
| <h5><a href="../../security/index.html" class="white">Security</a></h5> |
| <ul class="list-unstyled"> |
| <li><a href="https://apache.org/security" target="_blank" class="regular light-white">Apache Security</a></li> |
| <li><a href="https://apache.org/security/projects.html" target="_blank" class="regular light-white">Security Projects</a></li> |
| <li><a href="https://cve.mitre.org" target="_blank" class="regular light-white">CVE</a></li> |
| </ul> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="row bottom-footer text-center-mobile"> |
| <div class="col-sm-12 light-white"> |
| <p>Copyright © 1999-2022 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache TomEE, TomEE, Apache, the Apache feather logo, and the Apache TomEE project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.</p> |
| </div> |
| </div> |
| </div> |
| </footer> |
| <!-- Holder for mobile navigation --> |
| <div class="mobile-nav"> |
| <ul> |
| <li><a hef="../../latest/docs/admin/index.html">Administrators</a> |
| <li><a hef="../../latest/docs/developer/index.html">Developers</a> |
| <li><a hef="../../latest/docs/advanced/index.html">Advanced</a> |
| <li><a hef="../../community/index.html">Community</a> |
| </ul> |
| <a href="#" class="close-link"><i class="arrow_up"></i></a> |
| </div> |
| <!-- Scripts --> |
| <script src="../../js/jquery-1.11.1.min.js"></script> |
| <script src="../../js/owl.carousel.min.js"></script> |
| <script src="../../js/bootstrap.min.js"></script> |
| <script src="../../js/wow.min.js"></script> |
| <script src="../../js/typewriter.js"></script> |
| <script src="../../js/jquery.onepagenav.js"></script> |
| <script src="../../js/tree.jquery.js"></script> |
| <script src="../../js/highlight.pack.js"></script> |
| <script src="../../js/main.js"></script> |
| </body> |
| |
| </html> |
| |