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

Mailer::close attempts to access the batch module regardless of configuration #558

Open
rzam opened this issue Oct 17, 2024 · 1 comment

Comments

@rzam
Copy link

rzam commented Oct 17, 2024

It seems that attempting to close a non-async Mailer (either explicitly via .close() or implicitly via try-with) will cause it to throw a ModuleLoaderException.

Minimal working example:

// Gradle
dependencies {
    implementation("org.simplejavamail:simple-java-mail:8.12.2")
}
try (Mailer mailer = MailerBuilder
        .withSMTPServer("localhost", 25, null, null)
        .buildMailer()) {
    // Do nothing
}

Result:

Exception in thread "main" org.simplejavamail.internal.moduleloader.ModuleLoaderException: Batch module not found, make sure it is on the classpath (https://github.com/bbottema/simple-java-mail/tree/develop/modules/batch-module)
	at org.simplejavamail.internal.moduleloader.ModuleLoader.loadModule(ModuleLoader.java:133)
	at org.simplejavamail.internal.moduleloader.ModuleLoader.loadBatchModule(ModuleLoader.java:95)
	at org.simplejavamail.mailer.internal.MailerImpl.shutdownConnectionPool(MailerImpl.java:395)
	at org.simplejavamail.mailer.internal.MailerImpl.close(MailerImpl.java:474)
	at Test.main(Test.java:11)
@bbottema
Copy link
Owner

I thought I was had addressed this recently. I'll have a look.

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

2 participants