ChoyRunYu / secondkill

毕业设计-基于微服务的商城秒杀系统
20 stars 6 forks source link

部署时候, mvn clean package报错:java.lang.ClassNotFoundException: com.google.common.collect.ImmutableSet #1

Open jiangp000 opened 10 months ago

jiangp000 commented 10 months ago

[root@iZbp184qdnos2yeyeudm7bZ secondkill]# mvn clean package

constituent[0]: file:/usr/share/maven/conf/logging/ constituent[1]: file:/usr/share/maven/lib/guice-4.2.1-no_aop.jar constituent[2]: file:/usr/share/maven/lib/maven-resolver-provider-3.6.2.jar constituent[3]: file:/usr/share/maven/lib/maven-core-3.6.2.jar constituent[4]: file:/usr/share/maven/lib/jsr250-api-1.0.jar constituent[5]: file:/usr/share/maven/lib/maven-resolver-transport-wagon-1.4.1.jar constituent[6]: file:/usr/share/maven/lib/maven-slf4j-provider-3.6.2.jar constituent[7]: file:/usr/share/maven/lib/commons-cli-1.4.jar constituent[8]: file:/usr/share/maven/lib/jboss-interceptors-api_1.2_spec-any.jar constituent[9]: file:/usr/share/maven/lib/plexus-component-annotations-2.0.0.jar constituent[10]: file:/usr/share/maven/lib/plexus-sec-dispatcher-1.4.jar constituent[11]: file:/usr/share/maven/lib/maven-resolver-spi-1.4.1.jar constituent[12]: file:/usr/share/maven/lib/maven-repository-metadata-3.6.2.jar constituent[13]: file:/usr/share/maven/lib/maven-embedder-3.6.2.jar constituent[14]: file:/usr/share/maven/lib/maven-model-builder-3.6.2.jar constituent[15]: file:/usr/share/maven/lib/commons-codec-1.11.jar constituent[16]: file:/usr/share/maven/lib/javax.inject-1.jar constituent[17]: file:/usr/share/maven/lib/maven-shared-utils-3.2.1.jar constituent[18]: file:/usr/share/maven/lib/maven-artifact-3.6.2.jar constituent[19]: file:/usr/share/maven/lib/plexus-utils-3.2.1.jar constituent[20]: file:/usr/share/maven/lib/maven-resolver-api-1.4.1.jar constituent[21]: file:/usr/share/maven/lib/jcl-over-slf4j-1.7.25.jar constituent[22]: file:/usr/share/maven/lib/maven-settings-builder-3.6.2.jar constituent[23]: file:/usr/share/maven/lib/wagon-http-3.3.3.jar constituent[24]: file:/usr/share/maven/lib/wagon-file-3.3.3.jar constituent[25]: file:/usr/share/maven/lib/javax.el-api-3.0.0.jar constituent[26]: file:/usr/share/maven/lib/plexus-interpolation-1.25.jar constituent[27]: file:/usr/share/maven/lib/org.eclipse.sisu.inject-0.3.3.jar constituent[28]: file:/usr/share/maven/lib/wagon-provider-api-3.3.3.jar constituent[29]: file:/usr/share/maven/lib/maven-plugin-api-3.6.2.jar constituent[30]: file:/usr/share/maven/lib/maven-builder-support-3.6.2.jar constituent[31]: file:/usr/share/maven/lib/maven-resolver-impl-1.4.1.jar constituent[32]: file:/usr/share/maven/lib/maven-resolver-connector-basic-1.4.1.jar constituent[33]: file:/usr/share/maven/lib/httpclient-4.5.9.jar constituent[34]: file:/usr/share/maven/lib/slf4j-api-1.7.25.jar constituent[35]: file:/usr/share/maven/lib/jsoup-1.12.1.jar constituent[36]: file:/usr/share/maven/lib/maven-resolver-util-1.4.1.jar constituent[37]: file:/usr/share/maven/lib/maven-compat-3.6.2.jar constituent[38]: file:/usr/share/maven/lib/jansi-1.17.1.jar constituent[39]: file:/usr/share/maven/lib/wagon-http-shared-3.3.4.jar constituent[40]: file:/usr/share/maven/lib/httpcore-4.4.11.jar constituent[41]: file:/usr/share/maven/lib/commons-lang3-3.8.1.jar constituent[42]: file:/usr/share/maven/lib/org.eclipse.sisu.plexus-0.3.3.jar constituent[43]: file:/usr/share/maven/lib/maven-settings-3.6.2.jar constituent[44]: file:/usr/share/maven/lib/hawtjni-runtime-1.16.jar constituent[45]: file:/usr/share/maven/lib/guava-19.0.jar constituent[46]: file:/usr/share/maven/lib/commons-io-2.5.jar constituent[47]: file:/usr/share/maven/lib/maven-model-3.6.2.jar constituent[48]: file:/usr/share/maven/lib/plexus-cipher-1.7.jar constituent[49]: file:/usr/share/maven/lib/cdi-api-1.1.jar constituent[50]: file:/usr/share/maven/lib/jansi-native-1.8.jar

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableSet at com.google.inject.internal.Errors.(Errors.java:105) at com.google.inject.internal.InternalInjectorCreator.(InternalInjectorCreator.java:61) at com.google.inject.Guice.createInjector(Guice.java:87) at com.google.inject.Guice.createInjector(Guice.java:69) at com.google.inject.Guice.createInjector(Guice.java:59) at org.codehaus.plexus.DefaultPlexusContainer.addPlexusInjector(DefaultPlexusContainer.java:481) at org.codehaus.plexus.DefaultPlexusContainer.(DefaultPlexusContainer.java:206) at org.apache.maven.cli.MavenCli.container(MavenCli.java:635) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:281) at org.apache.maven.cli.MavenCli.main(MavenCli.java:192) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347) Caused by: java.lang.ClassNotFoundException: com.google.common.collect.ImmutableSet at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50) at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239) ... 18 more

—————————————————————————————————————————————————————— GPT提示:看起来你遇到了一个 java.lang.NoClassDefFoundError 异常,该异常指示在运行时找不到 com.google.common.collect.ImmutableSet 类。这通常是由于缺少 Google Guava 库引起的。

在 Maven 项目中,你可以通过将相关的 Maven 依赖项添加到你的 pom.xml 文件中来解决这个问题。在你的项目的 pom.xml 文件中添加以下依赖项:

但是添加完成之后,还是报错。

ChoyRunYu commented 5 months ago

这个guava是没有引入的,翻了下代码,应该是zuul的限流里面带了,我重新拉了下工程是没有问题的,你看看换个maven源试试看?