0
votes

I'm trying to deploy my Jersey RESTful service onto Google AppEngine. I can get it working with a standard, however, I plan on using a PostgreSQL database so I'll need to use flex. The app works fine on a local jetty server, but I get a 404 return on the routes and a few exceptions in the logs.

The exceptions I get:

java.lang.IllegalStateException: No Available Context at com.google.cloud.runtimes.jetty9.DeploymentCheck.lifeCycleStarted(DeploymentCheck.java:46) at org.eclipse.jetty.util.component.AbstractLifeCycle.setStarted(AbstractLifeCycle.java:179) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69) at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1511) at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1438) at java.security.AccessController.doPrivileged(Native Method) at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1437)

MultiException[java.lang.RuntimeException: Error scanning entry module-info.class from jar file:///var/lib/jetty/webapps/root/WEB-INF/lib/javax.json-1.1.jar, java.lang.RuntimeException: Error scanning entry module-info.class from jar file:///var/lib/jetty/webapps/root/WEB-INF/lib/yasson-1.0.jar, java.lang.RuntimeException: Error scanning entry module-info.class from jar file:///var/lib/jetty/webapps/root/WEB-INF/lib/javax.json-api-1.1.jar, java.lang.RuntimeException: Error scanning entry module-info.class from jar file:///var/lib/jetty/webapps/root/WEB-INF/lib/javax.json.bind-api-1.0.jar] at org.eclipse.jetty.annotations.AnnotationConfiguration.scanForAnnotations(AnnotationConfiguration.java:451) at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:364) at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:517) at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1458) at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:785) at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:261) at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)

Here is my web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         id="Tapped" version="3.0">
    <servlet>
        <servlet-name>Tapped REST Service</servlet-name>
        <servlet-class>
            org.glassfish.jersey.servlet.ServletContainer
        </servlet-class>
        <init-param>
            <param-name>jersey.config.server.provider.packages</param-name>
            <param-value>com.tappedtechnologies.api</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Tapped REST Service</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
</web-app>

app.yaml

runtime: java
env: flex

handlers:
- url: /.*
  script: this field is required, but ignored
  secure: always

runtime_config:
   jdk: openjdk8
   server: jetty9

dependency tree

+- org.eclipse.jetty:jetty-server:jar:9.2.3.v20140905:compile
 |  +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
 |  +- org.eclipse.jetty:jetty-http:jar:9.2.3.v20140905:compile
 |  |  \- org.eclipse.jetty:jetty-util:jar:9.2.3.v20140905:compile
 |  \- org.eclipse.jetty:jetty-io:jar:9.2.3.v20140905:compile
 +- org.eclipse.jetty:jetty-servlet:jar:9.2.3.v20140905:compile
 |  \- org.eclipse.jetty:jetty-security:jar:9.2.3.v20140905:compile
 +- org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.26:compile
 |  +- org.glassfish.hk2.external:javax.inject:jar:2.5.0-b42:compile
 |  +- org.glassfish.jersey.core:jersey-common:jar:2.26:compile
 |  |  +- javax.annotation:javax.annotation-api:jar:1.2:compile
 |  |  \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile
 |  +- org.glassfish.jersey.core:jersey-server:jar:2.26:compile
 |  |  +- org.glassfish.jersey.core:jersey-client:jar:2.26:compile
 |  |  +- org.glassfish.jersey.media:jersey-media-jaxb:jar:2.26:compile
 |  |  \- javax.validation:validation-api:jar:1.1.0.Final:compile
 |  \- javax.ws.rs:javax.ws.rs-api:jar:2.1:compile
 +- org.glassfish.jersey.inject:jersey-hk2:jar:2.26:compile
 |  \- org.glassfish.hk2:hk2-locator:jar:2.5.0-b42:compile
 |     +- org.glassfish.hk2.external:aopalliance-repackaged:jar:2.5.0-b42:compile
 |     +- org.glassfish.hk2:hk2-api:jar:2.5.0-b42:compile
 |     |  \- javax.inject:javax.inject:jar:1:compile
 |     +- org.glassfish.hk2:hk2-utils:jar:2.5.0-b42:compile
 |     \- org.javassist:javassist:jar:3.22.0-CR2:compile
 +- org.glassfish.jersey.media:jersey-media-json-binding:jar:2.26:compile
 |  +- org.glassfish:javax.json:jar:1.1:compile
 |  +- org.eclipse:yasson:jar:1.0:compile
 |  |  +- javax.json:javax.json-api:jar:1.1:compile
 |  |  \- javax.enterprise:cdi-api:jar:2.0:compile
 |  |     +- javax.el:javax.el-api:jar:3.0.0:compile
 |  |     \- javax.interceptor:javax.interceptor-api:jar:1.2:compile
 |  \- javax.json.bind:javax.json.bind-api:jar:1.0:compile
 +- com.fasterxml.jackson.core:jackson-core:jar:2.9.0.pr4:compile
 +- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
 +- org.slf4j:slf4j-api:jar:1.7.25:compile
 \- org.slf4j:slf4j-log4j12:jar:1.7.25:compile
    \- log4j:log4j:jar:1.2.17:compile
1

1 Answers

0
votes

Could this be the answer? It seems module-info.class is from java 9 and you are declaring version 8 in you yaml file.

In the mailing list they confirm that it works in version 9. http://mail.openjdk.java.net/pipermail/jigsaw-dev/2017-July/013038.html

Chances are you are running it locally on version 9 instead of 8?