【发布时间】:2015-08-21 19:54:58
【问题描述】:
我正在为我的 Web 项目使用 Spring MVC。我把模型文件放在WEB-INF目录下
String taggerModelPath = "/WEB-INF/lib/en-pos-maxent.bin";
String chunkerModelPath = "/WEB-INF/lib/en-chunker.bin";
POSModel model = new POSModelLoader()
.load(new File(servletContext.getResource(taggerModelPath).toURI().getPath()));
这个工作的 Windows 环境。但是,当我将它部署在远程 Linux 服务器上时,出现错误
HTTP 状态 500 - 请求处理失败;嵌套异常是 opennlp.tools.cmdline.TerminateToolException:POS Tagger 模型文件不存在!路径:/localhost/nlp/WEB-INF/lib/en-pos-maxent.bin
访问文件资源的最佳方式是什么?谢谢
【问题讨论】:
-
该文件是否存在于您的远程 Linux 服务器上?
-
是的,它在 WEB-INF/lib 文件夹中。
标签: java tomcat servlets opennlp resource-loading