【发布时间】:2020-05-29 07:15:04
【问题描述】:
我在 Wildfly 上部署了一个 JavaEE 应用程序,并且在 Ubuntu 和 Windows 操作系统上都能正常运行。但是,当我尝试对应用程序进行 Docker 化时,它失败了。
这是失败的代码部分:
File templateFile = new File(ESGenerator.class.getClassLoader().getResource("/endpoint-js-template/get-template.js").getFile());
// ...
endpointJSInterface.setTemplate(FileUtils.readFileToString(templateFile));
这是我尝试登录时的文件位置:
// 好的 - Ubuntu /home/czetsuya/java/jboss/wildfly-15.0.1.Final/standalone/deployments/myApp.war/WEB-INF/lib/myApp-admin-ejbs-6.9.0-SNAPSHOT.jar/endpoint-js-template /get-template.js
// 好的 - Windows c:\Java\Jboss\wildfly-15.0.1.Final\standalone\deployments\myApp.war\WEB-INF\lib\myApp-admin-ejbs-6.9.0-SNAPSHOT.jar\endpoint-js-template\get -template.js
// Ko - Docker /content/myApp.war/WEB-INF/lib/myApp-admin-ejbs-6.9.0-SNAPSHOT.jar/endpoint-js-template/get-template.js
“/content”从何而来,解决此问题的最佳方法是什么?
【问题讨论】:
标签: docker wildfly classloader java-ee-6 java-ee-7