multipart / report -class cast exception
MultipartReport mr = (MultipartReport)p.getContent();
result in class cast exception
i have add my classpath to this:
.;C:\j2sdk1.4.2_1\bin;c:\dsn.jar;c:\mail.jar;c:\activation.jar;c:\pop3.jar;c:\s
mtp.jar;c:\mailapi.jar;
if(p.isMimeType("message/delivery-status")){
boolean deliveryStatusFailed=true;
//add by won to handle delivery status
System.err.println("This is a Multipart Report");
System.err.println("");
out.println("This is a Multipart Report");
out.println("");
System.err.println("content type:" +p.getContentType());
Object o=p.getContent();
MultipartReport mr = (MultipartReport)p.getContent(); level++;
System.err.println("Report Text");
try{
String t = mr.getText();
if (t ==null)
System.err.println("NULL");
elseif (showStructure)
System.err.println("Size: " + t.length());
else
System.err.println(t);
}catch (MessagingException ex){ System.err.println(ex.toString());
}
System.err.println("Delivery Status");
DeliveryStatus ds = mr.getDeliveryStatus();
if (ds ==null)
System.err.println("NULL");
else
System.err.println(ds.toString());
MimeMessage rm = mr.getReturnedMessage();
if (rm !=null){
if (rminstanceof MessageHeaders){
System.err.println("Returned Message Headers");
System.err.println("");
level++;
System.err.println("before level:" + level);
dumpEnvelope(rm
level--;
}else{
System.err.println("Returned Message");
System.err.println("");
level++;
dumpPart(rm);
level--;
}
}
level--;
human unreadable format..how to i read my header
i set my my mail header when send...
msg.setHeader("Disposition-Notification-To","johnson@mail.vu");
when i received from jsp page....i get this
how do i getHeader() which return String[] to String
Header : [Ljava.lang.String;@baf8c1
out.println("<P>" +"Desc: " + m.getDescription()+"</P>");
out.println("<P>" +"Header: " + m.getHeader("Disposition-Notification-To").toString()+"</P>");
Message was edited by:
yzmewon
[3799 byte] By [
yzmewona] at [2007-11-27 0:13:55]

# 1
I'm not clear on where you're getting the ClassCastException.
But, you have too many of the JavaMail jar files in your CLASSPATH.
If you have mail.jar, you don't need mailapi.jar, pop3.jar, or smtp.jar
since they're all included in mail.jar.
You seem to have some question about getHeader, but I'm not
sure what it is. Yes, getHeader returns an array. If there's more
than one header of that name in the message, there will be more
than one element in the array.
# 4
i have imported the mail.jar and dsn.jar into my project buildpath
i have read the sample...exactly same with the mail.jar activation.jar imported...
yet the sample given by sdn.sap.com doesn't have delivery status features, so no multipartReport is included.
i have download the javamail 1.4 with dsn.jar
i think the JAF 1.1 do the casting of the javax.mail.message
#1.5#0012BF1423AB00520000003C0000115C00042DA6F25FB4AE#1176094961046#System.err#sap.com/AdapterMailEAR#System.err#J2EE_GUEST#2####8b256ab0e65711db82c50012bf1423ab#SAPEngine_Application_Thread[impl:3]_3##0#0#Error##Plain###after connect#
#1.5#0012BF1423AB00520000003D0000115C00042DA6F25FBB64#1176094961046#System.err#sap.com/AdapterMailEAR#System.err#J2EE_GUEST#2####8b256ab0e65711db82c50012bf1423ab#SAPEngine_Application_Thread[impl:3]_3##0#0#Error##Plain###fl:INBOX#
#1.5#0012BF1423AB00520000003E0000115C00042DA6F2601F28#1176094961078#System.err#sap.com/AdapterMailEAR#System.err#J2EE_GUEST#2####8b256ab0e65711db82c50012bf1423ab#SAPEngine_Application_Thread[impl:3]_3##0#0#Error##Plain###after fl.open#
#1.5#0012BF1423AB00520000003F0000115C00042DA6F260201A#1176094961078#System.err#sap.com/AdapterMailEAR#System.err#J2EE_GUEST#2####8b256ab0e65711db82c50012bf1423ab#SAPEngine_Application_Thread[impl:3]_3##0#0#Error##Plain###msgnum:5#
#1.5#0012BF1423AB0052000000400000115C00042DA6F26020A7#1176094961078#System.err#sap.com/AdapterMailEAR#System.err#J2EE_GUEST#2####8b256ab0e65711db82c50012bf1423ab#SAPEngine_Application_Thread[impl:3]_3##0#0#Error##Plain###Getting message number: 5#
#1.5#0012BF1423AB0052000000410000115C00042DA6F260224D#1176094961078#System.err#sap.com/AdapterMailEAR#System.err#J2EE_GUEST#2####8b256ab0e65711db82c50012bf1423ab#SAPEngine_Application_Thread[impl:3]_3##0#0#Error##Plain###In dumpPart#
#1.5#0012BF1423AB0052000000420000115C00042DA6F26022C2#1176094961078#System.err#sap.com/AdapterMailEAR#System.err#J2EE_GUEST#2####8b256ab0e65711db82c50012bf1423ab#SAPEngine_Application_Thread[impl:3]_3##0#0#Error##Plain###In dumpEnvelope#
#1.5#0012BF1423AB0052000000430000115C00042DA6F2648473#1176094961359#System.err#sap.com/AdapterMailEAR#System.err#J2EE_GUEST#2####8b256ab0e65711db82c50012bf1423ab#SAPEngine_Application_Thread[impl:3]_3##0#0#Error##Plain###This is a Multipart Report#
#1.5#0012BF1423AB0052000000440000115C00042DA6F2648507#1176094961359#System.err#sap.com/AdapterMailEAR#System.err#J2EE_GUEST#2####8b256ab0e65711db82c50012bf1423ab#SAPEngine_Application_Thread[impl:3]_3##0#0#Error##Plain####
#1.5#0012BF1423AB0052000000450000115C00042DA6F2648590#1176094961359#System.err#sap.com/AdapterMailEAR#System.err#J2EE_GUEST#2####8b256ab0e65711db82c50012bf1423ab#SAPEngine_Application_Thread[impl:3]_3##0#0#Error##Plain###content type:multipart/report; report-type=delivery-status; boundary="914971789200704091136247174@emg-mrk04.localdns.com"#
#1.5#0012BF1423AB0052000000460000115C00042DA6F26486DE#1176094961359#System.err#sap.com/AdapterMailEAR#System.err#J2EE_GUEST#2####8b256ab0e65711db82c50012bf1423ab#SAPEngine_Application_Thread[impl:3]_3##0#0#Error##Plain###Error: java.lang.ClassCastException#
Message was edited by:
yzmewon