Reputation: 131
I have a legacy Google Cloud appengine using Java 8 which I need to migrate to Java 11. As per this guide I plan to "Migrate to Java 11/17 with bundled services", so I have not migrated my appengine-web.xml to app.yaml. Instead I have simply done the following:
<runtime>java11</runtime>
<source>11</source> <target>11</target>
I haven't tried to deploy yet using mvn appengin:deploy
, but I get the following error when trying to run the local server: mvn appengine:run
Localhost:8080 then obviously fails with a 503 Service Unavailable.
Any idea why this is failing to start the dev server in Java 11.
I have added the suggested dependencies to my POM files, but this then give further Java errors:
[exec] [INFO] GCLOUD: SEVERE: javax.servlet.ServletContext log: unavailable
[exec] [INFO] GCLOUD: java.lang.IllegalArgumentException
[exec] [INFO] GCLOUD: at jersey.repackaged.org.objectweb.asm.ClassReader.<init>(ClassReader.java:170)
[exec] [INFO] GCLOUD: at jersey.repackaged.org.objectweb.asm.ClassReader.<init>(ClassReader.java:153)
[exec] [INFO] GCLOUD: at jersey.repackaged.org.objectweb.asm.ClassReader.<init>(ClassReader.java:424)
[exec] [INFO] GCLOUD: at org.glassfish.jersey.server.internal.scanning.AnnotationAcceptingListener.process(AnnotationAcceptingListener.java:170)
and then:
[exec] [INFO] GCLOUD: 2023-05-01 15:09:16.040:WARN:oejw.WebAppContext:main: Failed startup of context c.g.a.t.d.j.DevAppEngineWebAppContext@108531c2{/,file:///C:/Users/revda/OneDrive/Documents/Timtest/CardServer/server/target/cardgamesserver-1.0/,UNAVAILABLE}{C:\Users\revda\OneDrive\Documents\Timtest\CardServer\server\target\cardgamesserver-1.0}
[exec] [INFO] GCLOUD: javax.servlet.ServletException: Card Game Server==org.glassfish.jersey.servlet.ServletContainer@f3e13e41{jsp=null,order=1,inst=true,async=false,src=DESCRIPTOR:file:///C:/Users/revda/OneDrive/Documents/Timtest/CardServer/server/target/cardgamesserver-1.0/WEB-INF/web.xml,STARTED}
[exec] [INFO] GCLOUD: at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:650)
[exec] [INFO] GCLOUD: at org.eclipse.jetty.servlet.ServletHolder.initialize(ServletHolder.java:415)
[exec] [INFO] GCLOUD: at org.eclipse.jetty.servlet.ServletHandler.lambda$initialize$0(ServletHandler.java:731)
[exec] [INFO] GCLOUD: at java.base/java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:357)
Thanks! Tim
pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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">
<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
<version>1.0</version>
<groupId>com.myhouse.cards</groupId>
<artifactId>cardserver</artifactId>
<properties>
<appengine.app.version>1</appengine.app.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<prerequisites>
<maven>3.6.1</maven>
</prerequisites>
<dependencies>
<!-- API, java.xml.bind module -->
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>2.3.2</version>
</dependency>
<!-- Runtime, com.sun.xml.bind module -->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.2</version>
</dependency>
<!-- Compile/runtime dependencies -->
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>1.9.90</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<version>2.17</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-moxy</artifactId>
<version>2.17</version>
</dependency>
<dependency>
<groupId>com.googlecode.objectify</groupId>
<artifactId>objectify</artifactId>
<version>5.1.5</version>
</dependency>
</dependencies>
<build>
<!-- for hot reload of the web application-->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>display-dependency-updates</goal>
<goal>display-plugin-updates</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<version>3.2</version>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>2.0.0</version>
<configuration>
<projectId>cardserver</projectId>
<version>1</version>
<cloudSdkVersion>350.0.0</cloudSdkVersion>
</configuration>
</plugin>
</plugins>
</build>
</project>
Upvotes: 1
Views: 974
Reputation: 75416
The version of objectweb Glassfish uses to manipulate class files is too old to parse the classfiles of the version of Java you want to use.
In other words, your current version of your platform does not support Java 11.
Upvotes: 2