Problem when deploy Spring boot application to GAE flex

174 views
Skip to first unread message

Ky Nguyen

unread,
Oct 5, 2018, 10:29:35 AM10/5/18
to Google App Engine
Hi everyone,

I have a spring boot application and want to deploy only in GAE flex env.
I had tried many time but currently I got error 404 when access my application in GAE.

Error 404 - Not Found.

No context on this server matched or handled this request.
Contexts known to this server are:
  • / ---> o.e.j.w.WebAppContext@47ef968d{root,/,file:///var/lib/jetty/webapps/root/,UNAVAILABLE}{/root.war} [failed]


I had run successfully on my local with jetty embedded server, but don't know why this error is occurred.

my pom.xml is
<parent>
   
<groupId>org.springframework.boot</groupId>
   
<artifactId>spring-boot-starter-parent</artifactId>
   
<version>1.5.6.RELEASE</version>
   
<relativePath /> <!-- lookup parent from repository -->
</parent>

<properties>
   
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
   
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
   
<java.version>1.8</java.version>
   
<maven.compiler.source>${java.version}</maven.compiler.source> <!-- REQUIRED -->
   <maven.compiler.target>${java.version}</maven.compiler.target> <!-- REQUIRED -->
</properties>


<dependencies>
   
<dependency>
     
<groupId>org.springframework.boot</groupId>
     
<artifactId>spring-boot-starter-data-jpa</artifactId>
     
<exclusions>
         
<exclusion>
           
<groupId>org.springframework.boot</groupId>
           
<artifactId>tomcat-juli</artifactId>
         
</exclusion>
     
</exclusions>
   
</dependency>
   
<dependency>
     
<groupId>org.springframework.boot</groupId>
     
<artifactId>spring-boot-starter-web</artifactId>
     
<exclusions>
         
<exclusion>
           
<groupId>org.springframework.boot</groupId>
           
<artifactId>spring-boot-starter-tomcat</artifactId>
         
</exclusion>
     
</exclusions>
   
</dependency>

   
<dependency>
     
<groupId>org.springframework.boot</groupId>
     
<artifactId>spring-boot-starter-jetty</artifactId>
     
<scope>provided</scope>
   
</dependency>

   
<dependency>
     
<groupId>org.springframework.boot</groupId>
     
<artifactId>spring-boot-starter-test</artifactId>
     
<scope>test</scope>
   
</dependency>

       
<dependency>
           
<groupId>org.springframework.boot</groupId>
           
<artifactId>spring-boot-starter-security</artifactId>
       
</dependency>

   
<dependency>
     
<groupId>com.zaxxer</groupId>
     
<artifactId>HikariCP</artifactId>
     
<scope>compile</scope>
   
</dependency>

   
<dependency>
     
<groupId>org.apache.tomcat.embed</groupId>
     
<artifactId>tomcat-embed-jasper</artifactId>
     
<scope>provided</scope>
   
</dependency>

   
<dependency>
     
<groupId>javax.servlet</groupId>
     
<artifactId>javax.servlet-api</artifactId>
     
<version>3.1.0</version>
     
<scope>provided</scope>
   
</dependency>

   
<dependency>
     
<groupId>javax.servlet</groupId>
     
<artifactId>jstl</artifactId>
     
<version>1.2</version>
   
</dependency>

   
<dependency>
     
<groupId>postgresql</groupId>
     
<artifactId>postgresql</artifactId>
     
<version>9.1-901.jdbc4</version>
   
</dependency>

</dependencies>

<build>
   
<plugins>
     
<plugin>
         
<groupId>org.springframework.boot</groupId>
         
<artifactId>spring-boot-maven-plugin</artifactId>
         
<executions>
           
<execution>
               
<goals>
                 
<goal>repackage</goal>
               
</goals>
               
<configuration>
                 
<mainClass>com.kevin.SpringJqgridApplication</mainClass>
               
</configuration>
           
</execution>
         
</executions>
     
</plugin>
     
<plugin>
         
<groupId>org.eclipse.jetty</groupId>
         
<artifactId>jetty-maven-plugin</artifactId>
         
<version>9.4.6.v20170531</version>
     
</plugin>
     
<!-- START plugin -->
      <plugin>
         
<groupId>com.google.cloud.tools</groupId>
         
<artifactId>appengine-maven-plugin</artifactId>
         
<version>1.3.1</version>
     
</plugin>
     
<!-- END plugin -->
   </plugins>
</build>

I'm using this command below to deploy my application.
mvn appengine:deploy

Can anybody help me ?
thanks.

Amit (Google Cloud Support)

unread,
Oct 5, 2018, 5:35:44 PM10/5/18
to Google App Engine

Hi Nguyen


I went through some cases related to this error and I found most of the cases indicates this is related to jetty runtime. It looks like somehow your jetty plugin is compromised. As of now current jetty-maven-plugin version is [9.4.12.v20180830]. Also if you see this [1] sample in gitHub which used flex environment to deploy spring boot in Google Cloud Platform. At the end it mentioned flex requires the new appengine-maven-plugin. Also this [2] official documentation put a note as “If there is a newer version of the App Engine Maven plugin, you should upgrade to the latest version.”  I would recommend to check if you are using the correct version. It seems like current version is [1.3.2] and from your configuration it seems like you are using [1.3.1]. I am not sure if this could be an issue, but I would recommend to update both and try again.


[0] https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-maven-plugin

[1] https://github.com/GoogleCloudPlatform/getting-started-java/tree/master/helloworld-springboot

[2] https://cloud.google.com/appengine/docs/flexible/java/using-maven#running_and_testing_your_app


Danial Farid

unread,
Dec 10, 2018, 11:01:50 PM12/10/18
to Google App Engine
Change your packaging from `war` to `jar`. That was my issue with the same error.

Danial Farid

unread,
Dec 10, 2018, 11:01:51 PM12/10/18
to Google App Engine
My issue was packaging being `war` instead of `jar` which was giving me the same error.


On Friday, October 5, 2018 at 7:29:35 AM UTC-7, Ky Nguyen wrote:
Reply all
Reply to author
Forward
0 new messages