title: Springboot app getting stuck at startup in Docker with Java 10
body: <p><strong>Solution</strong> </p>
  
  <p>Error existed between chair and keyboard</p>
  
  <p>The problem was that the SPRING_PROFILES_ACTIVE environment variable was pointing to a profile that didn't exists. Changing it to the correct name fixed the issue. I would have expected Spring to output an error about that, but oh well.</p>
  
  <p><strong>Original question:</strong></p>
  
  <p>I have a "hello world" Java App build running with Spring boot in Java10. It runs fine directly on my machine, but when trying to start it up with docker it gets stuck with the following output:</p>
  
  <pre><code>(The Srping ascii art)
  
   :: Spring Boot ::        (v2.0.1.RELEASE)
  
  WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (jar:file:/app.jar!/BOOT-INF/lib/groovy-2.4.15.jar!/) to method java.lang.Object.finalize()
  WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
  WARNING: All illegal access operations will be denied in a future release
  </code></pre>
  
  <p>The process running:</p>
  
  <pre><code>java -Xmx800m -Djava.security.egd=file:/dev/./urandom -jar /app.jar
  </code></pre>
  
  <p>It runs fine directly on my laptop (Mac OS), and on my coworker's (Windows 7), but it fails in docker both locally and on Kubernetes (AWS)</p>
  
  <p>I have tried configuring spring log level to DEBUG, but with no effect. 
  I also tried to edit <code>$JAVA_HOME/conf/security/java.security</code> to change directly the java securerandom.source property, which  didn't work either.</p>
  
  <p>Edit: 
  The dockerfile is a FROM using this:</p>
  
  <pre><code>FROM openjdk:10-jdk
  
  RUN apt-get update &amp;&amp; \
      apt-get install -y openssl curl
  ADD java.security /docker-java-home/conf/security/java.security
  
  ONBUILD ARG BUILD_VERSION_NO="no-version"
  
  ENV SPRING_PROFILES_ACTIVE=prod
  #ENV JAVA_OPTS="-Xdebug -Xrunjdwp:server=y,transport=dt_socket,suspend=n"
  
  ONBUILD COPY target/*.jar app.jar
  ONBUILD RUN sh -c 'touch /app.jar'
  ONBUILD RUN echo "$BUILD_VERSION_NO" &gt; /version
  
  EXPOSE 8080
  
  ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -jar /app.jar" ]
  </code></pre>
  
  <p>The java version in my laptop is </p>
  
  <pre><code>java version "10.0.1" 2018-04-17
  Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
  Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)
  </code></pre>
  
  <p>Packaging the app with the equivalent openjdk doesn't solve the problem</p>
  
  <pre><code>openjdk version "10.0.1" 2018-04-17
  OpenJDK Runtime Environment (build 10.0.1+10)
  OpenJDK 64-Bit Server VM (build 10.0.1+10, mixed mode) 
  </code></pre>