在docker下运行时,胖jar中的嵌入式配置文件无法识别

时间:2018-02-12 15:01:36

标签: docker spring-boot axis

我们有一个暴露轴JAX-RPC服务的spring-boot应用程序(遗留系统需要在新的世界中支持它一段时间)。虽然胖子jar构建在笔记本电脑上作为独立应用程序运行时可以正常工作。如果我将jar嵌入到docker镜像中,我在运行时遇到以下错误:

2018-02-12 14:34:46.011 ERROR [api-jva-pricing-,,,] 7 --- [nio-9510-exec-1] .a.a.c.EngineConfigurationFactoryServlet : Problem with servlet engine /WEB-INF directory
org.apache.axis.ConfigurationException: Configuration file directory '/tmp/tomcat-docbase.682267175490034491.9510/WEB-INF' does not exist or is not a directory or is not readable.
    at org.apache.axis.configuration.FileProvider.<init>(FileProvider.java:99) ~[axis-1.4.jar!/:na]
    at org.apache.axis.configuration.EngineConfigurationFactoryServlet.getServerEngineConfig(EngineConfigurationFactoryServlet.java:174) [axis-1.4.jar!/:na]
    at org.apache.axis.configuration.EngineConfigurationFactoryServlet.getServerEngineConfig(EngineConfigurationFactoryServlet.java:99) [axis-1.4.jar!/:na]
    at org.apache.axis.transport.http.AxisServletBase.getEngineEnvironment(AxisServletBase.java:273) [axis-1.4.jar!/:na]
    at org.apache.axis.transport.http.AxisServletBase.getEngine(AxisServletBase.java:172) [axis-1.4.jar!/:na]
    at org.apache.axis.transport.http.AxisServletBase.getOption(AxisServletBase.java:396) [axis-1.4.jar!/:na]
    at org.apache.axis.transport.http.AxisServletBase.init(AxisServletBase.java:112) [axis-1.4.jar!/:na]
    at org.apache.axis.transport.http.AxisServlet.init(AxisServlet.java:156) [axis-1.4.jar!/:na]
    at javax.servlet.GenericServlet.init(GenericServlet.java:158) [tomcat-embed-core-8.5.11.jar!/:8.5.11]
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1183) [tomcat-embed-core-8.5.11.jar!/:8.5.11]
    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:795) [tomcat-embed-core-8.5.11.jar!/:8.5.11]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:133) [tomcat-embed-core-8.5.11.jar!/:8.5.11]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.11.jar!/:8.5.11]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:474) [tomcat-embed-core-8.5.11.jar!/:8.5.11]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.11.jar!/:8.5.11]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [tomcat-embed-core-8.5.11.jar!/:8.5.11]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.11.jar!/:8.5.11]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349) [tomcat-embed-core-8.5.11.jar!/:8.5.11]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783) [tomcat-embed-core-8.5.11.jar!/:8.5.11]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.11.jar!/:8.5.11]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:798) [tomcat-embed-core-8.5.11.jar!/:8.5.11]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1434) [tomcat-embed-core-8.5.11.jar!/:8.5.11]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.11.jar!/:8.5.11]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_151]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_151]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.11.jar!/:8.5.11]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_151]

文件,轴是sturggling找到位于/WEB-INF/server-config.wsdd位置的胖罐子里。只有在docker容器中运行时才能看到上述问题。有没有人遇到这样的问题?

1 个答案:

答案 0 :(得分:0)

如果有人遇到这个,这里有适合我的解决方案。如上所述,只有当我从docker容器中运行胖罐时才会看到这个问题。我在笔记本电脑上本地运行时没有看到问题,使用与docker容器相同命令的胖罐。解决方案是爆炸jar并使用与目标相关的Spring Boot Launcher类之一启动docker入口点。有关详细信息,请参阅此处 - https://docs.spring.io/spring-boot/docs/current/reference/html/executable-jar.html部分“分解存档”。