I implemented a hello world in spring boot.
I am using embedded tomcat and here is my setting in the application.properties.
server.contextPath=/test
server.port=8080
I can access it at [localhost:8080/test/index.html]
without problem.
However, after I upload the jar file to the ubuntu 14.04 on digital ocean and start it normally, I am not able to access it at [machine-ipaddress:8080/test/index.html]
. It gives me a 404 error.
I can see the application listening to the port.
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 4284/java
I checked iptable setting and nothing is blocked.
I also tried stop this and run a regular empty tomcat on the remote server and I have no problem accessing [machine-ipaddress:8080]
.
Any ideas are welcomed.
答案 0 :(得分:0)
发现了这个问题。原因是我使用maven webapp原型来创建空项目,将index.html放在webapp下并将其打包为jar 。
奇怪的是我可以使用java -jar test.jar在本地运行它。
将index.html移至resources / static后,它可以在远程服务器上运行。