Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-70627

Class conflict between javax.mail and jakarta

XMLWordPrintable

      Attempting to use recent versions of the email extension plugin (among others) results in a verification error in the JDK for com.sun.mail.smtp.SMTPAddressSucceededException.

      It appears to be because the jakarta mail-api plugin rebundles a variation of com.sun.mail.smtp.SMTPAddressSucceededException that extends jakarta.mail.MessagingException whereas the one from java-mail 1.6.2 extends javax.mail.MessagingException.

      The jakarta-mail-api ends up conflicting with some of the java-mail classes because javax-mail-api plugin is a detached plugin included in Jenkins core and I suspect it thus has classloading precedence over the jakarta-mail-api plugin.

      The latest Jenkins core includes jakarta-mail-api as a detached plugin and although I have not tested this I suspect that it will ultimately fix the issue as alphabetical class loading will prefer the jakarta classes over the java mail ones. It appears it was added in Jenkins 2.378 by this PR as a mitigation of JENKINS-69361

      Workaround is to use older versions of plugins that do not make use of the jakarta-mail-api plugin.

      22:07:46  java.lang.VerifyError: Inconsistent stackmap frames at branch target 819
      22:07:46  Exception Details:
      22:07:46    Location:
      22:07:46      com/sun/mail/smtp/SMTPTransport.rcptTo()V @819: iinc
      22:07:46    Reason:
      22:07:46      Type 'com/sun/mail/smtp/SMTPAddressSucceededException' (current frame, locals[5]) is not assignable to 'javax/mail/MessagingException' (stack map, locals[5])
      . . .
      22:07:46  	at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
      22:07:46  	at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3137)
      22:07:46  	at java.base/java.lang.Class.getConstructor0(Class.java:3342)
      22:07:46  	at java.base/java.lang.Class.getConstructor(Class.java:2151)
      22:07:46  	at jakarta.mail.Session.getService(Session.java:849)
      22:07:46  	at jakarta.mail.Session.getTransport(Session.java:772)
      22:07:46  	at jakarta.mail.Session.getTransport(Session.java:713)
      22:07:46  	at jakarta.mail.Session.getTransport(Session.java:693)
      22:07:46  	at jakarta.mail.Session.getTransport(Session.java:750)
      22:07:46  	at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:520)
      22:07:46  	at hudson.plugins.emailext.EmailExtStep$EmailExtStepExecution.run(EmailExtStep.java:249)
      22:07:46  	at hudson.plugins.emailext.EmailExtStep$EmailExtStepExecution.run(EmailExtStep.java:182)
      22:07:46  	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
      22:07:46  	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
      22:07:46  	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      22:07:46  	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      22:07:46  	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      22:07:46  	at java.base/java.lang.Thread.run(Thread.java:829)
      

            basil Basil Crow
            mrichar2 Mark R
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: