Details
Description
In javax.mail API(1.6), it(javax.mail.Session) will use authenticator's classloader to load two default files
META-INF/javamail.default.address.map META-INF/javamail.default.providers
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
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
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
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"); }
But it's better we can avoid such WARN message when using camel-mail in OSGi