Caused by: java.lang.NoClassDefFoundError: com/google/common/base/MoreObjects

  环境:jdk1.8

  开发工具:IDEA

说明:今天在做springboot集成swagger2的时候,在启动程序的时候,报错

  报错信息:

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug‘ enabled.
2019-02-24 19:32:26.026 ERROR 8660 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

org.springframework.context.ApplicationContextException: Failed to start bean ‘documentationPluginsBootstrapper‘; nested exception is com.google.common.util.concurrent.ExecutionError: java.lang.NoClassDefFoundError: com/google/common/base/MoreObjects
	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:185) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
	at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
	at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
	at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
	at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:122) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:879) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:163) ~[spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
	at com.xb.SpringbootDemoApplication.main(SpringbootDemoApplication.java:11) [classes/:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_152]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_152]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_152]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_152]
	at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.1.1.RELEASE.jar:2.1.1.RELEASE]
Caused by: com.google.common.util.concurrent.ExecutionError: java.lang.NoClassDefFoundError: com/google/common/base/MoreObjects
	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2199) ~[guava-16.0.jar:na]
	at com.google.common.cache.LocalCache.get(LocalCache.java:3934) ~[guava-16.0.jar:na]
	at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938) ~[guava-16.0.jar:na]
	at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821) ~[guava-16.0.jar:na]
	at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4827) ~[guava-16.0.jar:na]
	at springfox.documentation.spring.web.scanners.CachingOperationReader.read(CachingOperationReader.java:57) ~[springfox-spring-web-2.6.1.jar:2.6.1]
	at springfox.documentation.spring.web.scanners.ApiDescriptionReader.read(ApiDescriptionReader.java:66) ~[springfox-spring-web-2.6.1.jar:2.6.1]
	at springfox.documentation.spring.web.scanners.ApiListingScanner.scan(ApiListingScanner.java:89) ~[springfox-spring-web-2.6.1.jar:2.6.1]
	at springfox.documentation.spring.web.scanners.ApiDocumentationScanner.scan(ApiDocumentationScanner.java:70) ~[springfox-spring-web-2.6.1.jar:2.6.1]
	at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.scanDocumentation(DocumentationPluginsBootstrapper.java:85) ~[springfox-spring-web-2.6.1.jar:2.6.1]
	at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.start(DocumentationPluginsBootstrapper.java:127) ~[springfox-spring-web-2.6.1.jar:2.6.1]
	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
	... 19 common frames omitted
Caused by: java.lang.NoClassDefFoundError: com/google/common/base/MoreObjects
	at springfox.documentation.swagger.readers.operation.OperationImplicitParameterReader.maybeGetModelRef(OperationImplicitParameterReader.java:74) ~[springfox-swagger-common-2.6.1.jar:2.6.1]
	at springfox.documentation.swagger.readers.operation.OperationImplicitParameterReader.implicitParameter(OperationImplicitParameterReader.java:59) ~[springfox-swagger-common-2.6.1.jar:2.6.1]
	at springfox.documentation.swagger.readers.operation.OperationImplicitParameterReader.readParameters(OperationImplicitParameterReader.java:89) ~[springfox-swagger-common-2.6.1.jar:2.6.1]
	at springfox.documentation.swagger.readers.operation.OperationImplicitParameterReader.apply(OperationImplicitParameterReader.java:50) ~[springfox-swagger-common-2.6.1.jar:2.6.1]
	at springfox.documentation.spring.web.plugins.DocumentationPluginsManager.operation(DocumentationPluginsManager.java:123) ~[springfox-spring-web-2.6.1.jar:2.6.1]
	at springfox.documentation.spring.web.readers.operation.ApiOperationReader.read(ApiOperationReader.java:73) ~[springfox-spring-web-2.6.1.jar:2.6.1]
	at springfox.documentation.spring.web.scanners.CachingOperationReader$1.load(CachingOperationReader.java:50) ~[springfox-spring-web-2.6.1.jar:2.6.1]
	at springfox.documentation.spring.web.scanners.CachingOperationReader$1.load(CachingOperationReader.java:48) ~[springfox-spring-web-2.6.1.jar:2.6.1]
	at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524) ~[guava-16.0.jar:na]
	at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317) ~[guava-16.0.jar:na]
	at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280) ~[guava-16.0.jar:na]
	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195) ~[guava-16.0.jar:na]
	... 30 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.google.common.base.MoreObjects
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_152]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_152]
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338) ~[na:1.8.0_152]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_152]
	... 42 common frames omitted

  看到这一句,经过查询,发现是改报错原因是缺少包,但是我项目中使用的maven,这个包是有的,但是看了一下,JAVA_HOME目录下的/jre/lib/ext目录下是没有guava-23.0.jar这个包,从网上下载这个包复制到ext目录下重新启动程序就好了。

原文地址:https://www.cnblogs.com/Gxiaobai/p/10427583.html

时间: 2024-10-03 20:32:34

Caused by: java.lang.NoClassDefFoundError: com/google/common/base/MoreObjects的相关文章

Selenium 运行时出现错误(java.lang.NoClassDefFoundError: com/google/common/base/Function)

已经写好了java脚本,点击运行的过程中如果出现如下的错误提示时: java.lang.NoClassDefFoundError: com/google/common/base/Function 问题出现的原因是: 没有将Selenium server的相关包导入到“Referenced Libraries”中: 可以使用如下的方法解决这个问题: 将鼠标放到已经创建好的Project上,右键点击 -->“Build Path”-->"Configure Build Path"

浏览器启动不起来java.lang.NoClassDefFoundError: com/google/common/base/Function

java.lang.NoClassDefFoundError: com/google/common/base/Function 原因:只有以下两个包 解决方案:导入 selenium-server-standalone-2.44.0.jar 如果报json错就还需要导入json包json-20080701.jar

Caused by: java.lang.NoClassDefFoundError: com/tansuosoft/discoverx/common/Config

1.错误描述 Caused by: java.lang.NoClassDefFoundError: com/tansuosoft/discoverx/common/Config at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(Se

异常:Caused by: java.lang.NoClassDefFoundError: Could not initialize class net.sf.log4jdbc.Properties

参考文章: 使用Log4jdbc-log4j2监听MyBatis中运行的SQL和Connection 使用 log4jdbc格式化输出SQL,maven配置如下: <dependency> <groupId>org.bgee.log4jdbc-log4j2</groupId> <artifactId>log4jdbc-log4j2-jdbc4</artifactId> <version>1.16</version> <

从无到有构建大型电商微服务架构(一),eclipse构建springcloud消费者方引起的问题(Caused by: java.lang.NoClassDefFoundError: feign/Feign$Builder)

1 2018-12-31 14:28:38.180 INFO 37860 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.spring[email protected]a9cd3b1: startup date [Mon Dec 31 14:28:38 CST 2018]; root of context hierarchy 2 2018-12-31 14:28:38.519 INFO 37860 ---

Caused by: java.lang.NoClassDefFoundError:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'identityService': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [com.example.new_oa.identity.se

Caused by: java.lang.NoClassDefFoundError: javax/servlet/ServletContext

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.linewell.wechat.WechatApplication]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class org.spri

Eclipse中使用recyclerview时出现Caused by: java.lang.NoClassDefFoundError: android.support.v7.recyclerview.R$styleable

转自: http://blog.csdn.net/chenleicpp/article/details/46848785 程序崩溃,错误提示: Caused by: java.lang.NoClassDefFoundError: android.support.v7.recyclerview.R$styleable 原因: 在eclipse中使用RecyclerView,编译没有问题,但是运行时候会出现如下错误,百思不得其解,又说v4包与v7包版本不一致,有说没有导入v7-compat包的,经反

多线程AsyncTask中使用Jsoup 报错Caused by: java.lang.NoClassDefFoundError: org.jsoup.Jsoup

代码如下,在多线程AsyncTask类中的doInBackground调用Jsoup protected String doInBackground(String... params) { // TODO Auto-generated method stub Log.i(TAG, "doInBackground(Params... params) called"); try { Document doc=Jsoup.connect(params[0]).get(); Elements