Spring Boot Sping Boot 创建名为Bean时出错:无法从classloader内省类

vm0i2vca  于 2024-01-06  发布在  Spring
关注(0)|答案(1)|浏览(277)

我正在开发一个Sping Boot Web应用程序。在应用程序中,我已经实现了Stripe支付网关。我的应用程序在本地机器上工作正常,但当我将Web应用程序部署到Apache Web服务器时,我得到了下面的错误:

  1. ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stripeService': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [wing.rakhi.ecdl.service.StripeService] from ClassLoader [ParallelWebappClassLoader
  2. context: ecdl
  3. delegate: false
  4. ----------> Parent Classloader:
  5. java.net.URLClassLoader@65b54208
  6. ]
  7. 2022-04-01 04:27:16.990 INFO 50409 --- [ost-startStop-1] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
  8. 2022-04-01 04:27:16.994 INFO 50409 --- [ost-startStop-1] com.zaxxer.hikari.HikariDataSource : HikariPool-3 - Shutdown initiated...
  9. 2022-04-01 04:27:17.009 INFO 50409 --- [ost-startStop-1] com.zaxxer.hikari.HikariDataSource : HikariPool-3 - Shutdown completed.
  10. 2022-04-01 04:27:17.026 INFO 50409 --- [ost-startStop-1] ConditionEvaluationReportLoggingListener :
  11. Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
  12. 2022-04-01 04:27:17.034 ERROR 50409 --- [ost-startStop-1] o.s.boot.SpringApplication : Application run failed
  13. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stripeService': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [wing.rakhi.ecdl.service.StripeService] from ClassLoader [ParallelWebappClassLoader
  14. context: ecdl
  15. delegate: false
  16. ----------> Parent Classloader:
  17. java.net.URLClassLoader@65b54208
  18. ]
  19. at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:265) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
  20. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1269) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
  21. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1184) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
  22. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
  23. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
  24. at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
  25. at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
  26. at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
  27. at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
  28. at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:845) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
  29. at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
  30. at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
  31. at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
  32. at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:743) ~[spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
  33. at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:390) ~[spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
  34. at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
  35. at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:151) [spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
  36. at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:131) [spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
  37. at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:91) [spring-boot-2.1.7.RELEASE.jar:2.1.7.RELEASE]
  38. at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:171) [spring-web-5.1.9.RELEASE.jar:5.1.9.RELEASE]
  39. at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5225) [catalina.jar:8.5.40]
  40. at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:8.5.40]
  41. at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754) [catalina.jar:8.5.40]
  42. at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730) [catalina.jar:8.5.40]
  43. at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) [catalina.jar:8.5.40]
  44. at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1135) [catalina.jar:8.5.40]
  45. at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1869) [catalina.jar:8.5.40]
  46. at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_272]
  47. at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_272]
  48. at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_272]
  49. at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_272]
  50. at java.lang.Thread.run(Thread.java:748) [na:1.8.0_272]
  51. Caused by: java.lang.IllegalStateException: Failed to introspect Class [wing.rakhi.ecdl.service.StripeService] from ClassLoader [ParallelWebappClassLoader
  52. context: ecdl
  53. delegate: false
  54. ----------> Parent Classloader:
  55. java.net.URLClassLoader@65b54208
  56. ]
  57. at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:507) ~[spring-core-5.1.9.RELEASE.jar:5.1.9.RELEASE]
  58. at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:404) ~[spring-core-5.1.9.RELEASE.jar:5.1.9.RELEASE]
  59. at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:389) ~[spring-core-5.1.9.RELEASE.jar:5.1.9.RELEASE]
  60. at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:248) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
  61. ... 31 common frames omitted
  62. Caused by: java.lang.NoClassDefFoundError: com/stripe/model/PaymentIntent
  63. at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_272]
  64. at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_272]
  65. at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[na:1.8.0_272]
  66. at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:489) ~[spring-core-5.1.9.RELEASE.jar:5.1.9.RELEASE]
  67. ... 34 common frames omitted
  68. Caused by: java.lang.ClassNotFoundException: com.stripe.model.PaymentIntent
  69. at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1364) ~[catalina.jar:8.5.40]
  70. at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1185) ~[catalina.jar:8.5.40]
  71. ... 38 common frames omitted
  72. 01-Apr-2022 04:27:17.035 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
  73. org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ecdl]]
  74. at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
  75. at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754)
  76. at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)
  77. at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
  78. at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1135)
  79. at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1869)
  80. at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  81. at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  82. at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  83. at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  84. at java.lang.Thread.run(Thread.java:748)
  85. Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stripeService': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [wing.rakhi.ecdl.service.StripeService] from ClassLoader [ParallelWebappClassLoader
  86. context: ecdl
  87. delegate: false
  88. ----------> Parent Classloader:
  89. java.net.URLClassLoader@65b54208
  90. ]
  91. at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:265)
  92. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1269)
  93. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1184)
  94. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
  95. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
  96. at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
  97. at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
  98. at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
  99. at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
  100. at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:845)
  101. at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877)
  102. at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
  103. at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
  104. at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:743)
  105. at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:390)
  106. at org.springframework.boot.SpringApplication.run(SpringApplication.java:312)
  107. at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:151)
  108. at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:131)
  109. at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:91)
  110. at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:171)
  111. at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5225)
  112. at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  113. ... 10 more
  114. Caused by: java.lang.IllegalStateException: Failed to introspect Class [wing.rakhi.ecdl.service.StripeService] from ClassLoader [ParallelWebappClassLoader
  115. context: ecdl
  116. delegate: false
  117. ----------> Parent Classloader:
  118. java.net.URLClassLoader@65b54208
  119. ]
  120. at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:507)
  121. at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:404)
  122. at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:389)
  123. at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:248)
  124. ... 31 more
  125. Caused by: java.lang.NoClassDefFoundError: com/stripe/model/PaymentIntent
  126. at java.lang.Class.getDeclaredMethods0(Native Method)
  127. at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
  128. at java.lang.Class.getDeclaredMethods(Class.java:1975)
  129. at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:489)
  130. ... 34 more
  131. Caused by: java.lang.ClassNotFoundException: com.stripe.model.PaymentIntent
  132. at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1364)
  133. at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1185)
  134. ... 38 more
  135. 01-Apr-2022 04:27:17.037 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Error deploying web application directory [/home/tomcat/webapps/ecdl]
  136. java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ecdl]]
  137. at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:758)
  138. at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)
  139. at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
  140. at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1135)
  141. at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1869)
  142. at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  143. at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  144. at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  145. at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  146. at java.lang.Thread.run(Thread.java:748)

字符串
我还在我的pom.xml文件中添加了下面的stripe依赖:

  1. <dependency>
  2. <groupId>com.stripe</groupId>
  3. <artifactId>stripe-java</artifactId>
  4. <version>20.94.0</version>
  5. </dependency>

我应该怎么做才能运行我的应用程序?请提供一些解决方案。

ffdz8vbo

ffdz8vbo1#

这可能是因为你的项目可能会使用一些依赖项目快速只是maven再次安装项目,然后运行希望它可能会解决你的问题!

相关问题