0

迁移到框架 2。使用 Java 8。下面的错误消息试图告诉我什么?我的类注释或 web.xml 可能有什么问题?我将 Servlets 3.1.0 用于其他 servlet。这是否进入等式?

com.google.apphosting.runtime.jetty9.JettyLogger warn: 
    Error for /_ah/api/taxdochubapi/v1/taxdoc/retrievewithguid
    (JettyLogger.java:29)

java.lang.NoClassDefFoundError:
    com/google/appengine/repackaged/com/google/common/base/Function
    at com.google.api.server.spi.EndpointsServlet.init(EndpointsServlet.java:56)
    at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:643)
    at org.eclipse.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:499)
    ...

// Relevant annotation
@ApiMethod( name = "taxdocument.retrieve.withguid", 
            path = "taxdoc/retrievewithguid", 
            httpMethod = HttpMethod.GET )
public Map<String, String> retrieveTaxDocForGuid( @Named("guid") String guid ) {

<!-- web.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
    <servlet>
         <servlet-name>EndpointsServlet</servlet-name>
         <servlet-class>com.google.api.server.spi.EndpointsServlet</servlet-class>
         <init-param>
             <param-name>services</param-name>
             <param-value>com.taxdochub.endpoints.spi.TaxDocHubApiDocuments</param-value>
         </init-param>
         <init-param>
             <param-name>restricted</param-name>
             <param-value>false</param-value>
         </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>EndpointsServlet</servlet-name>
        <url-pattern>/_ah/api/*</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
         <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
</web-app>
4

1 回答 1

0

问题是由于我在 pom.xml 文件中留下了 v1 依赖项引起的。删除以下依赖项后,它开始工作。

    <dependency>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-endpoints</artifactId>
        <version>${appengineVersion}</version>
    </dependency>
于 2017-09-15T01:40:31.720 回答