3

WebアプリケーションでFirebase Authを使用して実験を開始しました。次の手順では、成功した:FirebaseAuthのインスタンスを取得しようとするとNoSuchMethodErrorが発生する

  • ログインメールパスワードを使用して
  • idToken
  • 次のように私はFirebaseAppを初期化しています私のStartupListenerで検証

のために自分のサーバーにidTokenを送る取得:

serviceAccount = new FileInputStream(root + 
    "/WEB-INF/classes/<projid>-firebase-adminsdk-ojzbs-<some-number>.json"); 

FirebaseOptions options = new FirebaseOptions.Builder() 
    .setCredential(FirebaseCredentials.fromCertificate(serviceAccount)) 
    .setDatabaseUrl("https://<projid>.firebaseio.com").build(); 

FirebaseApp fibApp = FirebaseApp.initializeApp(options); 

T彼のコードは例外をスローしないので、正常に動作していると仮定します。

私のAPI呼び出しに次の行はNoSuchMethodErrorスロー:

FirebaseAuth fibAuth = FirebaseAuth.getInstance(); 

スタックトレース:

/api/users/verify org.glassfish.jersey.server.ContainerException: java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;)V 
    at org.glassfish.jersey.servlet.internal.ResponseWriter.rethrow(ResponseWriter.java:249) 
    at org.glassfish.jersey.servlet.internal.ResponseWriter.failure(ResponseWriter.java:231) 
    at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:436) 
    at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:265) 
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) 
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) 
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315) 
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297) 
    at org.glassfish.jersey.internal.Errors.process(Errors.java:267) 
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:318) 
    at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:236) 
    at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1010) 
    at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:373) 
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:382) 
    at org.glassfish.jersey.servlet.ServletContainer.doFilter(ServletContainer.java:535) 
    at org.glassfish.jersey.servlet.ServletContainer.doFilter(ServletContainer.java:483) 
    at com.hsjawanda.plowns.config.JerseyFilter.doFilter(JerseyFilter.java:27) 
    at org.glassfish.jersey.servlet.ServletContainer.doFilter(ServletContainer.java:420) 
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) 
    at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) 
    at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) 
    at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) 
    at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) 
    at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) 
    at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) 
    at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) 
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) 
    at com.googlecode.objectify.ObjectifyFilter.doFilter(ObjectifyFilter.java:48) 
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) 
    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) 
Caused by: java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;)V 
    at com.google.firebase.FirebaseApp.checkNotDeleted(FirebaseApp.java:289) 
    at com.google.firebase.FirebaseApp.addService(FirebaseApp.java:365) 
    at com.google.firebase.ImplFirebaseTrampolines.addService(ImplFirebaseTrampolines.java:58) 
    at com.google.firebase.auth.FirebaseAuth.getInstance(FirebaseAuth.java:74) 
    at com.google.firebase.auth.FirebaseAuth.getInstance(FirebaseAuth.java:61) 
    at com.hsjawanda.plowns.rest.UserApi.verifyIdToken(UserApi.java:112) 
    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 org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) 
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:151) 
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:171) 
    at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:152) 
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:104) 
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:402) 
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:349) 
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:106) 
    at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:259) 
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) 
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) 
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315) 
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297) 
    at org.glassfish.jersey.internal.Errors.process(Errors.java:267) 
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:318) 
    at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:236) 
    at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1010) 
    at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:373) 
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:382) 
    at org.glassfish.jersey.servlet.ServletContainer.doFilter(ServletContainer.java:535) 
    at org.glassfish.jersey.servlet.ServletContainer.doFilter(ServletContainer.java:483) 
    at com.hsjawanda.plowns.config.JerseyFilter.doFilter(JerseyFilter.java:27) 
    at org.glassfish.jersey.servlet.ServletContainer.doFilter(ServletContainer.java:420) 
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) 
    at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) 
    at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) 
    at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) 
    at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) 
    at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) 
    at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) 
    at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) 
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) 
    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) ... 1 more 

私は電子メール/パスワード認証がFirebaseコンソールで有効になっています。 Firebase Admin SDKバージョン4.1.7(Java)を使用しています。コードはGoogle App Engine(標準環境)で実行されています。

Guava 19.0を使用しています。

答えて

2

解決方法は、Guavaをバージョン19.0から20.0にアップグレードすることです。

PS:GAEはこれまでGAのJava 7しかサポートしていないため、Guava 21.0は使用できません。

3

この問題について私の修正はfirebase管理ライブラリからグアバを除外することであり、このようにそれを手動でインポート:

compile ('com.google.firebase:firebase-admin:5.0.0') { 
    exclude group: 'com.google.guava' 
} 
compile 'com.google.guava:guava:21.0' 

問題がfirebase管理ライブラリーは、2つの異なるグアバ17のバージョンと20

を使用していたということでした
+1

最新のpom.xmlを教えていただけますか?私はすべてを試しましたが、私はまだ同じ問題に直面しています。 –

関連する問題