所以,基本上,我有一个Spring应用程序,为它编写了一些测试。我使用Gradle作为构建工具。
在我的本地计算机上,当我运行./gradlew test
时,测试正常运行
但是,如果我在服务器上运行./gradlew --info test
,它会挂起:
00:17:56.962 [DEBUG] [TestEventLogger] [INFO ] 2017-06-04 00:17:56.957 [Test worker] DefaultSecurityFilterChain - Creating filter chain: Ant [pattern='/static/favicon.png'], []
00:17:56.963 [DEBUG] [TestEventLogger]
00:17:57.788 [DEBUG] [TestEventLogger] [INFO ] 2017-06-04 00:17:57.785 [Test worker] DefaultSecurityFilterChain - Creating filter chain: org.springframework.security.web.util.matcher.AnyRequestMatcher@1, [org.springframework.security.web.context.SecurityContextPersistenceFilter@2f31c01c, org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@8037423, org.springframework.security.web.header.HeaderWriterFilter@786b4abb, org.springframework.security.web.csrf.CsrfFilter@5918a556, org.springframework.security.web.authentication.logout.LogoutFilter@7d37adb3, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@6758fc2, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@20285a59, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@60cb2224, org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter@2e211564, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@1e4a09cc, org.springframework.security.web.session.SessionManagementFilter@12b71ea9, org.springframework.security.web.access.ExceptionTranslationFilter@2b469730, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@1b0e8045]
00:17:57.792 [DEBUG] [TestEventLogger]
00:17:57.859 [DEBUG] [TestEventLogger] [INFO ] 2017-06-04 00:17:57.854 [Test worker] DefaultFilterChainValidator - Checking whether login URL '/login' is accessible with your configuration
所以这是我看到的最后一个输出。不确定什么可能导致这种情况。我尝试用strace运行它,这是完整的输出直到它挂起的地方:strace.log
我非常感谢有关这个奇怪问题的调查方面的任何帮助。
这是build.gradle
这是Spring Security configuration
本地计算机:
$ uname -srv
Linux 4.4.0-78-generic #99-Ubuntu SMP Thu Apr 27 15:29:09 UTC 2017
$ java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
$ ./gradlew --version | grep Gradle
Gradle 2.12
服务器:
$ uname -srv
Linux 3.10.0-514.21.1.el7.x86_64 #1 SMP Thu May 25 17:04:51 UTC 2017
$ java -version
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-b12)
OpenJDK 64-Bit Server VM (build 25.131-b12, mixed mode)
$ ./gradlew --version | grep Gradle
Gradle 2.12