1

javax.mail 機能を使用して添付ファイル付きのメールを送信しようとしています。以下は私のコードです。

// create the message part
MimeBodyPart messageBodyPart = new MimeBodyPart();
// fill message
messageBodyPart.setText(strmessage);
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart);
AdcsipLogger.adcsipLog("begin exportFile...........");
ExportFile exportFile = buildQuestionnaireReport(questionnaire);
// Part two is attachment
messageBodyPart = new MimeBodyPart();
DataSource source = new ExportFileDataSource(exportFile);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(questionnaire.getName() + ".pdf");
multipart.addBodyPart(messageBodyPart);
// Put parts in message
message.setContent(multipart);
// Send the message
Transport.send(message);

行で例外が発生しています: messageBodyPart.setDataHandler(new DataHandler(source));

以下は、スタックトレースからの抜粋です。

[10/30/13 14:44:38:089 CET] 00000062 ServletWrappe E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: Uncaught exception created in one of the service methods of the servlet QuestionnaireControl in application A430-CADCSIP-V8.0_Run4. Exception created : java.lang.VerifyError: javax/mail/internet/MimeBodyPart.setDataHandler(Ljavax/activation/DataHandler;)V

私を助けてください。ありがとう。

4

1 に答える 1

0

WebSphere で実行していますよね?

アプリケーションに JavaMail jar ファイルが含まれていますか? その場合、WebSphere に含まれているバージョンと競合している可能性があります。

于 2013-10-30T19:16:28.800 に答える