Фреймворк Spring с Java 8 на Google App Engine не запускается

У меня есть веб-приложение, работающее на Google App Engine (GAE) с использованием Java 7.

Я хочу перейти на Java 8, потому что Java 7 устарела.

Обновлена ​​версия Spring framework до (5.0.6), а безопасность - до (5.0.5).

Я получаю это исключение при запуске:

[INFO] 2018-06-11 09:52:34,592            main  INFO [ContextLoaderListener] Java Version : 1.8.0_73-b02
[INFO] 2018-06-11 09:52:34,698            main  INFO [ContextLoaderListener] starting TrackAndTraceServer::version:4.0.4-SNAPSHOT-unavailable
[INFO] Jun 11, 2018 9:52:34 AM com.google.appengine.tools.development.ApiProxyLocalImpl log
[INFO] INFO: javax.servlet.ServletContext log: Initializing Spring root WebApplicationContext
[INFO] 2018-06-11 09:52:34,760            main  INFO [ContextLoader] Root WebApplicationContext: initialization started
[INFO] 2018-06-11 09:52:34,921            main  INFO [CustomXmlWebApplicationContext] Refreshing Root WebApplicationContext: startup date [Mon Jun 11 09:52:34 UTC 2018]; root of context hierarchy
[INFO] 2018-06-11 09:52:35,077            main  INFO [XmlBeanDefinitionReader] Loading XML bean definitions from ServletContext resource [/WEB-INF/beans.xml]
[INFO] 2018-06-11 09:52:35,187            main  INFO [XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [dao-beans.xml]
[INFO] 2018-06-11 09:52:35,354            main  INFO [SpringSecurityCoreVersion] You are running with Spring Security Core 5.0.5.RELEASE
[INFO] 2018-06-11 09:52:35,354            main  INFO [SecurityNamespaceHandler] Spring Security 'config' module version is 5.0.5.RELEASE
[INFO] 2018-06-11 09:52:35,526            main  INFO [HttpSecurityBeanDefinitionParser] Checking sorted filter chain: [Root bean: class [org.springframework.security.web.context.SecurityContextPersistenceFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 200, Root bean: class [org.springframework.security.web.header.HeaderWriterFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 500, Root bean: class [org.springframework.security.web.csrf.CsrfFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 700, <tagAuthenticationFilter>, order = 1000, <apiKeyAuthenticationFilter>, order = 1001, <authenticationFilter>, order = 1200, Root bean: class [org.springframework.security.web.savedrequest.RequestCacheAwareFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1700, Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.security.config.http.HttpConfigurationBuilder$SecurityContextHolderAwareRequestFilterBeanFactory#0; factoryMethodName=getBean; initMethodName=null; destroyMethodName=null, order = 1800, <rememberMeFilter>, order = 2000, Root bean: class [org.springframework.security.web.session.SessionManagementFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 2200, Root bean: class [org.springframework.security.web.access.ExceptionTranslationFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 2300, <org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0>, order = 2400]
[INFO] 2018-06-11 09:52:35,921            main ERROR [ContextLoader] Context initialization failed
[INFO] java.lang.NoClassDefFoundError: java.util.stream.Stream is a restricted class. Please see the Google  App Engine developer's guide for more details.
[INFO]  at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:50)
[INFO]  at org.springframework.beans.factory.config.ConstructorArgumentValues.addArgumentValues(ConstructorArgumentValues.java:79)
[INFO]  at org.springframework.beans.factory.config.ConstructorArgumentValues.<init>(ConstructorArgumentValues.java:62)
[INFO]  at org.springframework.beans.factory.support.AbstractBeanDefinition.<init>(AbstractBeanDefinition.java:245)
[INFO]  at org.springframework.beans.factory.support.RootBeanDefinition.<init>(RootBeanDefinition.java:229)
[INFO]  at org.springframework.beans.factory.support.RootBeanDefinition.cloneBeanDefinition(RootBeanDefinition.java:404)
[INFO]  at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:1253)
[INFO]  at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:1224)
[INFO]  at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1210)
[INFO]  at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:414)
[INFO]  at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:390)
[INFO]  at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:84)
[INFO]  at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:694)
[INFO]  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532)
[INFO]  at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:409)
[INFO]  at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:291)
  1. Фреймворк Spring с Java 8 несовместим с GAE?
  2. Стоит ли мне переходить на Spring boot?

Есть ли в вашем appengine-web.xml <runtime>java8</runtime>? Похоже, вы все еще работаете на Java 7.

Mike E. 11.06.2018 21:06

Да точно! Followed cloud.google.com/appengine/docs/standard/java/runtime-java8 Однако я вижу эти сообщения при запуске [ИНФОРМАЦИЯ] Предупреждение: среда выполнения Java 7 в Google App Engine устарела. [INFO] Предупреждение: см. cloud.google.com/appengine/docs/deprecations/java7

sami 12.06.2018 07:45
0
2
202
1
Перейти к ответу Данный вопрос помечен как решенный

Ответы 1

Ответ принят как подходящий

Он использовал тестовый файл appengine-web.xml вместо производственного, который не включает java8

Спасибо за подсказку, Майк Э.

Без проблем. Я рада, что ты в этом разобрался!

Mike E. 12.06.2018 15:40

Другие вопросы по теме