[ 
https://issues.apache.org/jira/browse/CAMEL-13593?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Freeman Fang reassigned CAMEL-13593:
------------------------------------

    Assignee: Freeman Fang

> avoid “expected resource not found” warnings when using camel-mail in OSGi
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-13593
>                 URL: https://issues.apache.org/jira/browse/CAMEL-13593
>             Project: Camel
>          Issue Type: Improvement
>            Reporter: Freeman Fang
>            Assignee: Freeman Fang
>            Priority: Major
>
> In javax.mail API(1.6), it(javax.mail.Session) will use authenticator's 
> classloader to load two default files
> {code}
> META-INF/javamail.default.address.map
> META-INF/javamail.default.providers
> {code}
> Since camel-mail provider a DefaultAuthenticator, which means javax mail api 
> will try to use camel-mail bundle classloader in OSGi to load above default 
> files. Those files aren't available for camel-mail bundle classloader, so we 
> see warning message as
> {code}
>  2019-04-25 12:42:09,806 | WARN | 23 - scheduler://foo | j.mail | 21 - 
> com.sun.mail.javax.mail - 1.6.1 | expected resource not found: 
> /META-INF/javamail.default.providers
> 2019-04-25 12:42:09,807 | WARN | 23 - scheduler://foo | j.mail | 21 - 
> com.sun.mail.javax.mail - 1.6.1| expected resource not found: 
> /META-INF/javamail.default.address.map
> {code}
> This warning message isn't harmful but annoying. The javax.mail.Session will 
> always add default stuff by code if can't find the default configuration file
> {code}
>        if (providers.size() == 0) {
>             logger.config("failed to load any providers, using defaults");
>             // failed to load any providers, initialize with our defaults
>             addProvider(new Provider(Provider.Type.STORE,
>                         "imap", "com.sun.mail.imap.IMAPStore",
>                         "Oracle", Version.version));
>             addProvider(new Provider(Provider.Type.STORE,
>                         "imaps", "com.sun.mail.imap.IMAPSSLStore",
>                         "Oracle", Version.version));
>             addProvider(new Provider(Provider.Type.STORE,
>                         "pop3", "com.sun.mail.pop3.POP3Store",
>                         "Oracle", Version.version));
>             addProvider(new Provider(Provider.Type.STORE,
>                         "pop3s", "com.sun.mail.pop3.POP3SSLStore",
>                         "Oracle", Version.version));
>             addProvider(new Provider(Provider.Type.TRANSPORT,
>                         "smtp", "com.sun.mail.smtp.SMTPTransport",
>                         "Oracle", Version.version));
>             addProvider(new Provider(Provider.Type.TRANSPORT,
>                         "smtps", "com.sun.mail.smtp.SMTPSSLTransport",
>                         "Oracle", Version.version));
>         }
>        if (addressMap.isEmpty()) {
>             logger.config("failed to load address map, using defaults");
>             addressMap.put("rfc822", "smtp");
>         }
> {code}
> It's better we can avoid such WARN message when using camel-mail in OSGi



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to