使用CFPOP的Java转换错误

时间:2014-06-01 15:47:09

标签: java coldfusion

我在Windows服务器上运行的CF9应用程序弹出邮件。当我尝试检索整个邮件正文时,我有时会收到以下错误...

Error:
An exception occurred while retrieving mail. 
The cause of this exception was: java.lang.ClassCastException: javax.mail.internet.MimeMessage cannot be cast to javax.mail.internet.MimeBodyPart.

Location:
Line 335 in controllers\Submissions.cfc

不确定这是否相关,但是每条消息都会附加图片,整个过程 通常 正常工作。这个问题是间歇性的。

我的问题

  1. 知道是什么原因造成的吗?
  2. 知道如何捕获并解决此问题吗?
  3. 我怀疑我需要下载到java,但不知道从哪里开始。

    代码片段

    <cfscript>
    // setup variables array for all cfpop calls
    CFPopAttributes = {
        server = request.pop.server,
        port = request.pop.port,
        username = request.pop.username,
        password = request.pop.password,
        timeout = 300
        };
    </cfscript>
    
    
    <cfpop
        action="getall"
        name="entireEmail"
        uid="#uid#"
        attachmentpath="#originalsPath#"
        attributecollection="#CFPopAttributes#" // Line 335
        generateuniquefilenames="true"
        />  
    

    注意:我在上面添加了注释“Line 335”,以准确地传达模板中断的代码。如果我向上或向下移动attributecollection(在其他属性之前/之后),则错误总是在attributecollection行处中断。

    堆栈跟踪

    struct [Filtered - 1 of 8 keys hidden]
    
    Detail: An exception occurred while invoking an event handler method from Application.cfc. The method name is: onRequest.
    Message: Event handler exception.
    RootCause:  
        [struct]
        Detail: The cause of this exception was: java.lang.ClassCastException: javax.mail.internet.MimeMessage cannot be cast to javax.mail.internet.MimeBodyPart.
        Message: An exception occurred while retrieving mail.
        RootCause:  
            [struct]
            Message: javax.mail.internet.MimeMessage cannot be cast to javax.mail.internet.MimeBodyPart
            StackTrace: java.lang.ClassCastException: javax.mail.internet.MimeMessage cannot be cast to javax.mail.internet.MimeBodyPart
                at coldfusion.mail.EmailTable.getAttachmentName(EmailTable.java:819)
                at coldfusion.mail.EmailTable.populate(EmailTable.java:283)
                at coldfusion.mail.PopImpl.getMails(PopImpl.java:241)
                at coldfusion.tagext.net.PopTag$1.run(PopTag.java:433)
                at java.security.AccessController.doPrivileged(Native Method)
                at coldfusion.tagext.net.PopTag.doStartTag(PopTag.java:429)
                at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2799)
                at cfSubmissions2ecfc1952269377$funcGETEMAIL.runFunction(D:\home\wwwroot\controllers\Submissions.cfc:335)
    

0 个答案:

没有答案