title: Spring boot with embedded tomcat runs on a port but its won't work
body: <p>I'm so new in Linux and I'm trying to run my Spring boot application with embedded tomcat on it I tried literally everything on the internet but I can't understand my problem. So this is my code (Maven)</p>
  
  <pre><code>  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;test.my.app&lt;/groupId&gt;
      &lt;artifactId&gt;TestApplication&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
  
  
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;2.1.1.RELEASE&lt;/version&gt;
          &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
          &lt;start-class&gt;com.test.my.Applocation.App&lt;/start-class&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-rest&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.google.code.gson&lt;/groupId&gt;
              &lt;artifactId&gt;gson&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.squareup.retrofit2&lt;/groupId&gt;
              &lt;artifactId&gt;retrofit&lt;/artifactId&gt;
              &lt;version&gt;2.3.0&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.squareup.okhttp3&lt;/groupId&gt;
              &lt;artifactId&gt;logging-interceptor&lt;/artifactId&gt;
              &lt;version&gt;3.12.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.squareup.retrofit2&lt;/groupId&gt;
              &lt;artifactId&gt;converter-gson&lt;/artifactId&gt;
              &lt;version&gt;2.3.0&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;executable&gt;true&lt;/executable&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  
  &lt;/project&gt;
  </code></pre>
  
  <p>and this is my application.properties file.</p>
  
  <pre><code>server.port=0
  </code></pre>
  
  <p>and this is how I build my project to Jar :</p>
  
  <p><strong>mvn -> clean -> compile -> package</strong></p>
  
  <p>and I can run this application on my Windows computer and its working just fine! but my problem is in the Linux server when I run this application with systemed this is the log and it says it was successful but it's not working </p>
  
  <pre><code>INFO 20351 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.hateoas.config.HateoasConfiguration' of type [org.springframework.hateoas.config.HateoasConfiguration$$EnhancerBySpringCGLIB$$b190a49] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
  INFO 20351 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 0 (http)
  INFO 20351 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
  INFO 20351 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/9.0.13
  INFO 20351 --- [           main] o.a.catalina.core.AprLifecycleListener   : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
  INFO 20351 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
  INFO 20351 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2302 ms
  INFO 20351 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
  INFO 20351 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 41940 (http) with context path ''
  INFO 20351 --- [           main] c.t.c.TransApplication.TransApplication  : Started TransApplication in 4.878 seconds (JVM running for 5.402)
  </code></pre>
  
  <p>and this is my </p>
  
  <blockquote>
    <p>netstat -ltnpa | grep -i --colour LISTEN</p>
  </blockquote>
  
  <p>log from <strong>41940</strong> port</p>
  
  <pre><code>tcp6       0      0 :::41940                :::*                    LISTEN      20351/java 
  </code></pre>
  
  <p>but now i want to send a request to this port with <strong>example.com:41940/myrequest</strong> but its not working and server is not respondig </p>
  
  <p>===================
  EDIT
  i edit the <strong>server.port=0 to 8090</strong></p>
  
  <p>and this is the result of </p>
  
  <blockquote>
    <p>curl -XGET localhost:8090</p>
    
    <p>curl -XGET localhost:8090   % Total    % Received % Xferd  Average
    Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed   0     0    0     0    0     0      0      0 --:--:-- --:--:--
    --:--:--     0100    93    0    93    0     0    325      0 --:--:-- --:--:-- --:--:--   326 {   "_links" : {
        "profile" : {
          "href" : "<a href="http://localhost:8090/profile" rel="nofollow noreferrer">http://localhost:8090/profile</a>"
        }   } }</p>
  </blockquote>