今天升级服务,没有改任何依赖,发现竟然启动失败,报以下错误:
2017-02-08 15:16:25.357 main ERROR [org.springframework.web.context.ContextLoader:307] - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'im4.soa.product.jsf': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.jd.pop.ware.ic.api.service.read.SkuReadService com.jd.im4.soa.jd.product.impl.ProductJsfProxyImpl.skuReadService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'skuReadService': FactoryBean threw exception on object creation; nested exception is java.lang.UnsupportedClassVersionError: javax/validation/Constraint : Unsupported major.minor version 52.0 (unable to load class javax.validation.Constraint)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1120)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:607)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:675)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:601)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.jd.pop.ware.ic.api.service.read.SkuReadService com.jd.im4.soa.jd.product.impl.ProductJsfProxyImpl.skuReadService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'skuReadService': FactoryBean threw exception on object creation; nested exception is java.lang.UnsupportedClassVersionError: javax/validation/Constraint : Unsupported major.minor version 52.0 (unable to load class javax.validation.Constraint)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:514)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)
... 37 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'skuReadService': FactoryBean threw exception on object creation; nested exception is java.lang.UnsupportedClassVersionError: javax/validation/Constraint : Unsupported major.minor version 52.0 (unable to load class javax.validation.Constraint)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1443)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:249)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:873)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:815)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:730)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:486)
... 39 more
Caused by: java.lang.UnsupportedClassVersionError: javax/validation/Constraint : Unsupported major.minor version 52.0 (unable to load class javax.validation.Constraint)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2822)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1159)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:95)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:107)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:31)
at sun.reflect.annotation.AnnotationParser.parseSig(AnnotationParser.java:370)
at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:181)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3070)
at java.lang.Class.getAnnotation(Class.java:3029)
at sun.reflect.annotation.AnnotationType.
at sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:66)
at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:202)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
at java.lang.reflect.Field.declaredAnnotations(Field.java:1014)
at java.lang.reflect.Field.getAnnotation(Field.java:1000)
at com.jd.org.msgpack.template.builder.AbstractTemplateBuilder.isAnnotated(AbstractTemplateBuilder.java:256)
at com.jd.org.msgpack.template.builder.AbstractTemplateBuilder.getFieldOption(AbstractTemplateBuilder.java:212)
at com.jd.org.msgpack.template.builder.AbstractTemplateBuilder.toFieldEntries(AbstractTemplateBuilder.java:145)
at com.jd.org.msgpack.template.builder.AbstractTemplateBuilder.buildTemplate(AbstractTemplateBuilder.java:59)
at com.jd.org.msgpack.template.TemplateRegistry.buildAndRegister(TemplateRegistry.java:557)
at com.jd.org.msgpack.template.TemplateRegistry.register(TemplateRegistry.java:129)
at com.jd.jsf.gd.codec.msgpack.JSFMsgPack.checkAndRegistry(JSFMsgPack.java:217)
at com.jd.jsf.gd.util.CodecUtils.checkAndRegistryClass(CodecUtils.java:179)
at com.jd.jsf.gd.util.CodecUtils.registryService(CodecUtils.java:90)
at com.jd.jsf.gd.util.CodecUtils.registryService(CodecUtils.java:62)
at com.jd.jsf.gd.config.ConsumerConfig.refer(ConsumerConfig.java:270)
at com.jd.jsf.gd.config.spring.ConsumerBean.getObject(ConsumerBean.java:86)
回滚正常,仔细对比了前后2个版本的打包lib目录,发现一个可疑的jar被升级了:
validation-api-1.1.0.Final.jar --------> validation-api-2.0.0.Alpha1.jar
网上查了下,这种提示可能是因为版本2.0.0是不支持在jdk1.6版本下运行的
解决策略:
>移除该未使用的jar
>在不影响功能基础上还原版本
>升级jdk
根本原因后续排查,记录一下。