java.lang.NoClassDefFoundError: javax/annotation/Priority
异常内容:
2017-09-25-15-02 [localhost-startStop-1] [org.springframework.web.context.ContextLoader] [ERROR] - Context initialization failed java.lang.NoClassDefFoundError: javax/annotation/Priority at org.glassfish.jersey.model.internal.ComponentBag.modelFor(ComponentBag.java:479) at org.glassfish.jersey.model.internal.ComponentBag.access$100(ComponentBag.java:88) at org.glassfish.jersey.model.internal.ComponentBag$5.call(ComponentBag.java:406) at org.glassfish.jersey.model.internal.ComponentBag$5.call(ComponentBag.java:397) at org.glassfish.jersey.internal.Errors.process(Errors.java:251) at org.glassfish.jersey.internal.Errors.process(Errors.java:233) at org.glassfish.jersey.internal.Errors.process(Errors.java:164) at org.glassfish.jersey.model.internal.ComponentBag.registerModel(ComponentBag.java:397) at org.glassfish.jersey.model.internal.ComponentBag.register(ComponentBag.java:271) at org.glassfish.jersey.model.internal.CommonConfig.register(CommonConfig.java:399) at org.glassfish.jersey.model.internal.CommonConfig.register(CommonConfig.java:87) at org.glassfish.jersey.jackson.JacksonFeature.configure(JacksonFeature.java:58) at org.glassfish.jersey.model.internal.CommonConfig.configureFeatures(CommonConfig.java:600) at org.glassfish.jersey.model.internal.CommonConfig.configureMetaProviders(CommonConfig.java:541) at org.glassfish.jersey.client.ClientConfig$State.initRuntime(ClientConfig.java:369) at org.glassfish.jersey.client.ClientConfig$State.access$000(ClientConfig.java:84) at org.glassfish.jersey.client.ClientConfig$State$3.get(ClientConfig.java:118) at org.glassfish.jersey.client.ClientConfig$State$3.get(ClientConfig.java:115) at org.glassfish.jersey.internal.util.collection.Values$LazyValue.get(Values.java:275) at org.glassfish.jersey.client.ClientConfig.getRuntime(ClientConfig.java:666) at org.glassfish.jersey.client.ClientRequest.getClientRuntime(ClientRequest.java:149) at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:704) at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:367) at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:271) at com.baidu.disconf.core.common.restful.type.RestfulGet.call(RestfulGet.java:34) at com.baidu.disconf.core.common.restful.retry.impl.RetryStrategyRoundBin.retry(RetryStrategyRoundBin.java:31) at com.baidu.disconf.core.common.restful.impl.RestfulMgrImpl.getJsonData(RestfulMgrImpl.java:95) at com.baidu.disconf.client.fetcher.impl.FetcherMgrImpl.getValueFromServer(FetcherMgrImpl.java:70) at com.baidu.disconf.client.watch.WatchFactory.getWatchMgr(WatchFactory.java:43) at com.baidu.disconf.client.core.DisconfCoreFactory.getDisconfCoreMgr(DisconfCoreFactory.java:31) at com.baidu.disconf.client.DisconfMgr.firstScan(DisconfMgr.java:80) at com.baidu.disconf.client.DisconfMgrBean.postProcessBeanDefinitionRegistry(DisconfMgrBean.java:94) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:98) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:678) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:520) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5077) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5591) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: javax.annotation.Priority at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1856) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1705) ... 48 more 九月 25, 2017 3:02:13 下午 org.apache.catalina.core.StandardContext listenerStart 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener java.lang.NoClassDefFoundError: javax/annotation/Priority at org.glassfish.jersey.model.internal.ComponentBag.modelFor(ComponentBag.java:479) at org.glassfish.jersey.model.internal.ComponentBag.access$100(ComponentBag.java:88) at org.glassfish.jersey.model.internal.ComponentBag$5.call(ComponentBag.java:406) at org.glassfish.jersey.model.internal.ComponentBag$5.call(ComponentBag.java:397) at org.glassfish.jersey.internal.Errors.process(Errors.java:251) at org.glassfish.jersey.internal.Errors.process(Errors.java:233) at org.glassfish.jersey.internal.Errors.process(Errors.java:164) at org.glassfish.jersey.model.internal.ComponentBag.registerModel(ComponentBag.java:397) at org.glassfish.jersey.model.internal.ComponentBag.register(ComponentBag.java:271) at org.glassfish.jersey.model.internal.CommonConfig.register(CommonConfig.java:399) at org.glassfish.jersey.model.internal.CommonConfig.register(CommonConfig.java:87) at org.glassfish.jersey.jackson.JacksonFeature.configure(JacksonFeature.java:58) at org.glassfish.jersey.model.internal.CommonConfig.configureFeatures(CommonConfig.java:600) at org.glassfish.jersey.model.internal.CommonConfig.configureMetaProviders(CommonConfig.java:541) at org.glassfish.jersey.client.ClientConfig$State.initRuntime(ClientConfig.java:369) at org.glassfish.jersey.client.ClientConfig$State.access$000(ClientConfig.java:84) at org.glassfish.jersey.client.ClientConfig$State$3.get(ClientConfig.java:118) at org.glassfish.jersey.client.ClientConfig$State$3.get(ClientConfig.java:115) at org.glassfish.jersey.internal.util.collection.Values$LazyValue.get(Values.java:275) at org.glassfish.jersey.client.ClientConfig.getRuntime(ClientConfig.java:666) at org.glassfish.jersey.client.ClientRequest.getClientRuntime(ClientRequest.java:149) at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:704) at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:367) at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:271) at com.baidu.disconf.core.common.restful.type.RestfulGet.call(RestfulGet.java:34) at com.baidu.disconf.core.common.restful.retry.impl.RetryStrategyRoundBin.retry(RetryStrategyRoundBin.java:31) at com.baidu.disconf.core.common.restful.impl.RestfulMgrImpl.getJsonData(RestfulMgrImpl.java:95) at com.baidu.disconf.client.fetcher.impl.FetcherMgrImpl.getValueFromServer(FetcherMgrImpl.java:70) at com.baidu.disconf.client.watch.WatchFactory.getWatchMgr(WatchFactory.java:43) at com.baidu.disconf.client.core.DisconfCoreFactory.getDisconfCoreMgr(DisconfCoreFactory.java:31) at com.baidu.disconf.client.DisconfMgr.firstScan(DisconfMgr.java:80) at com.baidu.disconf.client.DisconfMgrBean.postProcessBeanDefinitionRegistry(DisconfMgrBean.java:94) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:98) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:678) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:520) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5077) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5591) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: javax.annotation.Priority at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1856) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1705) ... 48 more
解决方法:
在POM的<dependencies> 添加 javax.annotation 引用:
<dependency> <groupId>javax.annotation</groupId> <artifactId>javax.annotation-api</artifactId> <version>1.2</version> </dependency>
javax.annotation Maven仓库地址:
http://maven.outofmemory.cn/javax.annotation/javax.annotation-api/1.2/