How to deal with App Engine Devserver exception du

2019-09-18 04:26发布

问题:

Developing a Google App Engine app with Spring MVC, the following exception presents itself while running the dev server on OSX:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0':
Initialization of bean failed [...]    


nested exception is java.lang.NoClassDefFoundError:
java.time.format.FormatStyle is a restricted class. Please see the
Google  App Engine developer's guide for more details.

This error does not present itself if I upload my app to Google App Engine's cloud server.

How to get around it?

回答1:

Downgrading Java 1.8 to 1.7 fixed the issue.



回答2:

Well, that is not the answer most people would look for. Following is the solution to fix the problem.

use <runtime>java8</runtime> in appengine-web.xml

This will fix the problem. This doesn't require you to downgrade you java version from 1.8 to 1.7.