解决java.lang.LinkageError: loader constraint violation: when resolving method “javax.mail.internet.Mi…

  • Post author:
  • Post category:java


问题描述:

java.lang.LinkageError: loader constraint violation: when resolving method “javax.mail.internet.MimeBodyPart.setDataHandler(Ljavax/activation/DataHandler;)V” the class loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) of the current class, org/apache/axiom/om/impl/MIMEOutputUtils, and the class loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) for resolved class, javax/mail/internet/MimeBodyPart, have different Class objects for the type BodyPart.setDataHandler(Ljavax/activation/DataHandler;)V used in the signature

原因:

jar包的问题,有可能是版本的问题导致的

解决方法:

把javax.mail_1.4.0.jar 替换成 mail-1.4.jar

转载于:https://www.cnblogs.com/qaz2wsx/p/8393380.html