简体   繁体   English

上传Lambda函数时找不到BeanIO映射文件

[英]Unable to find BeanIO mapping file when uploading Lambda function

I have a java program that writes to a file using beanIO. 我有一个使用beanIO写入文件的Java程序。 The program runs fine on my local environment and acts as expected. 该程序可以在我的本地环境上正常运行,并按预期运行。 I first wrote this program on my local environment, and then have been uploading it as an AWS Lambda function, so it was not initially created as an AWS Lambda function. 我首先在本地环境上编写了该程序,然后将其作为AWS Lambda函数上载,因此最初并未将其创建为AWS Lambda函数。

I use an Eclipse plugin to upload my code as an AWS Lambda function and test it using console.aws.amazon.com online. 我使用Eclipse插件将我的代码作为AWS Lambda函数上传并在线使用console.aws.amazon.com对其进行测试。 When I test it, I get an exception returned back: 当我测试它时,我得到一个异常返回:

org.beanio.BeanIOConfigurationException: BeanIO mapping file 'foo.xml' not 
found on classpath\n\tat 

The line that the error occurs on is this: 发生错误的行是这样的:

StreamFactory sf = StreamFactory.newInstance();
sf.loadResource("foo.xml"); // right here

I have tried putting foo.xml in the same package as the new 我尝试将foo.xml与新

I'm new to beanIO and AWS Lambda. 我是beanIO和AWS Lambda的新手。 Do I need to configure the location of foo.xml differently to have it be referenced properly when uploading to Lambda? 我是否需要以其他方式配置foo.xml的位置,以便在上载到Lambda时正确引用它? Since it works fine on my local environment, I am confused as to what else to do. 由于它可以在我的本地环境下正常工作,因此我对其他操作感到困惑。

Ended up fixing the issue by removing the source folder of foo.xml and adding it as a source again. 最终通过删除foo.xml的源文件夹并将其再次添加为源来解决了该问题。 I'm not sure why it messed up in the first place. 我不确定为什么一开始就搞砸了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM