Guest User

Untitled

a guest
Dec 9th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.63 KB | None | 0 0
  1. apply plugin: 'java-library'
  2.  
  3. repositories {
  4. jcenter()
  5. }
  6.  
  7. dependencies {
  8.  
  9. // https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web
  10. compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.1.0.RELEASE'
  11. // https://mvnrepository.com/artifact/org.springframework.kafka/spring-kafka
  12. compile group: 'org.springframework.kafka', name: 'spring-kafka', version: '2.2.0.RELEASE'
  13. // https://mvnrepository.com/artifact/commons-logging/commons-logging
  14. compile group: 'commons-logging', name: 'commons-logging', version: '1.2'
  15. // https://mvnrepository.com/artifact/org.springframework.retry/spring-retry
  16. compile group: 'org.springframework.retry', name: 'spring-retry', version: '1.2.0.RELEASE'
  17.  
  18. }
  19.  
  20. import org.springframework.context.annotation.Configuration;
  21. import org.springframework.retry.annotation.EnableRetry;
  22.  
  23. @Configuration
  24. @EnableRetry
  25. public class RetryConfig {
  26.  
  27. }
  28.  
  29. @Service
  30. public class RetryService {
  31.  
  32. @Retryable(value = { CustomException.class }, maxAttempts = 2, backoff = @Backoff(delay=1000))
  33. public Optional<String> requestOne(int value){
  34. if(value ==1) {
  35. throw new CustomException();
  36. }
  37. return Optional.of(" request one method");
  38. }
  39.  
  40. @Retryable(value = { CustomException.class }, maxAttempts = 2, backoff = @Backoff(delay=1000))
  41. public Optional<Integer> requestTwo(int value){
  42. if(value ==1) {
  43. throw new CustomException();
  44. }
  45. return Optional.of(1);
  46. }
  47.  
  48. @Recover
  49. public Optional<String> recovery(CustomException ex, int value){
  50. return Optional.of(" recovery method ");
  51. }
  52.  
  53. }
  54.  
  55. 2018-12-09 22:56:18.951 WARN 32113 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt:
  56. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyCreator': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Pointcut
  57. 2018-12-09 22:56:18.961 INFO 32113 --- [ main] ConditionEvaluationReportLoggingListener :
  58.  
  59. Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
  60. 2018-12-09 22:56:18.968 ERROR 32113 --- [ main] o.s.boot.SpringApplication : Application run failed
  61. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyCreator': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Pointcut
  62. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:584) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
  63. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
  64. at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
  65. at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
  66. at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
  67. at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
  68. at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:228) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]
  69. at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:707) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]
  70. at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]
  71. at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
  72. at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
  73. at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
  74. at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
  75. at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
  76. at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.0.RELEASE.jar:2.1.0.RELEASE]
  77. at com.mtpc.MtpcMain.main(MtpcMain.java:10) [bin/:na]
  78. Caused by: java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Pointcut
  79. at org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactory.<clinit>(AbstractAspectJAdvisorFactory.java:62) ~[spring-aop-5.1.2.RELEASE.jar:5.1.2.RELEASE]
  80. at org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator.initBeanFactory(AnnotationAwareAspectJAutoProxyCreator.java:82) ~[spring-aop-5.1.2.RELEASE.jar:5.1.2.RELEASE]
  81. at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.setBeanFactory(AbstractAdvisorAutoProxyCreator.java:63) ~[spring-aop-5.1.2.RELEASE.jar:5.1.2.RELEASE]
  82. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1767) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
  83. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1732) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
  84. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:576) ~[spring-beans-5.1.2.RELEASE.jar:5.1.2.RELEASE]
  85. ... 15 common frames omitted
  86.  
  87. Caused by: java.lang.ClassNotFoundException: org.aspectj.lang.annotation.Pointcut
  88. at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_191]
  89. at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_191]
  90. at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) ~[na:1.8.0_191]
  91. at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_191]
  92. ... 21 common frames omitted
Add Comment
Please, Sign In to add comment