Migrating to Framework 2. Using Java 8. What is the below error message trying to tell me? What might be wrong with my class annotations or web.xml? I am using Servlets 3.1.0 for other servlets. Does this enter into the equation?
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>
The problem was caused by my leaving a v1 dependency in my pom.xml file. After removing the below dependency, it started working.