English 中文(简体)
把这个问题放在Mlambda console,但就当地而言,其工程 零件
原标题:Getting this issue in lambda console but locally its works No object dch for mime type multipart/mixed

我正在 j瓦库设立AWS Lambda功能。

我正在使用java邮件和亚马孙特别经济共同体电子邮件。

在通过邮局在当地进行测试时,我增加了所有必要的受扶养人,并完全罚款。 我把所有附件都放在电子邮件上。 但是,当我试图在AWS Lambda console试验时,我会这样做:

mi米型多部分/混合型

我已尝试增加装货舱面,并且:

MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap(); 
mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html"); 
mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml"); 
mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain"); 
mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed"); 
mc.addMailcap("message/rfc822;; x-java-content- handler=com.sun.mail.handlers.message_rfc822"); 

而现在则无uck。 谁知道某种解决办法?

问题回答

I和Lambda的Im相当新鲜,但当Javamail图书馆无法找到特定监测类型的数据ContentHandler时,就会出现错误。 在该案中,在AWS Lambda console实施该守则时发生,而不是在当地通过邮政员进行测试。 这表明,AWS Lambda console的环境组合可能会出现问题。

One solution is to ensure that the necessary libraries are included in the deployment package of the AWS Lambda function. When testing locally, all the required libraries may be present in the classpath, but the same may not be true in the AWS Lambda environment. Make sure that all the required dependencies are included in the deployment package and that the classpath is set up correctly.

另一种解决办法是明确登记“多部分/混合”的“多功能和多功能”等“数据ContentHandler”。 可以通过制定习惯实施 j。 启动。 数据来源 Handler接口,并在Java Beans活动框架内登记。 举例说,执行(未经测试的法典):

import javax.activation.*;
import java.io.*;

public class MyDataContentHandler implements DataContentHandler {
    public MyDataContentHandler() {
    }

    public DataFlavor[] getTransferDataFlavors() {
        return new DataFlavor[] { new DataFlavor("multipart/mixed") };
    }

    public Object getTransferData(DataFlavor flavor, DataSource dataSource)
        throws UnsupportedFlavorException, IOException {
        if (flavor.equals(new DataFlavor("multipart/mixed"))) {
            return dataSource.getInputStream();
        } else {
            throw new UnsupportedFlavorException(flavor);
        }
    }

    public Object getContent(DataSource dataSource) throws IOException {
        return dataSource.getInputStream();
    }

    public void writeTo(Object object, String mimeType, OutputStream outputStream)
        throws IOException {
        throw new UnsupportedEncodingException("writeTo() not supported");
    }
}

然后,在寄送电子邮件之前,将海关数据ContentHandler与JAF登记在Lambda功能守则中:

MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap(); 
mc.addMailcap("multipart/mixed;; x-java-content-handler=com.example.MyDataContentHandler"); 
CommandMap.setDefaultCommandMap(mc);

这应当登记用于“多功能/多功能”的MSContentHandler习俗,并解决问题。

确保检查AWS Lambda环境组合,并将所有必要的附属设施纳入部署一揽子计划,以确保必要的图书馆能够运行。

我一直面临同样的问题。 根据上述解决办法,谁必须解决这一问题? 我正在寻求解决办法。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签