https://bz.apache.org/bugzilla/show_bug.cgi?id=68460

            Bug ID: 68460
           Summary: mail task fails in Java 17 and Java 21
           Product: Ant
           Version: 1.10.14
          Hardware: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: Core tasks
          Assignee: notifications@ant.apache.org
          Reporter: kristjanbja...@gmail.com
  Target Milestone: ---

Sending email with the mail task using Ant version 1.10.14 with either Java JDK
17 or Java JDK 21 results in this error:

"Failed to send email: could not instantiate ssl security provider, check that
you have JSSE in your classpath"

Here is the build.xml used to generate the error:

<?xml version="1.0" encoding="UTF-8" ?>
<project name="test" default="test">
<target name="test" >
<mail mailhost="smtp.gmail.com" mailport="465" subject="Test" ssl="on"
  user="kristjanbja...@gmail.com" password="redacted">
  <from address="kristjanbja...@gmail.com"/>
  <to address="kristjanbja...@gmail.com"/>
  <message>Test</message>
</mail>
</target>
</project>

After looking at the source code it seems the error is in
JakartaMimeMailer.java and MimeMailer.java:

try {
    final Provider p =
        Class.forName("com.sun.net.ssl.internal.ssl.Provider")
            .asSubclass(Provider.class).getDeclaredConstructor().newInstance();
    Security.addProvider(p);
} catch (final Exception e) {
    throw new BuildException(
        "could not instantiate ssl security provider, check that you have JSSE
in your classpath");
}

According to this bug report for OpenJDK:

https://bugs.openjdk.org/browse/JDK-8240974

referring to "com.sun.net.ssl.internal.ssl.Provider" is no longer supported.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to