NoSuchMethodError:将Firebase与应用引擎应用整合在一起 [英] NoSuchMethodError: While integrating Firebase with app engine app

查看:220
本文介绍了NoSuchMethodError:将Firebase与应用引擎应用整合在一起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将Firebase实时数据库与谷歌应用程序引擎应用程序集成在一起。当调用

 >时, DatabaseReference ref = FirebaseDatabase 
> .getInstance()
> .getReference( todoItems);

Stacktrace


/ productSync java.lang.NoSuchMethodError的错误:
com.google.common.base.Preconditions.checkState(ZLjava / lang / String; Ljava / lang / Object;)V

com.google.firebase.FirebaseApp.checkNotDeleted(FirebaseApp.java:314)
at com.google.firebase.FirebaseApp.getOptions(FirebaseApp.java:260)
at
com.google.firebase.database.FirebaseDatabase.getInstance(FirebaseDatabase.java:80)
at in.prago.servlet.ProductDataSync.doGet(ProductDataSync.java:83)
at javax.servlet .http.HttpServlet.service(HttpServlet.java:617)at
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)at
org.mortbay.jetty.servlet.ServletHolder.handle (ServletHolder.java:511)
at
org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1166)
at
com.google.apphosting .utils.servlet.ParseBlobUploadF
at
org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)
at
com。 google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:37)
at
org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)

com.google.apphosting.utils.servlet.JdbcMySqlConnectionCleanupFilter.doFilter(JdbcMySqlConnectionCleanupFilter.java:60)
at
org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler .java:1157)
at
com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:48)
at
org.mortbay.jetty.servlet .ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
at
org .mortbay.jetty.security.SecurityHandler。处理(SecurityHandler.java:216)
at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at
org.mortbay.jetty。 handler.ContextHandler.handle(ContextHandler.java:765)
at
org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at
com。 google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:257)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at
org.mortbay。 jetty.HttpConnection $ RequestHandler.headerComplete(HttpConnection.java:923)
at
com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:76)
at org。 mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at
com.google.apphosting.run time.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:145)
at
com.google.apphosting.runtime.JavaRuntime $ RequestRunnable.dispatchServletRequest(JavaRuntime.java:644)
at
com.google.apphosting.runtime.JavaRuntime $ RequestRunnable.dispatchRequest(JavaRuntime.java:604)
at
com.google.apphosting.runtime.JavaRuntime $ RequestRunnable.run(JavaRuntime.java:574 )
at
com.google.tracing.TraceContext $ TraceContextRunnable.runInContext(TraceContext.java:453)
at
com.google.tracing.TraceContext $ TraceContextRunnable $ 1.run( TraceContext.java:460)
at
com.google.tracing.CurrentContext.runInContext(CurrentContext.java:293)
at
com.google.tracing.TraceContext $ AbstractTraceContextCallback。 runInInheritedContextNoUnref(TraceContext.java:319)
at
com.google.tracing.TraceContext $ AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:311)
at
com.google.tracing.TraceContext $ TraceContextRunnable.run(TraceContext.java:457)
at
com.google.apphosting.runtime.ThreadGroupPool $ PoolEntry.run(ThreadGroupPool.java:238)
at java.lang.Thread.run(Thread.java:745)

这个问题已经在很多论坛讨论过人们建议将番石榴19.0升级到番石榴20.0。在我的情况下,我没有使用任何这样的图书馆,因此我试图添加两个,但它没有为我工作。每次都有同样的错误。我也添加我的pom.xml文件,以防万一有人需要看看它。任何帮助,将不胜感激。

这里是一个这样的论坛的链接 https://github.com/google/guava/issues/2380

 <?xml version = 1.0encoding =UTF-8?> 
< project xmlns =http://maven.apache.org/POM/4.0.0xmlns:xsi =http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation =http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">

< modelVersion> 4.0.0< / modelVersion>
<包装>战争< / packaging>
< version> 1.0< / version>


<属性>
< appengine.app.version> 1< /appengine.app.version>
< appengine.target.version> 1.9.53< /appengine.target.version>
< project.build.sourceEncoding> UTF-8< /project.build.sourceEncoding>
< / properties>

< dependencies>

< dependency>
< groupId> com.google.firebase< / groupId>
< artifactId> firebase-admin< / artifactId>
< version> 5.0.0< / version>
< /依赖>

< dependency>
< groupId> com.google.guava< / groupId>
< artifactId>番石榴< / artifactId>
< version> 20.0< / version>
< /依赖>

<! - 编译/运行时依赖关系 - >
<依赖>
< groupId> com.google.endpoints< / groupId>
< artifactId>端点 - 框架< / artifactId>
< version> 2.0.7< / version>
< / dependency>
<依赖>
< groupId> com.google.appengine< / groupId>
< artifactId> appengine-api-1.0-sdk< / artifactId>
< version> $ {appengine.target.version}< / version>
< /依赖>
<依赖>
< groupId> com.google.appengine< / groupId>
< artifactId> appengine-endpoints< / artifactId>
< version> $ {appengine.target.version}< / version>
< /依赖>
<依赖>
< groupId> javax.servlet< / groupId>
< artifactId> servlet-api< / artifactId>
< version> 2.5< / version>
< scope>提供< / scope>
< / dependency>
<依赖>
< groupId> javax.inject< / groupId>
< artifactId> javax.inject< / artifactId>
< version> 1< / version>
< / dependency>
<依赖>
< groupId> com.googlecode.objectify< / groupId>
< artifactId> objectify< / artifactId>
< version> 5.0< / version>
< /依赖>

< dependency>
< groupId> com.google.endpoints< / groupId>
< artifactId> endpoints-management-control-appengine< / artifactId>
< version> 1.0.0-beta.11< / version>
< /依赖>
<依赖>
< groupId> com.google.endpoints< / groupId>
< artifactId> endpoints-framework-auth< / artifactId>
< version> 1.0.0-beta.11< / version>
< /依赖>



<! - Test Dependencies - >
<依赖>
< groupId> com.google.appengine< / groupId>
< artifactId> appengine-testing< / artifactId>
< version> $ {appengine.target.version}< / version>
< scope> test< / scope>
< / dependency>
<依赖>
< groupId> com.google.appengine< / groupId>
< artifactId> appengine-api-stubs< / artifactId>
< version> $ {appengine.target.version}< / version>
< scope> test< / scope>
< /依赖>
<依赖>
< groupId> junit< / groupId>
< artifactId> junit< / artifactId>
< version> 4.11< / version>
< /依赖>



< /依赖关系>

< build>
< outputDirectory> target / $ {project.artifactId} - $ {project.version} / WEB-INF / classes< / outputDirectory>
< plugins>
< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< version> 2.5.1< / version>
< artifactId> maven-compiler-plugin< / artifactId>
<配置>
< source> 1.7< / source>
< target> 1.7< / target>
< / configuration>
< / plugin>
< plugin>
< groupId> com.google.cloud.tools< / groupId>
< artifactId>端点 - 框架 - maven-plugin< / artifactId>
< version> 1.0.0-beta5< / version>
<配置>
<! - 插件配置 - >
< / configuration>
< / plugin>
< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-war-plugin< / artifactId>
< version> 2.3< / version>
<配置>
< webXml> $ {project.build.directory} /generated-sources/appengine-endpoints/WEB-INF/web.xml</webXml>
< webResources>
< resource>
<! - 这是相对于pom.xml目录 - >
<目录> $ {project.build.directory} / generated-sources / appengine-endpoints< / directory>
<! - 该列表具有默认值** - >
<包括>
< include> WEB-INF / *。discovery< / include>
< include> WEB-INF / *。api< / include>
< / includes>
< / resource>
< / webResources>
< / configuration>
< / plugin>
< plugin>
< groupId> com.google.appengine< / groupId>
< artifactId> appengine-maven-plugin< / artifactId>
< version> $ {appengine.target.version}< / version>
<配置>
< enableJarClasses> false< / enableJarClasses>
< / configuration>
< executions>
<执行>
<目标>
< goal> endpoints_get_discovery_doc< / goal>
< /目标>
< /执行>
< /执行次数>
< / plugin>
< / plugins>
< pluginManagement>
< plugins>
<! - 此插件的配置仅用于存储Eclipse m2e设置。它对Maven构建本身没有影响。
< plugin>
< groupId> org.eclipse.m2e< / groupId>
< artifactId>生命周期映射< / artifactId>
< version> 1.0.0< / version>
<配置>
< lifecycleMappingMetadata>
< pluginExecutions>
< pluginExecution>
< pluginExecutionFilter>
< groupId>
com.google.appengine
< / groupId>
< artifactId>
appengine-maven-plugin
< / artifactId>
< versionRange>
[1.9.3,]
< / versionRange>
<目标>
< goal>
endpoints_get_discovery_doc
< / goal>
< /目标>
< / pluginExecutionFilter>
< ignore>< / ignore>
< / action>
< / pluginExecution>
< / pluginExecutions>
< / lifecycleMappingMetadata>
< / configuration>
< / plugin>
< / plugins>
< / pluginManagement>
< / build>
< groupId> in.prago< / groupId>
< artifactId> prago< / artifactId>
< / project>

更新:

正如Auberon所建议的那样,我用新版本的Objectify 5.1.17更新了我的pom.xml文件,并删除了番石榴的依赖关系。我试着运行代码,但同样的错误再次出现。这里是我的堆栈跟踪

 > com.google.api.server.spi.SystemService invokeServiceMethod:exception 
>调用后端方法时发生(SystemService.java:398)
>
> java.lang.NoSuchMethodError:
> com.google.common.base.Preconditions.checkState(ZLjava / lang / String; Ljava / lang / Object;)V
>在
> com.google.firebase.FirebaseApp.checkNotDeleted(FirebaseApp.java:314)
>在com.google.firebase.FirebaseApp.getOptions(FirebaseApp.java:260)
>在
> com.google.firebase.database.FirebaseDatabase.getInstance(FirebaseDatabase.java:80)
>在
> in.prago.spi.PragoMerchantApi.saveProfile(PragoMerchantApi.java:189)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>在
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>在
>的java.lang.reflect.Method.invoke(Method.java:42) com.google.api.server.spi.SystemService.invokeServiceMethod(SystemService.java:363)
>在
> com.google.api.server.spi.SystemServiceServlet.execute(SystemServiceServlet.java:113)
>在
> com.google.api.server.spi.SystemServiceServlet.doPost(SystemServiceServlet.java:71)
>在javax.servlet.http.HttpServlet.service(HttpServlet.java:637)at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:717)at
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
>在
> org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1166)
>在
> com.googlecode.objectify.ObjectifyFilter.doFilter(ObjectifyFilter.java:48)
>在
> org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)
>在
> org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)
>在
> org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)
>在
> org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)
>在
> org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1157)
>在
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
>在
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>在
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
>在
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
>在
> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
>在
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> at org.mortbay.jetty.Server.handle(Server.java:326)at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
>在
> org.mortbay.jetty.HttpConnection $ RequestHandler.headerComplete(HttpConnection.java:923)
> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>在
> com.google.tracing.TraceContext $ TraceContextRunnable.runInContext(TraceContext.java:453)
>在
> com.google.tracing.TraceContext $ TraceContextRunnable $ 1.run(TraceContext.java:460)
>在
> com.google.tracing.CurrentContext.runInContext(CurrentContext.java:293)
>在
> com.google.tracing.TraceContext $ AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:319)
>在
> com.google.tracing.TraceContext $ AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:311)
>在
> com.google.tracing.TraceContext $ TraceContextRunnable.run(TraceContext.java:457)
>在java.lang.Thread.run(Thread.java:745)


http: //maven.apache.org/xsd/maven-4.0.0.xsd>

 < modelVersion> 4.0.0< ; / modelVersion> 
< packaging> war< / packaging>
< version> 1.0< / version>


< properties>
< appengine.app.version> 1< /appengine.app.version>
< appengine.target.version> 1.9.53< /appengine.target.version>
< project.build .sourceEncoding> UTF-8< /project.build.sourceEncoding>
< / properties>

<依赖项>

<依赖项>
< groupId> com.google.firebase< / groupId>
< artifactId> firebase-admin< / artifactId>
< version> 5.0.0< / version>
< /依赖项>

<依赖项>

< groupId> com.google.endpoints< / groupId>
< artifactId&g吨;端点的框架< / artifactId的>
< version> 2.0.7< / version>
< /依赖>
<依赖>
< groupId> com.google.appengine< / groupId>
< artifactId> appengine-api-1.0-sdk< / artifactId>
< version> $ {appengine.target.version}< / version>
< /依赖>
<依赖>
< groupId> com.google.appengine< / groupId>
< artifactId> appengine-endpoints< / artifactId>
< version> $ {appengine.target.version}< / version>
< /依赖>
<依赖>
< groupId> javax.servlet< / groupId>
< artifactId> servlet-api< / artifactId>
< version> 2.5< / version>
< scope>提供< / scope>
< /依赖>
<依赖>
< groupId> javax.inject< / groupId>
< artifactId> javax.inject< / artifactId>
< version> 1< / version>
< /依赖>
<依赖>
< groupId> com.googlecode.objectify< / groupId>
< artifactId> objectify< / artifactId>
< version> 5.1.17< / version>
< /依赖>

< dependency>
< groupId> com.google.endpoints< / groupId>
< artifactId> endpoints-management-control-appengine< / artifactId>
< version> 1.0.0-beta.11< / version>
< /依赖>
<依赖>
< groupId> com.google.endpoints< / groupId>
< artifactId> endpoints-framework-auth< / artifactId>
< version> 1.0.0-beta.11< / version>
< / dependency>



<! - Test Dependencies - >
<依赖>
< groupId> com.google.appengine< / groupId>
< artifactId> appengine-testing< / artifactId>
< version> $ {appengine.target.version}< / version>
< scope> test< / scope>
< /依赖>
<依赖>
< groupId> com.google.appengine< / groupId>
< artifactId> appengine-api-stubs< / artifactId>
< version> $ {appengine.target.version}< / version>
< scope> test< / scope>
< /依赖>
<依赖>
< groupId> junit< / groupId>
< artifactId> junit< / artifactId>
< version> 4.11< / version>
< /依赖>



< /依赖关系>

< build>
< outputDirectory> target / $ {project.artifactId} - $ {project.version} / WEB-INF / classes< / outputDirectory>
< plugins>
< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< version> 2.5.1< / version>
< artifactId> maven-compiler-plugin< / artifactId>
<配置>
< source> 1.7< / source>
< target> 1.7< / target>
< / configuration>
< / plugin>
< plugin>
< groupId> com.google.cloud.tools< / groupId>
< artifactId>端点 - 框架 - maven-plugin< / artifactId>
< version> 1.0.0-beta5< / version>
<配置>
<! - 插件配置 - >
< / configuration>
< / plugin>
< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-war-plugin< / artifactId>
< version> 2.3< / version>
<配置>
< webXml> $ {project.build.directory} /generated-sources/appengine-endpoints/WEB-INF/web.xml</webXml>
< webResources>
< resource>
<! - 这是相对于pom.xml目录 - >
<目录> $ {project.build.directory} / generated-sources / appengine-endpoints< / directory>
<! - 该列表具有默认值** - >
<包括>
< include> WEB-INF / *。discovery< / include>
< include> WEB-INF / *。api< / include>
< / includes>
< / resource>
< / webResources>
< / configuration>
< / plugin>
< plugin>
< groupId> com.google.appengine< / groupId>
< artifactId> appengine-maven-plugin< / artifactId>
< version> $ {appengine.target.version}< / version>
<配置>
< enableJarClasses> false< / enableJarClasses>
< / configuration>
< executions>
<执行>
<目标>
< goal> endpoints_get_discovery_doc< / goal>
< /目标>
< /执行>
< /执行次数>
< / plugin>
< / plugins>
< pluginManagement>
< plugins>
<! - 此插件的配置仅用于存储Eclipse m2e设置。它对Maven构建本身没有影响。
< plugin>
< groupId> org.eclipse.m2e< / groupId>
< artifactId>生命周期映射< / artifactId>
< version> 1.0.0< / version>
<配置>
< lifecycleMappingMetadata>
< pluginExecutions>
< pluginExecution>
< pluginExecutionFilter>
< groupId>
com.google.appengine
< / groupId>
< artifactId>
appengine-maven-plugin
< / artifactId>
< versionRange>
[1.9.3,]
< / versionRange>
<目标>
< goal>
endpoints_get_discovery_doc
< / goal>
< /目标>
< / pluginExecutionFilter>
< ignore>< / ignore>
< / action>
< / pluginExecution>
< / pluginExecutions>
< / lifecycleMappingMetadata>
< / configuration>
< / plugin>
< / plugins>
< / pluginManagement>
< / build>
< groupId> in.prago< / groupId>
< artifactId> prago< / artifactId>
< / project>


解决方案

包含项目Guava新版本依赖。 >

 <依赖项> 
< groupId> com.google.guava< / groupId>
< artifactId>番石榴< / artifactId>
< version> 22.0< / version>
< /依赖>


I was trying to integrate firebase real time database with google app engine app. I was getting this error when calling

> DatabaseReference ref = FirebaseDatabase
>                   .getInstance()
>                   .getReference("todoItems");

Stacktrace is

03:21:01.450 Error for /productSync java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;)V at com.google.firebase.FirebaseApp.checkNotDeleted(FirebaseApp.java:314) at com.google.firebase.FirebaseApp.getOptions(FirebaseApp.java:260) at com.google.firebase.database.FirebaseDatabase.getInstance(FirebaseDatabase.java:80) at in.prago.servlet.ProductDataSync.doGet(ProductDataSync.java:83) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166) at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:125) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:37) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.apphosting.utils.servlet.JdbcMySqlConnectionCleanupFilter.doFilter(JdbcMySqlConnectionCleanupFilter.java:60) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:48) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:257) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923) at com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:76) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:145) at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.dispatchServletRequest(JavaRuntime.java:644) at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.dispatchRequest(JavaRuntime.java:604) at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:574) at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:453) at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:460) at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:293) at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:319) at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:311) at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:457) at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:238) at java.lang.Thread.run(Thread.java:745)

This same problem has been discussed in many forums where people suggested to upgrade Guava 19.0 to Guava 20.0. In my case I was not using any such library, therefore I tried adding both, but it didn't worked out for me. Same error was there every time. I am also adding my pom.xml file just in case someone needs to have a look at it. Any help would be appreciated.

Here is a link to one such forum https://github.com/google/guava/issues/2380

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <packaging>war</packaging>
    <version>1.0</version>


    <properties>
        <appengine.app.version>1</appengine.app.version>
        <appengine.target.version>1.9.53</appengine.target.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>

     <dependency>
  <groupId>com.google.firebase</groupId>
  <artifactId>firebase-admin</artifactId>
  <version>5.0.0</version>
</dependency>

<dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>20.0</version>
    </dependency>

        <!-- Compile/runtime dependencies -->
        <dependency>
    <groupId>com.google.endpoints</groupId>
    <artifactId>endpoints-framework</artifactId>
    <version>2.0.7</version>
</dependency>
        <dependency>
            <groupId>com.google.appengine</groupId>
            <artifactId>appengine-api-1.0-sdk</artifactId>
            <version>${appengine.target.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.appengine</groupId>
            <artifactId>appengine-endpoints</artifactId>
            <version>${appengine.target.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
        </dependency>
        <dependency>
            <groupId>com.googlecode.objectify</groupId>
            <artifactId>objectify</artifactId>
            <version>5.0</version>
        </dependency>

        <dependency>
    <groupId>com.google.endpoints</groupId>
    <artifactId>endpoints-management-control-appengine</artifactId>
    <version>1.0.0-beta.11</version>
</dependency>
<dependency>
    <groupId>com.google.endpoints</groupId>
    <artifactId>endpoints-framework-auth</artifactId>
    <version>1.0.0-beta.11</version>
</dependency>



        <!-- Test Dependencies -->
        <dependency>
            <groupId>com.google.appengine</groupId>
            <artifactId>appengine-testing</artifactId>
            <version>${appengine.target.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.appengine</groupId>
            <artifactId>appengine-api-stubs</artifactId>
            <version>${appengine.target.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
        </dependency>



    </dependencies>

    <build>
        <outputDirectory>target/${project.artifactId}-${project.version}/WEB-INF/classes</outputDirectory>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <version>2.5.1</version>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
    <groupId>com.google.cloud.tools</groupId>
    <artifactId>endpoints-framework-maven-plugin</artifactId>
    <version>1.0.0-beta5</version>
    <configuration>
        <!-- plugin configuration -->
    </configuration>
</plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <webXml>${project.build.directory}/generated-sources/appengine-endpoints/WEB-INF/web.xml</webXml>
                    <webResources>
                        <resource>
                            <!-- this is relative to the pom.xml directory -->
                            <directory>${project.build.directory}/generated-sources/appengine-endpoints</directory>
                            <!-- the list has a default value of ** -->
                            <includes>
                                <include>WEB-INF/*.discovery</include>
                                <include>WEB-INF/*.api</include>
                            </includes>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.google.appengine</groupId>
                <artifactId>appengine-maven-plugin</artifactId>
                <version>${appengine.target.version}</version>
                <configuration>
                    <enableJarClasses>false</enableJarClasses>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>endpoints_get_discovery_doc</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>
                                            com.google.appengine
                                        </groupId>
                                        <artifactId>
                                            appengine-maven-plugin
                                        </artifactId>
                                        <versionRange>
                                            [1.9.3,)
                                        </versionRange>
                                        <goals>
                                            <goal>
                                                endpoints_get_discovery_doc
                                            </goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    <groupId>in.prago</groupId>
    <artifactId>prago</artifactId>
</project>

Update :

As suggested by Auberon I updated my pom.xml with new version of Objectify 5.1.17 and removed the guava depedency. I tried running the code but the same error coined up again. Here is my stacktrace

> com.google.api.server.spi.SystemService invokeServiceMethod: exception
> occurred while calling backend method (SystemService.java:398)
> 
> java.lang.NoSuchMethodError:
> com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;)V
>   at
> com.google.firebase.FirebaseApp.checkNotDeleted(FirebaseApp.java:314)
>   at com.google.firebase.FirebaseApp.getOptions(FirebaseApp.java:260)
>   at
> com.google.firebase.database.FirebaseDatabase.getInstance(FirebaseDatabase.java:80)
>   at
> in.prago.spi.PragoMerchantApi.saveProfile(PragoMerchantApi.java:189)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>   at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:42)  at
> com.google.api.server.spi.SystemService.invokeServiceMethod(SystemService.java:363)
>   at
> com.google.api.server.spi.SystemServiceServlet.execute(SystemServiceServlet.java:113)
>   at
> com.google.api.server.spi.SystemServiceServlet.doPost(SystemServiceServlet.java:71)
>   at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)     at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:717)  at
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
>   at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
>   at
> com.googlecode.objectify.ObjectifyFilter.doFilter(ObjectifyFilter.java:48)
>   at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
>   at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
>   at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
>   at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
>   at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
>   at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
>   at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>   at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
>   at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
>   at
> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
>   at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>   at org.mortbay.jetty.Server.handle(Server.java:326)     at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
>   at
> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
>   at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>   at
> com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:453)
>   at
> com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:460)
>   at
> com.google.tracing.CurrentContext.runInContext(CurrentContext.java:293)
>   at
> com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:319)
>   at
> com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:311)
>   at
> com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:457)
>   at java.lang.Thread.run(Thread.java:745)

http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <packaging>war</packaging>
    <version>1.0</version>


    <properties>
        <appengine.app.version>1</appengine.app.version>
        <appengine.target.version>1.9.53</appengine.target.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>

     <dependency>
  <groupId>com.google.firebase</groupId>
  <artifactId>firebase-admin</artifactId>
  <version>5.0.0</version>
</dependency>

<dependency>

    <groupId>com.google.endpoints</groupId>
    <artifactId>endpoints-framework</artifactId>
    <version>2.0.7</version>
</dependency>
        <dependency>
            <groupId>com.google.appengine</groupId>
            <artifactId>appengine-api-1.0-sdk</artifactId>
            <version>${appengine.target.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.appengine</groupId>
            <artifactId>appengine-endpoints</artifactId>
            <version>${appengine.target.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
        </dependency>
        <dependency>
            <groupId>com.googlecode.objectify</groupId>
            <artifactId>objectify</artifactId>
            <version>5.1.17</version>
        </dependency>

        <dependency>
    <groupId>com.google.endpoints</groupId>
    <artifactId>endpoints-management-control-appengine</artifactId>
    <version>1.0.0-beta.11</version>
</dependency>
<dependency>
    <groupId>com.google.endpoints</groupId>
    <artifactId>endpoints-framework-auth</artifactId>
    <version>1.0.0-beta.11</version>
</dependency>



        <!-- Test Dependencies -->
        <dependency>
            <groupId>com.google.appengine</groupId>
            <artifactId>appengine-testing</artifactId>
            <version>${appengine.target.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.appengine</groupId>
            <artifactId>appengine-api-stubs</artifactId>
            <version>${appengine.target.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
        </dependency>



    </dependencies>

    <build>
        <outputDirectory>target/${project.artifactId}-${project.version}/WEB-INF/classes</outputDirectory>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <version>2.5.1</version>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
    <groupId>com.google.cloud.tools</groupId>
    <artifactId>endpoints-framework-maven-plugin</artifactId>
    <version>1.0.0-beta5</version>
    <configuration>
        <!-- plugin configuration -->
    </configuration>
</plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <webXml>${project.build.directory}/generated-sources/appengine-endpoints/WEB-INF/web.xml</webXml>
                    <webResources>
                        <resource>
                            <!-- this is relative to the pom.xml directory -->
                            <directory>${project.build.directory}/generated-sources/appengine-endpoints</directory>
                            <!-- the list has a default value of ** -->
                            <includes>
                                <include>WEB-INF/*.discovery</include>
                                <include>WEB-INF/*.api</include>
                            </includes>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.google.appengine</groupId>
                <artifactId>appengine-maven-plugin</artifactId>
                <version>${appengine.target.version}</version>
                <configuration>
                    <enableJarClasses>false</enableJarClasses>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>endpoints_get_discovery_doc</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>
                                            com.google.appengine
                                        </groupId>
                                        <artifactId>
                                            appengine-maven-plugin
                                        </artifactId>
                                        <versionRange>
                                            [1.9.3,)
                                        </versionRange>
                                        <goals>
                                            <goal>
                                                endpoints_get_discovery_doc
                                            </goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    <groupId>in.prago</groupId>
    <artifactId>prago</artifactId>
</project>

解决方案

Include on project Guava newer version dependence.

<dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>22.0</version>
</dependency>

这篇关于NoSuchMethodError:将Firebase与应用引擎应用整合在一起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆