GAE flex Jersey Web Service返回404

时间:2018-01-16 21:12:01

标签: java maven google-app-engine jersey jetty

我尝试将我的Jersey RESTful服务部署到Google AppEngine上。我可以使用标准,但是,我计划使用PostgreSQL数据库,所以我需要使用flex。该应用程序在本地Jetty服务器上工作正常,但我在路由上获得404返回,在日志中有一些例外。

我得到的例外:

  

java.lang.IllegalStateException:没有可用的上下文   com.google.cloud.runtimes.jetty9.DeploymentCheck.lifeCycleStarted(DeploymentCheck.java:46)   在   org.eclipse.jetty.util.component.AbstractLifeCycle.setStarted(AbstractLifeCycle.java:179)   在   org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)   在   org.eclipse.jetty.xml.XmlConfiguration $ 1.run(XmlConfiguration.java:1511)   在   org.eclipse.jetty.xml.XmlConfiguration $ 1.run(XmlConfiguration.java:1438)   在java.security.AccessController.doPrivileged(Native Method)at   org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1437)

     

MultiException [java.lang.RuntimeException:错误扫描条目   jar中的module-info.class   文件:///var/lib/jetty/webapps/root/WEB-INF/lib/javax.json-1.1.jar,   java.lang.RuntimeException:扫描条目module-info.class时出错   从jar   文件:///var/lib/jetty/webapps/root/WEB-INF/lib/yasson-1.0.jar,   java.lang.RuntimeException:扫描条目module-info.class时出错   从jar   文件:///var/lib/jetty/webapps/root/WEB-INF/lib/javax.json-api-1.1.jar,   java.lang.RuntimeException:扫描条目module-info.class时出错   从jar   文件:///var/lib/jetty/webapps/root/WEB-INF/lib/javax.json.bind-api-1.0.jar]   在   org.eclipse.jetty.annotations.AnnotationConfiguration.scanForAnnotations(AnnotationConfiguration.java:451)   在   org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:364)   在   org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:517)   在   org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1458)   在   org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:785)   在   org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:261)   在   org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545)   在   org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)

这是我的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

依赖树

+- 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 个答案:

答案 0 :(得分:0)

可以this成为答案吗?似乎module-info.class来自java 9,你在yaml文件中声明版本8。

在邮件列表中,他们确认它在版本9中有效。 http://mail.openjdk.java.net/pipermail/jigsaw-dev/2017-July/013038.html

你有可能在版本9上本地运行它而不是8吗?