启动tomcat时出现此错误
2013-09-26 10:27:24,616 INFO [localhost-startStop-1] UrlRewriteFilter.(Log.java:227) - loaded (conf ok)
2013-09-26 10:27:24,657 DEBUG [localhost-startStop-1] LocaleFilter.(GenericFilterBean.java:172) - Initializing filter 'localeFilter'
2013-09-26 10:27:24,657 DEBUG [localhost-startStop-1] LocaleFilter.(GenericFilterBean.java:197) - Filter 'localeFilter' configured successfully
2013-09-26 10:27:24,693 DEBUG [localhost-startStop-1] SessionFilter.(GenericFilterBean.java:172) - Initializing filter 'sessionFilter'
2013-09-26 10:27:24,694 DEBUG [localhost-startStop-1] SessionFilter.(GenericFilterBean.java:197) - Filter 'sessionFilter' configured successfully
2013-09-26 10:27:24,728 INFO [localhost-startStop-1] ResponseOverrideFilter.(ResponseOverrideFilter.java:108) - Filter initialized. Response buffering is enabled
2013-09-25 19:13:15,856 ERROR [localhost-startStop-1] DispatcherServlet (FrameworkServlet.java:468) - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping': Initialization of bean failed; nested exception is java.lang.VerifyError: Cannot inherit from final class
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:532)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:289)
at org.springframework.web.servlet.DispatcherServlet.createDefaultStrategy(DispatcherServlet.java:810)
at org.springframework.web.servlet.DispatcherServlet.getDefaultStrategies(DispatcherServlet.java:779)
at org.springframework.web.servlet.DispatcherServlet.initHandlerMappings(DispatcherServlet.java:549)
at org.springframework.web.servlet.DispatcherServlet.initStrategies(DispatcherServlet.java:443)
at org.springframework.web.servlet.DispatcherServlet.onRefresh(DispatcherServlet.java:432)
at org.springframework.web.servlet.FrameworkServlet.onApplicationEvent(FrameworkServlet.java:773)
at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1063)
at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1060)
at org.springframework.context.event.GenericApplicationListenerAdapter.onApplicationEvent(GenericApplicationListenerAdapter.java:51)
Caused by: java.lang.VerifyError: Cannot inherit from final class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2888)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1172)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1558)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2436)
at java.lang.Class.getDeclaredMethods(Class.java:1793)
我发现错误来自此代码
String code = request.getReader().toString();
GoogleTokenResponse tokenResponse = new GoogleAuthorizationCodeTokenRequest(TRANSPORT,
JSON_FACTORY, CLIENT_ID, CLIENT_SECRET, code,"postmessage").execute();
此代码在请求弹簧的函数调用中
更新当我评论此代码部分时,不会发生错误并且应用程序工作正常。我认为导致google API调用和spring之间发生冲突的原因。
解决了
我解决了这个问题,在为它们分配 GoogleAuthorizzationCodeTokenRequest.execute 的值之前,我已经初始化了 GoogleTokenResponse 并且错误消失了。