So I've been trying to dockerify my spring-mvc 4 app using the java:8 base image:
I'm having trouble on the following line when running in docker, but outside of docker everything works fine! It has to do with finding the template files for my project:
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/pages/**").addResourceLocations("classpath:/pages/");
}
As a note, I've tried running with the template files inside of a jarfile and outside of a jarfile. The url debugging code has shown that it's finding the right files, but when it tries to use them, I get the following exception:
engine_1 | jvm 1 |java.io.FileNotFoundException: class path resource [pages/saga-index.html] cannot be resolved in the file system for resolving its last-modified timestamp
engine_1 | jvm 1 | at org.springframework.core.io.AbstractResource.lastModified(AbstractResource.java:155)
engine_1 | jvm 1 | at org.springframework.core.io.AbstractFileResolvingResource.lastModified(AbstractFileResolvingResource.java:169)
engine_1 | jvm 1 | at org.springframework.web.servlet.resource.ResourceHttpRequestHandler.handleRequest(ResourceHttpRequestHandler.java:229)
engine_1 | jvm 1 | at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:51)
engine_1 | jvm 1 | at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)
engine_1 | jvm 1 | at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
engine_1 | jvm 1 | at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
engine_1 | jvm 1 | at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)
engine_1 | jvm 1 | at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
engine_1 | jvm 1 | at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
engine_1 | jvm 1 | at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
engine_1 | jvm 1 | at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)
engine_1 | jvm 1 | at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)
engine_1 | jvm 1 | at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
How can i get through this exception? Why am I not able to get a timestamp?
(More stats)
$ docker exec siteconfiguration_engine_1 java -version
openjdk version "1.8.0_40-internal"
OpenJDK Runtime Environment (build 1.8.0_40-internal-b27)
OpenJDK 64-Bit Server VM (build 25.40-b25, mixed mode)
$ docker exec siteconfiguration_engine_1 df -h
Filesystem Size Used Avail Use% Mounted on
none 19G 2.5G 15G 15% /
tmpfs 1004M 0 1004M 0% /dev
shm 64M 0 64M 0% /dev/shm
/dev/sda1 19G 2.5G 15G 15% /etc/hosts
Aucun commentaire:
Enregistrer un commentaire