WSO2 - 使用与javax.mail不兼容的IMAPMessage?

时间:2023-01-03 18:13:35

I'm using WSO2 ESB to check emails from an IMAP mailbox. Some of the emails are signed and encrypted with a 256 certificate. I'm using BouncyCastle to decrypt the message. I have a compatibility issue over mail.jar (javax.mail).

我正在使用WSO2 ESB来检查来自IMAP邮箱的电子邮件。某些电子邮件使用256证书进行签名和加密。我正在使用BouncyCastle解密消息。我有一个与mail.jar(javax.mail)的兼容性问题。

1/ I'm getting the email:

1 /我收到的电子邮件:

if (message instanceof IMAPMessage) {

2/ I'm casting the message to BC:

2 /我正在向BC传播信息:

final SMIMEEnveloped m = new SMIMEEnveloped((MimeMessage) message);

3/ I'm getting this error on this cast:

3 /我在这个演员表上收到此错误:

java.lang.IncompatibleClassChangeError: Class com.sun.mail.imap.IMAPMessage does not implement the requested interface javax.mail.Part
    at org.bouncycastle.mail.smime.SMIMEEnveloped.getInputStream(Unknown Source)
    at org.bouncycastle.mail.smime.SMIMEEnveloped.<init>(Unknown Source)

I'm using the bcprov-jdk15on-1.52.jar which is included in WSO2 ESB. I use mail-1.4.jar for javax.mail and com.sun.mail classes.

我正在使用包含在WSO2 ESB中的bcprov-jdk15on-1.52.jar。我对javax.mail和com.sun.mail类使用mail-1.4.jar。

I'm thinking of a mail.jar version conflict but I can't find out where the other class comes from.

我正在考虑mail.jar版本冲突,但我无法找到其他类来自哪里。

Help will be appreciated !

帮助将不胜感激!

1 个解决方案

#1


0  

I finally managed to retreive emails from IMAP. You must override some libs of WSO2: bcmail-jdk15on-1.52.jar and jsch-0.1.51.wso2v1.jar to make SMIME decode code work. Copy those libs to wso2esb-5.0.0/repository/components/lib.

我终于设法收回了IMAP的电子邮件。您必须覆盖WSO2的一些库:bcmail-jdk15on-1.52.jar和jsch-0.1.51.wso2v1.jar以使SMIME解码代码正常工作。将这些库复制到wso2esb-5.0.0 / repository / components / lib。

Hope that helps someone else.

希望能帮助别人。

#1


0  

I finally managed to retreive emails from IMAP. You must override some libs of WSO2: bcmail-jdk15on-1.52.jar and jsch-0.1.51.wso2v1.jar to make SMIME decode code work. Copy those libs to wso2esb-5.0.0/repository/components/lib.

我终于设法收回了IMAP的电子邮件。您必须覆盖WSO2的一些库:bcmail-jdk15on-1.52.jar和jsch-0.1.51.wso2v1.jar以使SMIME解码代码正常工作。将这些库复制到wso2esb-5.0.0 / repository / components / lib。

Hope that helps someone else.

希望能帮助别人。