Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > Develop Mail, URLs, and other Java EE resources > Develop applications that use the JavaMail API


Debug mail sessions

When you debug a mail application, you can use the mail debugging feature. The mail component generates debugging information, on a per session basis, that can be used for problem determination or tuning.

Enable the debug mode triggers the mail component of the application server to print the following data to the standard output stream:

This output stream is redirected to the SystemOut.log file for the specific application server.

New feature: Beginning in WAS v8.0 you can configure the server to use the HPEL log and trace infrastructure instead of using SystemOut.log , SystemErr.log, trace.log, and activity.log files or native z/OS logging facilities. If you are using HPEL, you can access all of your log and trace information using the LogViewer command-line tool from your server profile bin directory. See the information about using HPEL to troubleshoot applications for more information on using HPEL.New feature:


Procedure

  1. Open the admin console.

  2. Click Resources > Mail > Mail sessions > mail session.

  3. Click Enable debug mode. Debugging is enabled for that session only.

  4. Click Apply or OK.


Example

The following example shows sample mail debugging output:

ResourceMgrIm I   WSVR0049I: Binding Test as mail/test
SystemOut
    O *** In SessionReferenceable.getReference:
SystemOut
    O  added StringRefAddr: type=ws.transport.password, content=****
SystemOut
    O  added StringRefAddr: type=ws.isolated.class.loader, content=false
SystemOut
    O  added StringRefAddr: type=mail.transport.protocol, content=smtp
SystemOut
    O  added StringRefAddr: type=mail.imaps.class, content=com.sun.mail.imap.IMAPSSLStore
SystemOut
    O  added StringRefAddr: type=mail.smtp.host, content=smtp.coldmail.com
SystemOut
    O  added StringRefAddr: type=mail.debug, content=true
SystemOut
    O  added StringRefAddr: type=mail.pop3s.class, content=com.sun.mail.pop3.POP3SSLStore
SystemOut
    O  added StringRefAddr: type=mail.from, content=smith@coldmail.com
SystemOut
    O  added StringRefAddr: type=mail.smtp.class, content=com.sun.mail.smtp.SMTPTransport
SystemOut
    O  added StringRefAddr: type=mail.smtps.class, content=com.sun.mail.smtp.SMTPSSLTransport
SystemOut
    O  added StringRefAddr: type=mail.imap.class, content=com.sun.mail.imap.IMAPStore
SystemOut
    O  added StringRefAddr: type=mail.smtp.user, content=smith
SystemOut
    O  added StringRefAddr: type=mail.pop3.class, content=com.sun.mail.pop3.POP3Store
SystemOut
    O  added StringRefAddr: type=mail.mime.address.strict, content=true


SystemOut
    O DEBUG: JavaMail version 1.4ea
SystemOut
    O DEBUG: java.io.FileNotFoundException:
C:\IBM\WebSphere\AppServer\java\jre\lib\javamail.providers
(The system cannot find the file specified.)
SystemOut
    O DEBUG: !anyLoaded
SystemOut
    O DEBUG: not loading resource: /META-INF/javamail.providers
SystemOut
    O DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
SystemOut
    O DEBUG: Tables of loaded providers
SystemOut
    O DEBUG: Providers Listed By Class Name:
     {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider
[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc],
com.sun.mail.smtp.SMTPTransport=javax.mail.Provider
[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc],
com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider
[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc],
com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider
[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc],
com.sun.mail.imap.IMAPStore=javax.mail.Provider
[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc],
com.sun.mail.pop3.POP3Store=javax.mail.Provider
[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]}
SystemOut
    O DEBUG: Providers Listed By Protocol:
{imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems,Inc],
imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc],
smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems,Inc],
pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc],
pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc],
smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]}
SystemOut
    O DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
SystemOut
    O DEBUG: !anyLoaded
SystemOut
    O DEBUG: not loading resource: /META-INF/javamail.address.map
SystemOut
    O DEBUG: java.io.FileNotFoundException:
     C:\IBM\WebSphere\AppServer\java\jre\lib\javamail.address.map
     (The system cannot find the file specified.)
SystemOut
    O *** In SessionFactory.setPasswordAuthentication,
   TRANSPORT PasswordAuthentication is based on:
SystemOut
    O  url=smtp://smith@smtp.coldmail.com
SystemOut
    O  user=smith
SystemOut
    O  password=****
SystemOut
    O *** In SessionFactory.getObjectInstance, session properties:
SystemOut
    O  mail.transport.protocol=smtp
SystemOut
    O  mail.imaps.class=com.sun.mail.imap.IMAPSSLStore
SystemOut
    O  mail.smtp.host=smtp.coldmail.com
SystemOut
    O  mail.debug=true

SystemOut
    O  mail.pop3s.class=com.sun.mail.pop3.POP3SSLStore
SystemOut
    O  mail.from=smith@coldmail.com
SystemOut
    O  mail.smtp.class=com.sun.mail.smtp.SMTPTransport
SystemOut
    O  mail.smtps.class=com.sun.mail.smtp.SMTPSSLTransport
SystemOut
    O  mail.imap.class=com.sun.mail.imap.IMAPStore
SystemOut
    O  mail.smtp.user=smith
SystemOut
    O  mail.pop3.class=com.sun.mail.pop3.POP3Store
SystemOut
    O  mail.mime.address.strict=true
SystemOut
    O DEBUG: mail.smtp.class property exists and points to com.sun.mail.smtp.SMTPTransport
SystemOut
    O DEBUG SMTP: useEhlo true, useAuth false
SystemOut
    O DEBUG SMTP: trying to connect to host "smtp.coldmail.com", port 25, isSSL false


javax.mail.MessagingException: Unknown SMTP host: smtp.coldmail.com;
  nested exception is:
 java.net.UnknownHostException: smtp.coldmail.com
 at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1280)
 at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
 at javax.mail.Service.connect(Service.java:275)
 at javax.mail.Service.connect(Service.java:156)
 at javax.mail.Service.connect(Service.java:105)
 at javax.mail.Transport.send0(Transport.java:168)
 at javax.mail.Transport.send(Transport.java:98)
 at com.ibm.ws.mail.ut.TestServlet.doTask(TestServlet.java:104)
 at com.ibm.ws.mail.ut.TestServlet.doGet(TestServlet.java:65)
 at javax.servlet.//publib.boulder.ibm.com/infocenter/wasinfo/v8r0/index.jsp?topic=/  .HttpServlet.service(HttpServlet.java:707)
 at javax.servlet.//publib.boulder.ibm.com/infocenter/wasinfo/v8r0/index.jsp?topic=/  .HttpServlet.service(HttpServlet.java:820)
 at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1397)
 at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:759)
 at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:429)
 at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:175)
 at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3512)
 at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:273)
 at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:896)
 at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1530)
 at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:161)
 at com.ibm.ws.//publib.boulder.ibm.com/infocenter/wasinfo/v8r0/index.jsp?topic=/  .channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
 at com.ibm.ws.//publib.boulder.ibm.com/infocenter/wasinfo/v8r0/index.jsp?topic=/  .channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
 at com.ibm.ws.//publib.boulder.ibm.com/infocenter/wasinfo/v8r0/index.jsp?topic=/  .channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:272)
 at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
 at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
 at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
 at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
 at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
 at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
 at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:202)
 at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:766)
 at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:896)
 at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1487)
Caused by: java.net.UnknownHostException: smtp.coldmail.com
 at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:196)
 at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
 at java.net.Socket.connect(Socket.java:519)
 at java.net.Socket.connect(Socket.java:469)
 at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:232)
 at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
 at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1250)
 ... 32 more 

This output illustrates a connection failure to a Simple Mail Transfer Protocol (SMTP) server because a fictitious name, smtp.coldmail.com, is specified as the server name.

The following list provides tips on reading the previous sample of debugger output:


Use HPEL to troubleshoot applications

+

Search Tips   |   Advanced Search