2

I'm using the Camel SMTP component to send email messages from a Camel route, and it works fine, but I get two warning messages every time I send a mail.

expected resource not found: /META-INF/javamail.default.providers
expected resource not found: /META-INF/javamail.default.address.map

Is there a way of stopping this? I've tried putting blank resource files in the META-INF folder of the route's jar file, but that doesn't appear to have any effect. Apparently JavaMail tries to find these files in various places on the classpath, and default files should be in the JavaMail jar file, but for some reason, this isn't being picked up in the OSGi environment from which I'm running these routes.

The OSGi (Karaf) console lists bundles

JavaMail API v1.6.1
camel-mail 2.21.2

Can anyone tell me what I am missing here?

Thanks!

Screwtape
  • 1,337
  • 2
  • 12
  • 27
  • It seems to me that you have repackaged the JavaMail JAR files without including all the contents. You should not repackage them at all. – user207421 Mar 21 '19 at 09:28
  • Hi @user207421! I've not repackaged anything. I've edited the question to show the relevant bundles installed in the OSGi environment. I guess it's possible something is wrong with these, but that would seem unlikely. – Screwtape Mar 21 '19 at 11:22
  • 1
    It looks like your OSGi environment is preventing JavaMail from reading these resource files that are in the JavaMail jar file. If you don't want to see the warnings you can just configure the Logger to not show them. – Bill Shannon Mar 21 '19 at 22:46

1 Answers1

2

I tried a few solutions given at https://javaee.github.io/javamail/docs/api/index.html?javax/mail/Session.html. I use eclipse photon 4.8.0. The only thing what worked is to place an empty file named javamail.default.address.map into the folder src/main/java/META-INF. Alternative you can place it into the folder src/main/resources/META-INF, when you change the exclusion-pattern in eclipse-project to (none). Now everything works fine without the annoying warning.

pbaris
  • 4,525
  • 5
  • 37
  • 61
Matthias Wegner
  • 303
  • 4
  • 18