为啥我的项目只有在发布到谷歌服务器后才会失败?

     2023-02-27     137

关键词:

【中文标题】为啥我的项目只有在发布到谷歌服务器后才会失败?【英文标题】:Why my project fails only once it is published to google server?为什么我的项目只有在发布到谷歌服务器后才会失败? 【发布时间】:2016-02-24 06:18:31 【问题描述】:

代码在我的本地环境中正常工作。

我正在使用 google app engine + spring mvc,安全和社交。

每当我点击“登录”按钮,接受同意屏幕时,我都会收到此错误,当它返回我的网站时,似乎无法检索用户的数据:

Error for /auth/google
java.lang.NoSuchMethodError: org.springframework.social.connect.web.ProviderSignInAttempt.<init>(Lorg/springframework/social/connect/Connection;)V
    at org.springframework.social.security.SocialAuthenticationFilter.addSignInAttempt(SocialAuthenticationFilter.java:344)
    at org.springframework.social.security.SocialAuthenticationFilter.doAuthentication(SocialAuthenticationFilter.java:317)
    at org.springframework.social.security.SocialAuthenticationFilter.attemptAuthService(SocialAuthenticationFilter.java:255)
    at org.springframework.social.security.SocialAuthenticationFilter.attemptAuthentication(SocialAuthenticationFilter.java:159)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:211)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:85)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
    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:43)
    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:260)
    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:78)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:148)
    at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:469)
    at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:437)
    at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:444)
    at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:234)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:308)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:300)
    at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:441)
    at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:235)
    at java.lang.Thread.run(Thread.java:745)

我的 pom.xml 依赖项:

   <!--Spring Social-->
    <dependency>
        <groupId>org.springframework.social</groupId>
        <artifactId>spring-social-config</artifactId>
        <version>1.1.3.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.social</groupId>
        <artifactId>spring-social-core</artifactId>
        <version>1.1.3.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.social</groupId>
        <artifactId>spring-social-security</artifactId>
        <version>1.1.3.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.social</groupId>
        <artifactId>spring-social-web</artifactId>
        <version>1.1.3.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.social</groupId>
        <artifactId>spring-social-google</artifactId>
        <version>1.0.0.RELEASE</version>
    </dependency>

这是 web.xml:

<?xml version="1.0" encoding="UTF-8"?><web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">

<display-name>PronosticApp</display-name>

<servlet>
    <servlet-name>spring-web</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            /WEB-INF/applicationContext.xml
        </param-value>
    </init-param>
</servlet>

<servlet-mapping>
    <servlet-name>spring-web</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

<context-param>
    <param-name>contextClass</param-name>
    <param-value>com.gemasoft.pronosticapp.config.MyXmlWebApplicationContext</param-value>
</context-param>

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

【问题讨论】:

我也遇到了同样的问题,你找到原因了吗? 不,我使用 hello.js 而不是 spring social 来使其工作 你能在抛出异常的地方添加代码吗? 【参考方案1】:

您似乎在使用不同版本的工件,请参阅 1.1.3.RELEASE1.0.0.RELEASE

<dependency>
    <groupId>org.springframework.social</groupId>
    <artifactId>spring-social-web</artifactId>
    <version>1.1.3.RELEASE</version>
</dependency>

<dependency>
    <groupId>org.springframework.social</groupId>
    <artifactId>spring-social-google</artifactId>
    <version>1.0.0.RELEASE</version>
</dependency>

我了解到目前没有更新的 spring-social-google 版本可用。但是,这些工件的依赖关系可能会有所不同。对于测试,我建议您删除 spring-social-google 依赖项,然后看看它是否有效。

如果是,您应该运行mvn tree 并分析不同工件的依赖关系。您应该看到 1.0.0.RELEASE 版本依赖于与 1.1.3.RELEASE 版本不同的库。从那里您可以尝试使用&lt;exclude&gt; 排除 1.0.0.RELEASE 版本的依赖项,就像这样

<dependency>
    <groupId>org.springframework.social</groupId>
    <artifactId>spring-social-google</artifactId>
    <version>1.0.0.RELEASE</version>
    <exclude>
           <exclusion>
                <groupId>groupId.of.artifact.i.dont.want</groupId>
                <artifactId>artifactId.of.artifact.i.dont.want</artifactId>
            </exclusion>
    </exclude>
</dependency>

【讨论】:

不,我认为这不是问题,不确定它是否与 gae 限制有关 我最近遇到了一个非常相似的问题,我能够通过排除(在我的情况下)gson 的旧版本依赖项来解决它。当然,它可能是其他东西,但错误告诉我们找到了类但缺少方法。因此,很可能是版本冲突,您可以使用 mvn 树和排除来诊断。我看到(仅举一个例子)spring-social-core 对 org.apache.httpcomponents.httpclient 有一个可选的依赖项,这在应用程序引擎上不受支持。

我正在尝试 MagicalRecord,但为啥只有在添加新属性后才会删除数据?

】我正在尝试MagicalRecord,但为啥只有在添加新属性后才会删除数据?【英文标题】:I\'mtryingoutMagicalRecordbutwhydoesdatabeingerasedonlyafteraddinganewattribute?我正在尝试MagicalRecord,但为什么只有在添加新属性后才会删除数据?【发布时间... 查看详情

为啥我的网站的谷歌地图部分只有在用户删除他/她的 cookie 时才会更新?

】为啥我的网站的谷歌地图部分只有在用户删除他/她的cookie时才会更新?【英文标题】:WhydoestheGoogleMapsportionofmywebsiteonlyupdatewhentheuserdeleteshis/hercookies?为什么我的网站的谷歌地图部分只有在用户删除他/她的cookie时才会更新?【... 查看详情

Webview 有时只有在暂停和恢复后才会变为空白

...0【问题描述】:在我的Android应用程序中,我使用WebView从服务器加载页面。当应用程序在这个webview上时,如果我按下主页按钮然后切换回我的应用程序,WebView看起来很好。到这里为止没有问题。如果按下主页 查看详情

UILabel 只有在定向后才会增长

】UILabel只有在定向后才会增长【英文标题】:UILabelisgrowingonlyafterorientation【发布时间】:2019-07-2612:59:03【问题描述】:我有行数为0的uilabel,并将4条边的编程约束设置为超级视图。当我运行时,我看到标签没有显示多行,但是... 查看详情

GPG服务测试没有上传新的apk签署到谷歌播放

...间】:2018-02-1412:55:57【问题描述】:我有游戏应用,并且我的应用还注册了应用签名服务。我有两个SHA-1证书指纹,一个是应用签名证书,另一个是上传证书。我的应用程序将更新新版本,但在开发和测试期间我遇到连接失败的... 查看详情

为啥我的googleplay一直显示网络连接失败?

需要连接到国际网络,才能连接到谷歌的服务器,访问谷歌商店,并且在运行GooglePlay之前,Android手机还需要安装谷歌框架。由于谷歌退出了中国市场,并且目前国内已经屏蔽了谷歌的服务器连接,所以会显示无法连接或者数据... 查看详情

如何激活点击以路由到谷歌地图

...被禁用。谷歌地图已安装。所以不知何故禁用。我如何在我的项目中使用它?这张图片会告诉你我的意思:代码在这里:constdoubleZOOM=1;classHomeViewextendsStatelessWidgetstaticGoogleMa 查看详情

如何使用谷歌应用引擎将 php 项目部署到谷歌云中?

...了一个phpWeb应用程序。我正在尝试部署应用程序,但未在服务器上运行,但出现错误。按照谷歌搜索的说明:在谷歌云上创建谷歌项目已下载go 查看详情

发布到谷歌和亚马逊

...所知,亚马逊商店有自己的DRM。其他人在为两家商店编译项目做什么?在为亚马逊编译时,我需要排除项目引用和对许可证检查器的调用。【问题讨论】:【参考方案1】:链接中的答案是打开带有意图的链接,但这里同样适用... 查看详情

STM32F4程序只有在按下复位按钮后才会运行

】STM32F4程序只有在按下复位按钮后才会运行【英文标题】:STM32F4ProgramWillOnlyRunAfterPressingResetButton【发布时间】:2017-08-1913:28:33【问题描述】:我最近购买了一块NUCLEO-F446RE板(STM32F4产品),一个小问题一直困扰着我。我编写的... 查看详情

Swift/iOS:UIPicker 显示在以编程方式更改数据源后点击后才会刷新

...序中,我有一个选择器,它在POST请求后填充了来自我的服务器的数据。它最初只有一个元素 查看详情

为啥按钮只有在第二次点击后才起作用? (反应)

】为啥按钮只有在第二次点击后才起作用?(反应)【英文标题】:Whybuttonworksonlyaftersecondclick?(reactjs)为什么按钮只有在第二次点击后才起作用?(反应)【发布时间】:2020-08-1908:46:14【问题描述】:我有登录按钮,如果每个输... 查看详情

如何将我的 keras 模型保存到谷歌驱动器或计算机中?

】如何将我的keras模型保存到谷歌驱动器或计算机中?【英文标题】:HowdoIsavemykerasmodelintogoogledriveorthecomputer?【发布时间】:2021-12-1109:58:11【问题描述】:没有代码,我正在制作一个像样的ML项目,我想将我的keras模型导入谷歌驱... 查看详情

ios 添加事件到谷歌日历

...题描述】:我正在搜索如何添加事件t用户谷歌日历。在我的项目中,我有包含事件的数据库(标题、开始日期、结束日期等)。当用户单击同步按钮时,所有这些事件都应添加到用户谷歌日历中。我从here下载了api。但它适用于M... 查看详情

在我的 Flutter 应用中,只有当我们触摸屏幕时才会加载页面内容。为啥?

...lutter应用中,只有当我们触摸屏幕时才会加载页面内容。为啥?【英文标题】:Inmyflutterapp,thecontentofthepageisloadedonlywhenwetouchthescreen.Why?在我的Flutter应用中,只有当我们触摸屏幕时才会加载页面内容。为什么?【发布时间】:2021-0... 查看详情

从 SQL 数据库显示信息到谷歌图表

...发布时间】:2020-05-1112:50:05【问题描述】:我正在尝试将我的SQL数据库中的信息显示到谷歌图表。该项目是一个健康仪表板,我需要在其中显示步数、千卡等。我从数据库中获取了信息,但在循环访问它时遇到了问题(相同的信... 查看详情

为啥只有当我从 iframe 调用 postMessage() 方法时我的 Angular 属性才会更新

】为啥只有当我从iframe调用postMessage()方法时我的Angular属性才会更新【英文标题】:WhydoesmyAngularattributeisupdatedonlywhenIcallapostMessage()methodfrommyiframe为什么只有当我从iframe调用postMessage()方法时我的Angular属性才会更新【发布时间】:2... 查看详情

AWS - 想要将多个文件上传到 S3,并且只有在所有文件都上传后才会触发 lambda 函数

】AWS-想要将多个文件上传到S3,并且只有在所有文件都上传后才会触发lambda函数【英文标题】:AWS-wanttouploadmultiplefilestoS3andonlywhenallareuploadedtriggeralambdafunction【发布时间】:2016-03-2609:46:03【问题描述】:我正在就设计这个的最佳... 查看详情