Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning message when creating Session instance #25

Closed
niabot opened this issue Sep 6, 2022 · 5 comments
Closed

Warning message when creating Session instance #25

niabot opened this issue Sep 6, 2022 · 5 comments

Comments

@niabot
Copy link

niabot commented Sep 6, 2022

Describe the bug
When creating a jakarta.mail.Session instance with Session.getInstance(...) the following warning is logged:

Sept. 06, 2022 5:13:39 PM jakarta.mail.Session loadResource
WARNING: expected resource not found: /META-INF/javamail.default.address.map

Looking inside the angus-mail-1.0.0.jar i see that the file /META-INF/javamail.default.address.map is present with rfc822=smtp as the content, but it isn't found.

The reason is that jakarta.mail.Session uses the passed Authenticator class instance or it's own class instance to lookup the resources. If i pass my own authenticator instance, then it searches within my own module, but not in com.sun.mail. If i pass null as the authenticator, then it searches inside the module jakarta.mail. Either way the resource is not found.

If i place /META-INF/javamail.default.address.map in my own module, the resource is found and no warning is logged.

Normal usage of the Session instance is not affected.

To Reproduce
Create a Session instance with Session.getInstance(props) or Session.getInstance(props, authenticator) within an own module and the warning message should be logged.

Expected behavior
No warning message should be logged.

@jmehrens
Copy link
Contributor

jmehrens commented Sep 9, 2022

@jbescos Looks like PR from jakartaee/mail-api#599 would have to be ported to Angus Mail.

@jbescos
Copy link
Member

jbescos commented Sep 26, 2022

@jmehrens I think the fix is correctly placed in mail-api. If I recall, the issue was that mail-api module is trying to access angus-mail module, but mail-api module has no access to it. Then, the fix is about loading that resource from an angus-mail class (the stream provider implementation).

I developed that fix some time ago and I don't remember all the details. @niabot are you able to test it with the attached jar (that contains the fix jakartaee/mail-api#599) and let us know if you still see the warning, please?.

jakarta.mail-api.zip

@PeteSL
Copy link

PeteSL commented Sep 27, 2022

I was having same error. Tested attached jar and no error. However, IMAP is not being checked correctly but that is another issue.

@jbescos
Copy link
Member

jbescos commented Sep 27, 2022

Thank you @PeteSL , your test confirms this PR jakartaee/mail-api#599 works.

For the other IMAP issue that you have, you can open a new issue and we will take a look.

@lukasj
Copy link
Member

lukasj commented Jan 19, 2023

I believe this is fixed

@lukasj lukasj closed this as completed Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants