2013-10-30 41 views
1

我試圖使用javax.mail功能來發送郵件帶有附件發送郵件,下面是我的代碼:獲取java.lang.VerifyError的同時使用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 

請幫助我。 謝謝。

回答

0

您正在WebSphere中運行,對不對?

您的應用程序中是否包含JavaMail jar文件?如果是這樣,它可能與WebSphere中包含的版本衝突。