[JAVA] I was addicted to the NoSuchMethodError in Cloud Endpoints

Overview

When creating Rest API using Cloud Endpoints in GAE / Java environment I was proceeding with the implementation by looking at Google Official Tutorial. At one point, I got a NoSuchMethodError and it stopped working properly.

com.google.apphosting.runtime.jetty9.JettyLogger warn: Error for /_ah/api/echo/v1/echo (JettyLogger.java:29)
java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.ObjectReader.forType(Ljava/lang/Class;)Lcom/fasterxml/jackson/databind/ObjectReader;
	at com.google.api.server.spi.request.ServletRequestParamReader.deserializeParams(ServletRequestParamReader.java:177)
	at com.google.api.server.spi.request.RestServletRequestParamReader.read(RestServletRequestParamReader.java:135)
	at com.google.api.server.spi.SystemService.invokeServiceMethod(SystemService.java:349)
	at com.google.api.server.spi.handlers.EndpointsMethodHandler$RestHandler.handle(EndpointsMethodHandler.java:119)
	at com.google.api.server.spi.handlers.EndpointsMethodHandler$RestHandler.handle(EndpointsMethodHandler.java:102)
	at com.google.api.server.spi.dispatcher.PathDispatcher.dispatch(PathDispatcher.java:50)
	at com.google.api.server.spi.EndpointsServlet.service(EndpointsServlet.java:72)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:848)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1772)
	at com.google.api.control.ControlFilter.doFilter(ControlFilter.java:331)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759)
	at com.google.api.control.ConfigFilter.doFilter(ConfigFilter.java:125)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759)
	at com.google.apphosting.utils.servlet.JdbcMySqlConnectionCleanupFilter.doFilter(JdbcMySqlConnectionCleanupFilter.java:60)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
	at com.google.apphosting.runtime.jetty9.ParseBlobUploadHandler.handle(ParseBlobUploadHandler.java:120)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1182)
	at com.google.apphosting.runtime.jetty9.AppEngineWebAppContext.doHandle(AppEngineWebAppContext.java:171)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at com.google.apphosting.runtime.jetty9.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:297)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
	at org.eclipse.jetty.server.Server.handle(Server.java:539)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:333)
	at com.google.apphosting.runtime.jetty9.RpcConnection.handle(RpcConnection.java:202)
	at com.google.apphosting.runtime.jetty9.RpcConnector.serviceRequest(RpcConnector.java:81)
	at com.google.apphosting.runtime.jetty9.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:123)
	at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.dispatchServletRequest(JavaRuntime.java:692)
	at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.dispatchRequest(JavaRuntime.java:654)
	at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:624)
	at com.google.apphosting.runtime.JavaRuntime$NullSandboxRequestRunnable.run(JavaRuntime.java:818)
	at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:274)
	at java.lang.Thread.run(Thread.java:745)

How to improve

Here's how to improve it in my environment.

The problem was that there were multiple jar files in the library called jackson-core, causing inconsistencies. At the same time as CloudEndpoints, Jacson core was described in the pom.xml file to create a dependency, which seems to have caused an inconsistency.

I removed the jackson-core related library that I added independently because I wanted to use ObjectMapper, and tried deploying it again. It was confirmed that the processing was performed correctly.

Reference material

https://groups.google.com/forum/#!topic/google-cloud-endpoints/Rf7f9GreGGs

Recommended Posts

I was addicted to the NoSuchMethodError in Cloud Endpoints
I was addicted to the roll method
I was addicted to the Spring-Batch test
I was addicted to unit testing with the buffer operator in RxJava
I was addicted to the record of the associated model
I was addicted to starting sbt
What I was addicted to when introducing the JNI library
I was addicted to looping the Update statement on MyBatis
A story I was addicted to in Rails validation settings
I was addicted to the setting of laradock + VSCode + xdebug
What I was addicted to with the Redmine REST API
I was addicted to using Java's Stream API in Scala
The story I was addicted to when setting up STS
The part I was addicted to in "Introduction to Ajax in Java Web Applications" of NetBeans
I was addicted to rewriting to @SpringApplicationConfiguration-> @SpringBootTest
About the matter that I was addicted to how to use hashmap
I was addicted to the API version min23 setting of registerTorchCallback
Memorandum: What I was addicted to when I hit the accounting freee API
[Rails] I was addicted to the nginx settings when using Action Cable.
A story I was addicted to when testing the API using MockMVC
Problems I was addicted to when building the digdag environment with docker
Recorded because I was addicted to the standard input of the Scanner class
I was addicted to scrollview because I couldn't tap the variable size UIView
[CircleCI] I was addicted to the automatic test of CircleCI (rails + mysql) [Memo]
I was addicted to using RXTX on Sierra
I tried to organize the session in Rails
I was addicted to installing Ruby/Tk on MacOS
I was addicted to doing onActivityResult () with DialogFragment
I want to get the value in Ruby
I was addicted to not being able to connect to AWS-S3 from the Docker container
I was a little addicted to the S3 Checksum comparison, so I made a note.
SpringSecurity I was addicted to trying to log in with a hashed password (solved)
I tried to organize the cases used in programming
I want to embed any TraceId in the log
Tokoro I rewrote in the migration from Wicket 7 to 8
If you want to recreate the instance in cloud9
I tried to implement the Euclidean algorithm in Java
A memorandum because I was addicted to the setting of the Android project of IntelliJ IDEA
What I fixed when updating to Spring Boot 1.5.12 ・ What I was addicted to
I want to set the conditions to be displayed in collection_check_boxes
What I was addicted to while using rspec on rails
I was addicted to setting default_url_options with Rails devise introduction
What I did in the version upgrade from Ruby 2.5.2 to 2.7.1
I was confused because there was a split in the Array
Contributed to Gradle and was named in the release notes
I want to transition to the same screen in the saved state
I want to simplify the conditional if-else statement in Java
I tried to develop the cache function of Application Container Cloud Service in the local environment
[Circle CI] A story I was addicted to at Start Building
I tried to summarize the words that I often see in docker-compose.yml
Technical causes and countermeasures for the points I was addicted to with the first Android app & Kotlin
Pass the i18n locale to JavaScript
I tried to summarize what was asked at the site-java edition-
I tried to illuminate the Christmas tree in a life game
I tried to sort the data in descending order, ascending order / Rails
What I was addicted to when updating the PHP version of the development environment (Docker) from 7.2.11 to 7.4.x
A note when I was addicted to converting Ubuntu on WSL1 to WSL2
I tried to explain the method
What I did in the migration from Spring Boot 1.4 series to 2.0 series
What to do if Cloud9 is full in the Rails tutorial
The story I wanted to unzip