Bug 1163150 - pop3 mail session throws a NoSuchProviderException
Summary: pop3 mail session throws a NoSuchProviderException
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Mail
Version: 6.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: DR10
: EAP 6.4.0
Assignee: jboss-set
QA Contact: Martin Simka
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-11-12 12:48 UTC by JJ
Modified: 2019-08-19 12:42 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker WFLY-4074 0 Major Resolved pop3 mail session throws a NoSuchProviderException 2015-09-10 10:07:25 UTC

Description JJ 2014-11-12 12:48:03 UTC
Description of problem:

When configuring a pop3 server in standalone.xml as, the following exception is thrown when reading the mailbox:

Caused by: javax.mail.NoSuchProviderException: Invalid protocol: null
	at javax.mail.Session.getProvider(Session.java:440) [mail-1.4.5-redhat-1.jar:1.4.5-redhat-1]
	at javax.mail.Session.getStore(Session.java:539) [mail-1.4.5-redhat-1.jar:1.4.5-redhat-1] 


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. add a pop3 server in the mail section

            <mail-session jndi-name="java:/MyMail" from="xxx@xxx">
                <smtp-server outbound-socket-binding-ref="smtp-outbound">
                    <login name="xxx" password="xxx"/>
                </smtp-server>
                <pop3-server outbound-socket-binding-ref="pop3-outbound">
                    <login name="xxx" password="xxx"/>
                </pop3-server>
            </mail-session>


2. try to read the mailbox


Actual results:

Throws an javax.mail.NoSuchProviderException


Expected results:



Additional info:

The bug is probably in class org.jboss.as.mail.extension.MailSessionService, where no protocol for pop3 is set. 

Code snippet to make it work:

    private Properties getProperties() throws StartException {
        Properties props = new Properties();

        if (config.getSmtpServer() != null) {
            props.setProperty("mail.transport.protocol", "smtp");
            setServerProps(props, config.getSmtpServer(), "smtp");
        }
        if (config.getImapServer() != null) {
            props.setProperty("mail.store.protocol", "imap");
            setServerProps(props, config.getImapServer(), "imap");
        }
        if (config.getPop3Server() != null) {
            props.setProperty("mail.store.protocol", "pop3");   // THIS LINE WAS MISSED
            setServerProps(props, config.getPop3Server(), "pop3");
        }
        if (config.getCustomServers() != null) {
            configureCustomServers(props, config.getCustomServers());
        }
        if (config.getFrom() != null) {
            props.setProperty("mail.from", config.getFrom());
        }
        props.setProperty("mail.debug", String.valueOf(config.isDebug()));
        MailLogger.ROOT_LOGGER.tracef("props: %s", props);
        return props;
    }

Comment 2 Martin Simka 2014-12-01 15:53:39 UTC
verified on EAP 6.4.0.DR11


Note You need to log in before you can comment on or make changes to this bug.