1

I changed the server.port=8190 in application.properties, but the server is accessible from both ports 8190 and 8080.
How to completely override 8080 port?

Jorj
  • 1,291
  • 1
  • 11
  • 32
  • Where did you define the port ? – A Sdi Dec 06 '16 at 11:46
  • @ASdi If you read the question, it already says that the port is defined in the `application.properties` file. – px06 Dec 06 '16 at 11:47
  • Have you checked that there isn't any other instances of tomcat running? Try stopping spring boot and try to load the app on `8190` does it still work? – px06 Dec 06 '16 at 11:48
  • I mean you may overwrite it somewhere else like program arguments – A Sdi Dec 06 '16 at 11:48
  • @px06 I checked, just one instance of tomcat is running. I stopped everything and started the app with `java -jar app.jar` – Jorj Dec 06 '16 at 11:53
  • Try removing `server.port=...` from your `application.properties` file and start the app using `java -jar app.jar --server.port=8080`, also have a look at [this](http://stackoverflow.com/questions/30312058/spring-boot-how-to-get-the-running-port) to debug and see what port Spring is using. – px06 Dec 06 '16 at 11:58

2 Answers2

1

Its likely that you have an additonal 'zombie' tomcat process still running. Are you sure only one tomcat instance is getting started up by spring boot?

Alternatively try:

java -Dserver.port=8190 -jar app.jar

UserF40
  • 3,533
  • 2
  • 23
  • 34
0

The problem was that I had dependencies for tomcat in build.gradle:

compile("org.apache.tomcat.embed:tomcat-embed-core:8.5.8")
compile("org.apache.tomcat.embed:tomcat-embed-jasper:8.5.8")
compile("org.apache.tomcat.embed:tomcat-embed-logging-juli:8.5.2")

I removed the above lines and now the server is running only on port 8190.

Jorj
  • 1,291
  • 1
  • 11
  • 32