未找到类异常:2.3.4和log4j 2.13.3上的调用程序定位器

gcuhipw9  于 2022-11-06  发布在  其他
关注(0)|答案(2)|浏览(116)

我尝试使用Sping Boot 2.3.4.RELEASE(最新版本)运行log4j 2.13.3(最新版本),但在启动应用程序时出现以下错误:

  1. mix-data-collector_1 | ------------------------------------------------------------------------
  2. mix-data-collector_1 | OpenJDK 64-Bit Server VM warning: Ignoring option PermSize; support was removed in 8.0
  3. mix-data-collector_1 | DB update completed
  4. mix-data-collector_1 | DB migration finished
  5. mix-data-collector_1 | Start Mix Data Collector---------------------------------------------
  6. mix-data-collector_1 | Listening for transport dt_socket at address: 5555
  7. mix-data-collector_1 | Exception in thread "main" java.lang.reflect.InvocationTargetException
  8. mix-data-collector_1 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  9. mix-data-collector_1 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  10. mix-data-collector_1 | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  11. mix-data-collector_1 | at java.base/java.lang.reflect.Method.invoke(Method.java:566)
  12. mix-data-collector_1 | at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
  13. mix-data-collector_1 loader.Launcher.launch(Launcher.java:87)
  14. mix-data-collector_1 | at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
  15. mix-data-collector_1 | at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
  16. mix-data-collector_1 | Caused by: java.lang.NoClassDefFoundError: org/apache/logging/log4j/util/StackLocator$FqcnCallerLocator
  17. mix-data-collector_1 | at org.apache.logging.log4j.util.StackLocator.<clinit>(StackLocator.java:37)
  18. mix-data-collector_1 | at org.apache.logging.log4j.util.StackLocatorUtil.<clinit>(StackLocatorUtil.java:33)
  19. mix-data-collector_1 | at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:133)
  20. mix-data-collector_1 | at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:228)
  21. mix-data-collector_1 | at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
  22. mix-data-collector_1 | at org.apache.logging.log4j.LogManager.getContext(LogManager.java:174)
  23. mix-data-collector_1 | at org.springframework.boot.logging.log4j2.Log4J2LoggingSystem.getLoggerContext(Log4J2LoggingSystem.java:305)
  24. mix-data-collector_1 | at org.springframework.boot.logging.log4j2.Log4J2LoggingSystem.beforeInitialize(Log4J2LoggingSystem.java:145)
  25. mix-data-collector_1 | at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationStartingEvent(LoggingApplicationListener.java:232)
  26. mix-data-collector_1 | at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:213)
  27. mix-data-collector_1 | at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
  28. mix-data-collector_1 | at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
  29. mix-data-collector_1 | at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
  30. mix-data-collector_1 | at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
  31. mix-data-collector_1 | at org.springframework.boot.context.event.EventPublishingRunListener.starting(EventPublishingRunListener.java:74)
  32. mix-data-collector_1 | at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:47)
  33. mix-data-collector_1 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:305)
  34. mix-data-collector_1 | at ch.sbb.esta.openshift.gracefullshutdown.GracefulshutdownSpringApplication.run(GracefulshutdownSpringApplication.java:21)
  35. mix-data-collector_1 | at com.nuance.core.mix.data.collector.Application.main(Application.java:38)
  36. mix-data-collector_1 | ... 8 more
  37. mix-data-collector_1 | Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.util.StackLocator$FqcnCallerLocator
  38. mix-data-collector_1 | at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
  39. mix-data-collector_1 | at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
  40. mix-data-collector_1 | at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:93)
  41. mix-data-collector_1 | at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
  42. mix-data-collector_1 | ... 27 more
  43. mix-data-collector_mix-data-collector_1 exited with code 1loader.Launcher.launch(Launcher.java:87)
  44. mix-data-collector_1 | at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
  45. mix-data-collector_1 | at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
  46. mix-data-collector_1 | Caused by: java.lang.NoClassDefFoundError: org/apache/logging/log4j/util/StackLocator$FqcnCallerLocator
  47. mix-data-collector_1 | at org.apache.logging.log4j.util.StackLocator.<clinit>(StackLocator.java:37)
  48. mix-data-collector_1 | at org.apache.logging.log4j.util.StackLocatorUtil.<clinit>(StackLocatorUtil.java:33)
  49. mix-data-collector_1 | at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:133)
  50. mix-data-collector_1 | at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:228)
  51. mix-data-collector_1 | at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
  52. mix-data-collector_1 | at org.apache.logging.log4j.LogManager.getContext(LogManager.java:174)
  53. mix-data-collector_1 | at org.springframework.boot.logging.log4j2.Log4J2LoggingSystem.getLoggerContext(Log4J2LoggingSystem.java:305)
  54. mix-data-collector_1 | at org.springframework.boot.logging.log4j2.Log4J2LoggingSystem.beforeInitialize(Log4J2LoggingSystem.java:145)
  55. mix-data-collector_1 | at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationStartingEvent(LoggingApplicationListener.java:232)
  56. mix-data-collector_1 | at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:213)
  57. mix-data-collector_1 | at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
  58. mix-data-collector_1 | at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
  59. mix-data-collector_1 | at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
  60. mix-data-collector_1 | at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
  61. mix-data-collector_1 | at org.springframework.boot.context.event.EventPublishingRunListener.starting(EventPublishingRunListener.java:74)
  62. mix-data-collector_1 | at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:47)
  63. mix-data-collector_1 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:305)
  64. mix-data-collector_1 | at ch.sbb.esta.openshift.gracefullshutdown.GracefulshutdownSpringApplication.run(GracefulshutdownSpringApplication.java:21)
  65. mix-data-collector_1 | at com.nuance.core.mix.data.collector.Application.main(Application.java:38)
  66. mix-data-collector_1 | ... 8 more
  67. mix-data-collector_1 | Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.util.StackLocator$FqcnCallerLocator
  68. mix-data-collector_1 | at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
  69. mix-data-collector_1 | at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
  70. mix-data-collector_1 | at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:93)
  71. mix-data-collector_1 | at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
  72. mix-data-collector_1 | ... 27 more
  73. mix-data-collector_mix-data-collector_1 exited with code 1

我的Maven依赖项如下所示:

  1. <dependency>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-starter-web</artifactId>
  4. <exclusions>
  5. <exclusion>
  6. <groupId>org.springframework.boot</groupId>
  7. <artifactId>spring-boot-starter-logging</artifactId>
  8. </exclusion>
  9. </exclusions>
  10. </dependency>
  11. <dependency>
  12. <groupId>org.springframework.boot</groupId>
  13. <artifactId>spring-boot-starter-log4j2</artifactId>
  14. </dependency>
  15. <dependency>
  16. <groupId>org.apache.logging.log4j</groupId>
  17. <artifactId>log4j-api</artifactId>
  18. <version>${log4j.version}</version>
  19. </dependency>
  20. <dependency>
  21. <groupId>org.apache.logging.log4j</groupId>
  22. <artifactId>log4j-core</artifactId>
  23. <version>${log4j.version}</version>
  24. </dependency>

在log4j 2.11.2版本中,应用程序启动正常(所以在最新的log4j版本中有一些改变),但我需要转移到2.13.3版本,以减轻一些安全问题。
谢谢你
最新依赖项:

xzabzqsa

xzabzqsa1#

好的,我已经找到我的问题了。似乎还有一个spring maven插件依赖导致了这个问题。谢谢你的帮助

csbfibhn

csbfibhn2#

我已经通过将log4j-code依赖关系升级到2.14.1版解决了同样的问题

相关问题