Popular New Releases in Aspect Oriented
framework
Version 3.0.0
AspectCore-Framework
v2.2.0-release
XAOP
发布1.1.0版本,全面支持androidx
mzt-biz-log
2.0.0
aspect-injector
2.7.3-pre1
Popular Libraries in Aspect Oriented
by alibaba java
4365
dexposed enable 'god' mode for single android application.
by anjoy8 csharp
3261 Apache-2.0
💖 ASP.NET Core 5.0 全家桶教程,前后端分离后端接口,vue教程姊妹篇,官方文档:
by tiann java
3093 NOASSERTION
Dynamic java method AOP hook for Android(continution of Dexposed on ART), Supporting 5.0~11
by biezhi html
2886
:banana: 我的技术摘要
by tiann java
2458 Apache-2.0
demos to help understand plugin framwork
by nutzam java
2427 Apache-2.0
Nutz -- Web Framework(Mvc/Ioc/Aop/Dao/Json) for ALL Java developer
by fuzhengwei java
1925 Apache-2.0
🌱《 Spring 手撸专栏》,本专栏以 Spring 源码学习为目的,通过手写简化版 Spring 框架,了解 Spring 核心原理。在手写的过程中会简化 Spring 源码,摘取整体框架中的核心逻辑,简化代码实现过程,保留核心功能,例如:IOC、AOP、Bean生命周期、上下文、作用域、资源处理等内容实现。
by xwjie java
1890
给部门制定的代码框架模板
by goaop php
1542 MIT
:gem: Go! AOP PHP - modern aspect-oriented framework for the new level of software development
Trending New libraries in Aspect Oriented
by fuzhengwei java
1925 Apache-2.0
🌱《 Spring 手撸专栏》,本专栏以 Spring 源码学习为目的,通过手写简化版 Spring 框架,了解 Spring 核心原理。在手写的过程中会简化 Spring 源码,摘取整体框架中的核心逻辑,简化代码实现过程,保留核心功能,例如:IOC、AOP、Bean生命周期、上下文、作用域、资源处理等内容实现。
by mouzt java
550 Apache-2.0
支持Springboot,基于注解的可使用变量、可以自定义函数的通用操作日志组件
by 91270 csharp
379 Apache-2.0
.NET 5 / .NET Core 3.1 WebAPI + Vue 2.0 + RBAC 企业级前后端分离权限框架
by canyie java
218
Dynamic java method hook framework on ART.
by fast-light java
69 MIT
🚀 lightweight, high-performance AOP framework based on Java Annotation Processing, similar to Lombok
by liangbaika java
62 Apache-2.0
validate-springboot-stater , 与spring框架无缝集成的验证框架
by fatihsahin3 csharp
43
by fs7744 csharp
35 MIT
A dynamic weaving aop framework base on Emit
by ozgurkara python
32
Python clean architecture and usecase implementation with fastapi and pydiator-core
Top Authors in Aspect Oriented
1
6 Libraries
1710
2
4 Libraries
120
3
3 Libraries
291
4
3 Libraries
287
5
3 Libraries
27
6
2 Libraries
5
7
2 Libraries
5551
8
2 Libraries
4487
9
2 Libraries
9
10
2 Libraries
24
1
6 Libraries
1710
2
4 Libraries
120
3
3 Libraries
291
4
3 Libraries
287
5
3 Libraries
27
6
2 Libraries
5
7
2 Libraries
5551
8
2 Libraries
4487
9
2 Libraries
9
10
2 Libraries
24
Trending Kits in Aspect Oriented
No Trending Kits are available at this moment for Aspect Oriented
Trending Discussions on Aspect Oriented
@Recover method not intercepted by Spring AOP advice
I get java.lang.ClassNotFoundException: org.springframework.web.context.WebApplicationContext at Tomcat webb app
Is it Possible to add PostSharp for dynamic compilation using c# compiler
Check User Authorization with Aspect Oriented Programming in Asp.Net Core 3.1 Web Api
Install AspectJ Eclipse
QUESTION
@Recover method not intercepted by Spring AOP advice
Asked 2021-Jun-08 at 03:45While writing code using Spring/Java and Aspect oriented programing, I'm facing an issue. In the service class, I have the retry method using @Retryable and a recovery method using @Recover.
Each of these 2 methods are attached to Aspects. The Retryable method - "triggerJob" inside TestProcessService is attached to these methods in TestAspect class - beforeTestTriggerJobsAdvice, afterTestTriggerJobsAdvice, onErrorTestTriggerJobsAdvice. They all are working fine and getting triggered at the right time.
PROBLEM STATEMENT: The Recovery method - "recover" inside TestProcessService is attached to these methods in TestAspect class - beforeRecoveryTestJobsAdvice, onErrorRecoveryTestTriggerJobsAdvice, and afterRecoveryTestTriggerJobsAdvice.
BUT NONE OF THESE ASPECT METHODS ARE GETTING CALLED once the code reached the recover method inside TestProcessService.
Here is the code:
SCHEDULER CLASS (triggers the methods inside TEST_MyProcessService class at regular interval)
1@Slf4j
2@Component
3public class TEST_ScheduledProcessPoller {
4
5 private final TEST_MyProcessService MyProcessService;
6 private final MyServicesConfiguration MyServicesConfiguration;
7
8 public TEST_ScheduledProcessPoller(TEST_MyProcessService MyProcessService,
9 MyServicesConfiguration MyServicesConfiguration) {
10 this.MyProcessService = MyProcessService;
11 this.MyServicesConfiguration = MyServicesConfiguration;
12 }
13
14 @Scheduled(cron = "0 0/2 * * * *")
15 public void scheduleTaskWithFixedDelay() {
16 try {
17 log.info("scheduleTaskWithFixedDelay");
18 this.triggerMyJobs(true);
19 } catch (Exception e) {
20 log.error(e.getMessage());
21 }
22 }
23
24 protected void triggerMyJobs(boolean isDaily) throws Exception {
25 log.info("triggerMyJobs");
26 MyServiceType serviceType = this.MyServicesConfiguration.getMy();
27 this.MyProcessService.triggerJob(serviceType, isDaily, 1L);
28 }
29}
30
SERVICE CLASS:
1@Slf4j
2@Component
3public class TEST_ScheduledProcessPoller {
4
5 private final TEST_MyProcessService MyProcessService;
6 private final MyServicesConfiguration MyServicesConfiguration;
7
8 public TEST_ScheduledProcessPoller(TEST_MyProcessService MyProcessService,
9 MyServicesConfiguration MyServicesConfiguration) {
10 this.MyProcessService = MyProcessService;
11 this.MyServicesConfiguration = MyServicesConfiguration;
12 }
13
14 @Scheduled(cron = "0 0/2 * * * *")
15 public void scheduleTaskWithFixedDelay() {
16 try {
17 log.info("scheduleTaskWithFixedDelay");
18 this.triggerMyJobs(true);
19 } catch (Exception e) {
20 log.error(e.getMessage());
21 }
22 }
23
24 protected void triggerMyJobs(boolean isDaily) throws Exception {
25 log.info("triggerMyJobs");
26 MyServiceType serviceType = this.MyServicesConfiguration.getMy();
27 this.MyProcessService.triggerJob(serviceType, isDaily, 1L);
28 }
29}
30@Slf4j
31@Service
32public class TEST_MyProcessService {
33
34 @Retryable(maxAttemptsExpression = "${api.retry.limit}", backoff = @Backoff(delayExpression = "${api.retry.max-interval}"))
35 public void triggerJob(MyServiceType MyServiceType, boolean isDaily, long eventId) {
36 // Some code here that can throw exceptions.
37 log.info("triggerJob");
38 throw new RuntimeException("triggerJob");
39 }
40
41 @Recover
42 public void recover(MyServiceType MyServiceType, boolean isDaily, long eventId) {
43 log.info("recover");
44 // Some code here that can throw exceptions.
45 throw new RuntimeException();
46 }
47}
48
ASPECT CLASS:
1@Slf4j
2@Component
3public class TEST_ScheduledProcessPoller {
4
5 private final TEST_MyProcessService MyProcessService;
6 private final MyServicesConfiguration MyServicesConfiguration;
7
8 public TEST_ScheduledProcessPoller(TEST_MyProcessService MyProcessService,
9 MyServicesConfiguration MyServicesConfiguration) {
10 this.MyProcessService = MyProcessService;
11 this.MyServicesConfiguration = MyServicesConfiguration;
12 }
13
14 @Scheduled(cron = "0 0/2 * * * *")
15 public void scheduleTaskWithFixedDelay() {
16 try {
17 log.info("scheduleTaskWithFixedDelay");
18 this.triggerMyJobs(true);
19 } catch (Exception e) {
20 log.error(e.getMessage());
21 }
22 }
23
24 protected void triggerMyJobs(boolean isDaily) throws Exception {
25 log.info("triggerMyJobs");
26 MyServiceType serviceType = this.MyServicesConfiguration.getMy();
27 this.MyProcessService.triggerJob(serviceType, isDaily, 1L);
28 }
29}
30@Slf4j
31@Service
32public class TEST_MyProcessService {
33
34 @Retryable(maxAttemptsExpression = "${api.retry.limit}", backoff = @Backoff(delayExpression = "${api.retry.max-interval}"))
35 public void triggerJob(MyServiceType MyServiceType, boolean isDaily, long eventId) {
36 // Some code here that can throw exceptions.
37 log.info("triggerJob");
38 throw new RuntimeException("triggerJob");
39 }
40
41 @Recover
42 public void recover(MyServiceType MyServiceType, boolean isDaily, long eventId) {
43 log.info("recover");
44 // Some code here that can throw exceptions.
45 throw new RuntimeException();
46 }
47}
48@Component
49@Slf4j
50public class TEST_MyAspect {
51
52 @Pointcut("execution(* packgName.otherProj.services.TEST_MyProcessService.triggerJob(..))")
53 public void MyTriggerJobs() {
54 }
55
56 @Pointcut("execution(* packgName.otherProj.services.TEST_MyProcessService.recover(..))")
57 public void MyRecoverJobs() {
58 }
59
60 @Before("MyTriggerJobs()")
61 public void beforeMyTriggerJobsAdvice(JoinPoint joinPoint) {
62 log.info("log beforeMyTriggerJobsAdvice");
63 }
64
65 @AfterReturning("MyTriggerJobs()")
66 public void afterMyTriggerJobsAdvice(JoinPoint joinPoint) {
67 log.info("log afterMyTriggerJobsAdvice");
68 }
69
70 @AfterThrowing(value = "MyTriggerJobs()", throwing = "error")
71 public void onErrorMyTriggerJobsAdvice(JoinPoint joinPoint, Throwable error) {
72 log.info("log onErrorMyTriggerJobsAdvice");
73 }
74
75 @Before("MyRecoverJobs()")
76 public void beforeMyRecoverJobsAdvice(JoinPoint joinPoint) {
77 log.info("log beforeMyRecoverJobsAdvice");
78 }
79
80 @AfterThrowing(value = "MyRecoverJobs()", throwing = "error")
81 public void onErrorRecoveryMyTriggerJobsAdvice(JoinPoint joinPoint, Throwable error) {
82 log.info("log onErrorRecoveryMyTriggerJobsAdvice");
83 }
84
85
86 @AfterReturning("MyRecoverJobs()")
87 public void afterRecoveryMyTriggerJobsAdvice(JoinPoint joinPoint) {
88 log.info("log afterRecoveryMyTriggerJobsAdvice");
89 }
90}
91
92
LOG output:
1@Slf4j
2@Component
3public class TEST_ScheduledProcessPoller {
4
5 private final TEST_MyProcessService MyProcessService;
6 private final MyServicesConfiguration MyServicesConfiguration;
7
8 public TEST_ScheduledProcessPoller(TEST_MyProcessService MyProcessService,
9 MyServicesConfiguration MyServicesConfiguration) {
10 this.MyProcessService = MyProcessService;
11 this.MyServicesConfiguration = MyServicesConfiguration;
12 }
13
14 @Scheduled(cron = "0 0/2 * * * *")
15 public void scheduleTaskWithFixedDelay() {
16 try {
17 log.info("scheduleTaskWithFixedDelay");
18 this.triggerMyJobs(true);
19 } catch (Exception e) {
20 log.error(e.getMessage());
21 }
22 }
23
24 protected void triggerMyJobs(boolean isDaily) throws Exception {
25 log.info("triggerMyJobs");
26 MyServiceType serviceType = this.MyServicesConfiguration.getMy();
27 this.MyProcessService.triggerJob(serviceType, isDaily, 1L);
28 }
29}
30@Slf4j
31@Service
32public class TEST_MyProcessService {
33
34 @Retryable(maxAttemptsExpression = "${api.retry.limit}", backoff = @Backoff(delayExpression = "${api.retry.max-interval}"))
35 public void triggerJob(MyServiceType MyServiceType, boolean isDaily, long eventId) {
36 // Some code here that can throw exceptions.
37 log.info("triggerJob");
38 throw new RuntimeException("triggerJob");
39 }
40
41 @Recover
42 public void recover(MyServiceType MyServiceType, boolean isDaily, long eventId) {
43 log.info("recover");
44 // Some code here that can throw exceptions.
45 throw new RuntimeException();
46 }
47}
48@Component
49@Slf4j
50public class TEST_MyAspect {
51
52 @Pointcut("execution(* packgName.otherProj.services.TEST_MyProcessService.triggerJob(..))")
53 public void MyTriggerJobs() {
54 }
55
56 @Pointcut("execution(* packgName.otherProj.services.TEST_MyProcessService.recover(..))")
57 public void MyRecoverJobs() {
58 }
59
60 @Before("MyTriggerJobs()")
61 public void beforeMyTriggerJobsAdvice(JoinPoint joinPoint) {
62 log.info("log beforeMyTriggerJobsAdvice");
63 }
64
65 @AfterReturning("MyTriggerJobs()")
66 public void afterMyTriggerJobsAdvice(JoinPoint joinPoint) {
67 log.info("log afterMyTriggerJobsAdvice");
68 }
69
70 @AfterThrowing(value = "MyTriggerJobs()", throwing = "error")
71 public void onErrorMyTriggerJobsAdvice(JoinPoint joinPoint, Throwable error) {
72 log.info("log onErrorMyTriggerJobsAdvice");
73 }
74
75 @Before("MyRecoverJobs()")
76 public void beforeMyRecoverJobsAdvice(JoinPoint joinPoint) {
77 log.info("log beforeMyRecoverJobsAdvice");
78 }
79
80 @AfterThrowing(value = "MyRecoverJobs()", throwing = "error")
81 public void onErrorRecoveryMyTriggerJobsAdvice(JoinPoint joinPoint, Throwable error) {
82 log.info("log onErrorRecoveryMyTriggerJobsAdvice");
83 }
84
85
86 @AfterReturning("MyRecoverJobs()")
87 public void afterRecoveryMyTriggerJobsAdvice(JoinPoint joinPoint) {
88 log.info("log afterRecoveryMyTriggerJobsAdvice");
89 }
90}
91
922021-06-02 20:56:00.016 INFO [,60b7f0602b2ecb0deefc04d6840b6274,eefc04d6840b6274,true] 92605 --- [ scheduling-1] c.c.p.r.c.TEST_ScheduledProcessPoller : scheduleTaskWithFixedDelay
932021-06-02 20:56:00.016 INFO [,60b7f0602b2ecb0deefc04d6840b6274,eefc04d6840b6274,true] 92605 --- [ scheduling-1] c.c.p.r.c.TEST_ScheduledProcessPoller : triggerBdaJobs
942021-06-02 20:56:00.051 INFO [,60b7f0602b2ecb0deefc04d6840b6274,eefc04d6840b6274,true] 92605 --- [ scheduling-1] c.c.p.r.component.aspect.TEST_BdaAspect : log beforeBdaTriggerJobsAdvice
952021-06-02 20:56:00.060 INFO [,60b7f0602b2ecb0deefc04d6840b6274,eefc04d6840b6274,true] 92605 --- [ scheduling-1] c.c.p.r.services.TEST_BdaProcessService : triggerJob
962021-06-02 20:56:00.061 INFO [,60b7f0602b2ecb0deefc04d6840b6274,eefc04d6840b6274,true] 92605 --- [ scheduling-1] c.c.p.r.component.aspect.TEST_BdaAspect : log onErrorBdaTriggerJobsAdvice
972021-06-02 20:56:05.065 INFO [,60b7f0602b2ecb0deefc04d6840b6274,eefc04d6840b6274,true] 92605 --- [ scheduling-1] c.c.p.r.component.aspect.TEST_BdaAspect : log beforeBdaTriggerJobsAdvice
982021-06-02 20:56:05.066 INFO [,60b7f0602b2ecb0deefc04d6840b6274,eefc04d6840b6274,true] 92605 --- [ scheduling-1] c.c.p.r.services.TEST_BdaProcessService : triggerJob
992021-06-02 20:56:05.066 INFO [,60b7f0602b2ecb0deefc04d6840b6274,eefc04d6840b6274,true] 92605 --- [ scheduling-1] c.c.p.r.component.aspect.TEST_BdaAspect : log onErrorBdaTriggerJobsAdvice
1002021-06-02 20:56:10.070 INFO [,60b7f0602b2ecb0deefc04d6840b6274,eefc04d6840b6274,true] 92605 --- [ scheduling-1] c.c.p.r.component.aspect.TEST_BdaAspect : log beforeBdaTriggerJobsAdvice
1012021-06-02 20:56:10.070 INFO [,60b7f0602b2ecb0deefc04d6840b6274,eefc04d6840b6274,true] 92605 --- [ scheduling-1] c.c.p.r.services.TEST_BdaProcessService : triggerJob
1022021-06-02 20:56:10.070 INFO [,60b7f0602b2ecb0deefc04d6840b6274,eefc04d6840b6274,true] 92605 --- [ scheduling-1] c.c.p.r.component.aspect.TEST_BdaAspect : log onErrorBdaTriggerJobsAdvice
1032021-06-02 20:56:10.070 INFO [,60b7f0602b2ecb0deefc04d6840b6274,eefc04d6840b6274,true] 92605 --- [ scheduling-1] c.c.p.r.services.TEST_BdaProcessService : recover
1042021-06-02 20:56:10.070 ERROR [,60b7f0602b2ecb0deefc04d6840b6274,eefc04d6840b6274,true] 92605 --- [ scheduling-1] c.c.p.r.c.TEST_ScheduledProcessPoller : null
105
ANSWER
Answered 2021-Jun-08 at 03:45I am not a Spring user, but interested in all things AOP, both AspectJ and Spring AOP. I liked your little puzzle. Thanks to your MCVE, I was able to reproduce the issue and debug into it. This is a perfect example for why an MCVE is so much superior to simply posting a bunch of code snippets. So thanks for that, please keep up this way of asking questions.
When looking at the situation in a debugger, you see that while the aspect is proceeding into triggerJob
, at some point we are in method AnnotationAwareRetryOperationsInterceptor.invoke
and there we have the following code:
1@Slf4j
2@Component
3public class TEST_ScheduledProcessPoller {
4
5 private final TEST_MyProcessService MyProcessService;
6 private final MyServicesConfiguration MyServicesConfiguration;
7
8 public TEST_ScheduledProcessPoller(TEST_MyProcessService MyProcessService,
9 MyServicesConfiguration MyServicesConfiguration) {
10 this.MyProcessService = MyProcessService;
11 this.MyServicesConfiguration = MyServicesConfiguration;
12 }
13
14 @Scheduled(cron = "0 0/2 * * * *")
15 public void scheduleTaskWithFixedDelay() {
16 try {
17 log.info("scheduleTaskWithFixedDelay");
18 this.triggerMyJobs(true);
19 } catch (Exception e) {
20 log.error(e.getMessage());
21 }
22 }
23
24 protected void triggerMyJobs(boolean isDaily) throws Exception {
25 log.info("triggerMyJobs");
26 MyServiceType serviceType = this.MyServicesConfiguration.getMy();
27 this.MyProcessService.triggerJob(serviceType, isDaily, 1L);
28 }
29}
30@Slf4j
31@Service
32public class TEST_MyProcessService {
33
34 @Retryable(maxAttemptsExpression = "${api.retry.limit}", backoff = @Backoff(delayExpression = "${api.retry.max-interval}"))
35 public void triggerJob(MyServiceType MyServiceType, boolean isDaily, long eventId) {
36 // Some code here that can throw exceptions.
37 log.info("triggerJob");
38 throw new RuntimeException("triggerJob");
39 }
40
41 @Recover
42 public void recover(MyServiceType MyServiceType, boolean isDaily, long eventId) {
43 log.info("recover");
44 // Some code here that can throw exceptions.
45 throw new RuntimeException();
46 }
47}
48@Component
49@Slf4j
50public class TEST_MyAspect {
51
52 @Pointcut("execution(* packgName.otherProj.services.TEST_MyProcessService.triggerJob(..))")
53 public void MyTriggerJobs() {
54 }
55
56 @Pointcut("execution(* packgName.otherProj.services.TEST_MyProcessService.recover(..))")
57 public void MyRecoverJobs() {
58 }
59
60 @Before("MyTriggerJobs()")
61 public void beforeMyTriggerJobsAdvice(JoinPoint joinPoint) {
62 log.info("log beforeMyTriggerJobsAdvice");
63 }
64
65 @AfterReturning("MyTriggerJobs()")
66 public void afterMyTriggerJobsAdvice(JoinPoint joinPoint) {
67 log.info("log afterMyTriggerJobsAdvice");
68 }
69
70 @AfterThrowing(value = "MyTriggerJobs()", throwing = "error")
71 public void onErrorMyTriggerJobsAdvice(JoinPoint joinPoint, Throwable error) {
72 log.info("log onErrorMyTriggerJobsAdvice");
73 }
74
75 @Before("MyRecoverJobs()")
76 public void beforeMyRecoverJobsAdvice(JoinPoint joinPoint) {
77 log.info("log beforeMyRecoverJobsAdvice");
78 }
79
80 @AfterThrowing(value = "MyRecoverJobs()", throwing = "error")
81 public void onErrorRecoveryMyTriggerJobsAdvice(JoinPoint joinPoint, Throwable error) {
82 log.info("log onErrorRecoveryMyTriggerJobsAdvice");
83 }
84
85
86 @AfterReturning("MyRecoverJobs()")
87 public void afterRecoveryMyTriggerJobsAdvice(JoinPoint joinPoint) {
88 log.info("log afterRecoveryMyTriggerJobsAdvice");
89 }
90}
91
922021-06-02 20:56:00.016 INFO [,60b7f0602b2ecb0deefc04d6840b6274,eefc04d6840b6274,true] 92605 --- [ scheduling-1] c.c.p.r.c.TEST_ScheduledProcessPoller : scheduleTaskWithFixedDelay
932021-06-02 20:56:00.016 INFO [,60b7f0602b2ecb0deefc04d6840b6274,eefc04d6840b6274,true] 92605 --- [ scheduling-1] c.c.p.r.c.TEST_ScheduledProcessPoller : triggerBdaJobs
942021-06-02 20:56:00.051 INFO [,60b7f0602b2ecb0deefc04d6840b6274,eefc04d6840b6274,true] 92605 --- [ scheduling-1] c.c.p.r.component.aspect.TEST_BdaAspect : log beforeBdaTriggerJobsAdvice
952021-06-02 20:56:00.060 INFO [,60b7f0602b2ecb0deefc04d6840b6274,eefc04d6840b6274,true] 92605 --- [ scheduling-1] c.c.p.r.services.TEST_BdaProcessService : triggerJob
962021-06-02 20:56:00.061 INFO [,60b7f0602b2ecb0deefc04d6840b6274,eefc04d6840b6274,true] 92605 --- [ scheduling-1] c.c.p.r.component.aspect.TEST_BdaAspect : log onErrorBdaTriggerJobsAdvice
972021-06-02 20:56:05.065 INFO [,60b7f0602b2ecb0deefc04d6840b6274,eefc04d6840b6274,true] 92605 --- [ scheduling-1] c.c.p.r.component.aspect.TEST_BdaAspect : log beforeBdaTriggerJobsAdvice
982021-06-02 20:56:05.066 INFO [,60b7f0602b2ecb0deefc04d6840b6274,eefc04d6840b6274,true] 92605 --- [ scheduling-1] c.c.p.r.services.TEST_BdaProcessService : triggerJob
992021-06-02 20:56:05.066 INFO [,60b7f0602b2ecb0deefc04d6840b6274,eefc04d6840b6274,true] 92605 --- [ scheduling-1] c.c.p.r.component.aspect.TEST_BdaAspect : log onErrorBdaTriggerJobsAdvice
1002021-06-02 20:56:10.070 INFO [,60b7f0602b2ecb0deefc04d6840b6274,eefc04d6840b6274,true] 92605 --- [ scheduling-1] c.c.p.r.component.aspect.TEST_BdaAspect : log beforeBdaTriggerJobsAdvice
1012021-06-02 20:56:10.070 INFO [,60b7f0602b2ecb0deefc04d6840b6274,eefc04d6840b6274,true] 92605 --- [ scheduling-1] c.c.p.r.services.TEST_BdaProcessService : triggerJob
1022021-06-02 20:56:10.070 INFO [,60b7f0602b2ecb0deefc04d6840b6274,eefc04d6840b6274,true] 92605 --- [ scheduling-1] c.c.p.r.component.aspect.TEST_BdaAspect : log onErrorBdaTriggerJobsAdvice
1032021-06-02 20:56:10.070 INFO [,60b7f0602b2ecb0deefc04d6840b6274,eefc04d6840b6274,true] 92605 --- [ scheduling-1] c.c.p.r.services.TEST_BdaProcessService : recover
1042021-06-02 20:56:10.070 ERROR [,60b7f0602b2ecb0deefc04d6840b6274,eefc04d6840b6274,true] 92605 --- [ scheduling-1] c.c.p.r.c.TEST_ScheduledProcessPoller : null
105@Override
106public Object invoke(MethodInvocation invocation) throws Throwable {
107 MethodInterceptor delegate = getDelegate(invocation.getThis(), invocation.getMethod());
108 if (delegate != null) {
109 return delegate.invoke(invocation);
110 }
111 else {
112 return invocation.proceed();
113 }
114}
115
At this point Spring makes a choice to construct the delegate which later will be used for calling recover
. It is constructed with target object invocation.getThis()
, which points to the original object, i.e. a TEST_BdaProcessService
instance. At this point, the code could simply use invocation.getProxy()
instead, which would point to the AOP proxy, i.e. a TEST_BdaProcessService$$EnhancerBySpringCGLIB$$2f8076ac
instance. The problem is that the target object reference is passed through to the point where recover
gets called, and the corresponding recoverer instance at that point only knows the target object, having no clue of the corresponding proxy object anymore.
When I experimentally assigned the proxy to the delegate as a target, your advice method was invoked.
So we are talking about a Spring limitation here. Whether that was a deliberate choice in order to avoid any other related problems or simply an oversight, I have no idea.
Update: I created Spring Retry issue #244 on your behalf. You want to subscribe to it, so you can find out if/when it is going to be fixed.
Update 2: The issue has been fixed, is merged into the main branch and is probably going to be part of the upcoming 1.3.2 version, whenever that one might be released. For now, you can just clone Spring Retry, build by yourself and use the snapshot. I retested against your MCVE, the aspect now kicks in as expected for the recover method.
QUESTION
I get java.lang.ClassNotFoundException: org.springframework.web.context.WebApplicationContext at Tomcat webb app
Asked 2020-Nov-13 at 12:51I'm trying to run a web app with maven, spring on a tomcat server in intelliji idea. And i get: Artifact crm-web:war exploded: Error during artifact deployment.
Loggs:
Caused by: java.lang.NoClassDefFoundError: org/springframework/web/context/WebApplicationContext Caused by: java.lang.ClassNotFoundException: org.springframework.web.context.WebApplicationContext SEVERE: Exception invoking method createStandardContext SEVERE: Exception invoking method manageApp
Here is project structure:
1src
2 -main
3 -webapp
4 -js
5 -pages
6 -css
7 -tiles
8 -WEB-INF
9 -web.xml
10 -tiles.xml
11 -springservlet-servlet.xml
12 -applicationContext.xml
13 -pom.xml
14
pom.xml
1src
2 -main
3 -webapp
4 -js
5 -pages
6 -css
7 -tiles
8 -WEB-INF
9 -web.xml
10 -tiles.xml
11 -springservlet-servlet.xml
12 -applicationContext.xml
13 -pom.xml
14<packaging>war</packaging>
15<version>1.0</version>
16<!-- Shared version number properties -->
17
18<properties>
19 <org.springframework.version>3.1.0.RELEASE</org.springframework.version>
20 <TR-CA-VERSION>1.0</TR-CA-VERSION>
21 <lib_scope>provided</lib_scope>
22 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23 <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
24</properties>
25
26
27<profiles>
28 <profile>
29 <id>local-dev</id>
30 <activation>
31 <activeByDefault>true</activeByDefault>
32 </activation>
33 <build>
34 <plugins>
35 <plugin>
36 <groupId>org.apache.maven.plugins</groupId>
37 <artifactId>maven-antrun-plugin</artifactId>
38 <version>1.6</version>
39 <executions>
40 <execution>
41 <id>unzip-war</id>
42 <phase>none</phase> <!-- this disables plugin -->
43 </execution>
44 </executions>
45 </plugin>
46 </plugins>
47 </build>
48 </profile>
49 <profile>
50 <id>production-artifact-compilation</id>
51 <activation>
52 <property>
53 <name>env</name>
54 <value>production-artifact-compilation</value>
55 </property>
56 </activation>
57
58 </profile>
59</profiles>
60
61
62
63<dependencies>
64 <dependency>
65 <groupId>ru.berkana</groupId>
66 <artifactId>crm-server</artifactId>
67 <version>1.0</version>
68 <scope>compile</scope>
69 </dependency>
70
71 <dependency>
72 <groupId>org.springframework</groupId>
73 <artifactId>spring-context</artifactId>
74 <version>${org.springframework.version}</version>
75 </dependency>
76
77 <dependency>
78 <groupId>org.springframework.boot</groupId>
79 <artifactId>spring-boot-starter-web</artifactId>
80 <version>2.3.1.RELEASE</version>
81 <exclusions>
82 <exclusion>
83 <groupId>org.springframework.boot</groupId>
84 <artifactId>spring-boot-starter-tomcat</artifactId>
85 </exclusion>
86 </exclusions>
87 </dependency>
88
89 <dependency>
90 <groupId>commons-logging</groupId>
91 <artifactId>commons-logging</artifactId>
92 <version>1.1.1</version>
93 <scope>${lib_scope}</scope>
94 </dependency>
95 <!--
96 Core utilities used by other modules.
97 Define this if you use Spring Utility APIs (org.springframework.core.*/org.springframework.util.*)
98 -->
99 <dependency>
100 <groupId>org.springframework</groupId>
101 <artifactId>spring-core</artifactId>
102 <version>${org.springframework.version}</version>
103 <scope>${lib_scope}</scope>
104 </dependency>
105
106 <!--
107 Expression Language (depends on spring-core)
108 Define this if you use Spring Expression APIs (org.springframework.expression.*)
109 -->
110 <dependency>
111 <groupId>org.springframework</groupId>
112 <artifactId>spring-expression</artifactId>
113 <version>${org.springframework.version}</version>
114 <scope>${lib_scope}</scope>
115 </dependency>
116
117 <!--
118 Bean Factory and JavaBeans utilities (depends on spring-core)
119 Define this if you use Spring Bean APIs (org.springframework.beans.*)
120 -->
121 <dependency>
122 <groupId>org.springframework</groupId>
123 <artifactId>spring-beans</artifactId>
124 <version>${org.springframework.version}</version>
125 <scope>${lib_scope}</scope>
126 </dependency>
127
128 <!--
129 Aspect Oriented Programming (AOP) Framework (depends on spring-core, spring-beans)
130 Define this if you use Spring AOP APIs (org.springframework.aop.*)
131 -->
132 <dependency>
133 <groupId>org.springframework</groupId>
134 <artifactId>spring-aop</artifactId>
135 <version>${org.springframework.version}</version>
136 <scope>${lib_scope}</scope>
137 </dependency>
138
139 <!--
140 Application Context (depends on spring-core, spring-expression, spring-aop, spring-beans)
141 This is the central artifact for Spring's Dependency Injection Container and is generally always defined
142 -->
143 <dependency>
144 <groupId>org.springframework</groupId>
145 <artifactId>spring-context</artifactId>
146 <version>${org.springframework.version}</version>
147 <exclusions>
148 <exclusion>
149 <groupId>commons-logging</groupId>
150 <artifactId>commons-logging</artifactId>
151 </exclusion>
152 </exclusions>
153 <scope>${lib_scope}</scope>
154 </dependency>
155
156 <dependency>
157 <groupId>org.springframework.security</groupId>
158 <artifactId>spring-security-core</artifactId>
159 <version>${org.springframework.version}</version>
160 <scope>${lib_scope}</scope>
161 </dependency>
162
163 <dependency>
164 <groupId>org.apache.commons</groupId>
165 <artifactId>commons-io</artifactId>
166 <version>1.3.2</version>
167 <scope>${lib_scope}</scope>
168 </dependency>
169
170 <!--
171 Various Application Context utilities, including EhCache, JavaMail, Quartz, and Freemarker integration
172 Define this if you need any of these integrations
173 -->
174 <dependency>
175 <groupId>org.springframework</groupId>
176 <artifactId>spring-context-support</artifactId>
177 <version>${org.springframework.version}</version>
178 <scope>${lib_scope}</scope>
179 </dependency>
180
181 <!--
182 Transaction Management Abstraction (depends on spring-core, spring-beans, spring-aop, spring-context)
183 Define this if you use Spring Transactions or DAO Exception Hierarchy
184 (org.springframework.transaction.*/org.springframework.dao.*)
185 -->
186 <dependency>
187 <groupId>org.springframework</groupId>
188 <artifactId>spring-tx</artifactId>
189 <version>${org.springframework.version}</version>
190 <scope>${lib_scope}</scope>
191 </dependency>
192
193 <!--
194 JDBC Data Access Library (depends on spring-core, spring-beans, spring-context, spring-tx)
195 Define this if you use Spring's JdbcTemplate API (org.springframework.jdbc.*)
196 -->
197 <dependency>
198 <groupId>org.springframework</groupId>
199 <artifactId>spring-jdbc</artifactId>
200 <version>${org.springframework.version}</version>
201 <scope>${lib_scope}</scope>
202 </dependency>
203
204 <!--
205 Object-to-Relation-Mapping (ORM) integration with Hibernate, JPA, and iBatis.
206 (depends on spring-core, spring-beans, spring-context, spring-tx)
207 Define this if you need ORM (org.springframework.orm.*)
208 -->
209 <dependency>
210 <groupId>org.springframework</groupId>
211 <artifactId>spring-orm</artifactId>
212 <version>${org.springframework.version}</version>
213 <scope>${lib_scope}</scope>
214 </dependency>
215
216 <!--
217 Object-to-XML Mapping (OXM) abstraction and integration with JAXB, JiBX, Castor, XStream, and XML Beans.
218 (depends on spring-core, spring-beans, spring-context)
219 Define this if you need OXM (org.springframework.oxm.*)
220 -->
221 <dependency>
222 <groupId>org.springframework</groupId>
223 <artifactId>spring-oxm</artifactId>
224 <version>${org.springframework.version}</version>
225 <scope>${lib_scope}</scope>
226 </dependency>
227
228 <!--
229 Web application development utilities applicable to both Servlet and Portlet Environments
230 (depends on spring-core, spring-beans, spring-context)
231 Define this if you use Spring MVC, or wish to use Struts, JSF, or another web framework with Spring (org.springframework.web.*)
232 -->
233 <dependency>
234 <groupId>org.springframework</groupId>
235 <artifactId>spring-web</artifactId>
236 <version>${org.springframework.version}</version>
237 <scope>${lib_scope}</scope>
238 </dependency>
239
240 <!--
241 Spring MVC for Servlet Environments (depends on spring-core, spring-beans, spring-context, spring-web)
242 Define this if you use Spring MVC with a Servlet Container such as Apache Tomcat (org.springframework.web.servlet.*)
243 -->
244 <dependency>
245 <groupId>org.springframework</groupId>
246 <artifactId>spring-webmvc</artifactId>
247 <version>${org.springframework.version}</version>
248 <scope>${lib_scope}</scope>
249 </dependency>
250
251 <dependency>
252 <groupId>org.atmosphere</groupId>
253 <artifactId>atmosphere-runtime</artifactId>
254 <version>2.4.5</version>
255 <scope>${lib_scope}</scope>
256 </dependency>
257
258</dependencies>
259<build>
260 <plugins>
261 <plugin>
262 <groupId>org.apache.maven.plugins</groupId>
263 <artifactId>maven-surefire-plugin</artifactId>
264 <version>2.19.1</version>
265 <configuration>
266 <testFailureIgnore>true</testFailureIgnore>
267 </configuration>
268 </plugin>
269
270
271 <plugin>
272 <groupId>org.apache.maven.plugins</groupId>
273 <artifactId>maven-antrun-plugin</artifactId>
274 <version>1.6</version>
275 <executions>
276 <execution>
277 <id>unzip-war</id>
278 <phase>package</phase>
279 <configuration>
280 <tasks>
281 <echo message="unzip phase"/>
282 <unzip src="${project.build.directory}/${project.build.finalName}.war"
283 dest="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca"/>
284 <delete dir="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/css/joined/"/>
285 <delete dir="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/css/notjoined/"/>
286 <delete dir="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/js/joined/"/>
287 <delete file="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/js/jquery-1.7.11.0.js"/>
288 <delete file="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/js/jquery-1.7.1.min1.0.js"/>
289 <delete file="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/js/jquery-1.7.1.js"/>
290 </tasks>
291 </configuration>
292 <goals>
293 <goal>run</goal>
294 </goals>
295 </execution>
296 </executions>
297 </plugin>
298 <plugin>
299 <artifactId>maven-compiler-plugin</artifactId>
300 <configuration>
301 <source>1.7</source>
302 <target>1.7</target>
303 </configuration>
304 </plugin>
305
306 <plugin>
307 <groupId>org.apache.maven.plugins</groupId>
308 <artifactId>maven-war-plugin</artifactId>
309 <version>2.2</version>
310 <executions>
311 <execution>
312 <id>package-with-source-js-css</id>
313 <phase>package</phase>
314 </execution>
315 </executions>
316 </plugin>
317
318
319 <plugin>
320 <groupId>net.alchim31.maven</groupId>
321 <artifactId>yuicompressor-maven-plugin</artifactId>
322 <version>1.3.0</version>
323 <executions>
324 <execution>
325 <phase>process-sources</phase>
326 <goals>
327 <goal>compress</goal>
328 </goals>
329 </execution>
330 </executions>
331 <configuration>
332 <statistics>true</statistics>
333 <nosuffix>false</nosuffix>
334 <failOnWarning>false</failOnWarning>
335 <gzip>false</gzip>
336 <suffix>${TR-CA-VERSION}</suffix>
337 <aggregations>
338 <aggregation>
339 <removeIncluded>false</removeIncluded>
340 <inputDir>src/main/webapp/css/joined</inputDir>
341 <includes>
342 <include>**/*.css</include>
343 </includes>
344 <output>${project.build.directory}/${project.build.finalName}/css/all.css</output>
345 </aggregation>
346 <aggregation>
347 <removeIncluded>false</removeIncluded>
348 <inputDir>src/main/webapp/css/joinedNew</inputDir>
349 <includes>
350 <include>**/*.css</include>
351 </includes>
352 <output>${project.build.directory}/${project.build.finalName}/css/allnew.css</output>
353 </aggregation>
354 <aggregation>
355 <!-- remove files after aggregation (default: false) -->
356 <removeIncluded>false</removeIncluded>
357 <inputDir>src/main/webapp/js/joined</inputDir>
358 <includes>
359 <include>**/*.js</include>
360 </includes>
361 <output>${project.build.directory}/${project.build.finalName}/js/all.js</output>
362 </aggregation>
363 </aggregations>
364 </configuration>
365 </plugin>
366
367 </plugins>
368</build>
369
370<pluginRepositories>
371 <pluginRepository>
372 <name>oss.sonatype.org - github-releases</name>
373 <id>oss.sonatype.org-github-releases</id>
374 <url>http://oss.sonatype.org/content/repositories/github-releases</url>
375 </pluginRepository>
376</pluginRepositories>
377
1src
2 -main
3 -webapp
4 -js
5 -pages
6 -css
7 -tiles
8 -WEB-INF
9 -web.xml
10 -tiles.xml
11 -springservlet-servlet.xml
12 -applicationContext.xml
13 -pom.xml
14<packaging>war</packaging>
15<version>1.0</version>
16<!-- Shared version number properties -->
17
18<properties>
19 <org.springframework.version>3.1.0.RELEASE</org.springframework.version>
20 <TR-CA-VERSION>1.0</TR-CA-VERSION>
21 <lib_scope>provided</lib_scope>
22 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23 <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
24</properties>
25
26
27<profiles>
28 <profile>
29 <id>local-dev</id>
30 <activation>
31 <activeByDefault>true</activeByDefault>
32 </activation>
33 <build>
34 <plugins>
35 <plugin>
36 <groupId>org.apache.maven.plugins</groupId>
37 <artifactId>maven-antrun-plugin</artifactId>
38 <version>1.6</version>
39 <executions>
40 <execution>
41 <id>unzip-war</id>
42 <phase>none</phase> <!-- this disables plugin -->
43 </execution>
44 </executions>
45 </plugin>
46 </plugins>
47 </build>
48 </profile>
49 <profile>
50 <id>production-artifact-compilation</id>
51 <activation>
52 <property>
53 <name>env</name>
54 <value>production-artifact-compilation</value>
55 </property>
56 </activation>
57
58 </profile>
59</profiles>
60
61
62
63<dependencies>
64 <dependency>
65 <groupId>ru.berkana</groupId>
66 <artifactId>crm-server</artifactId>
67 <version>1.0</version>
68 <scope>compile</scope>
69 </dependency>
70
71 <dependency>
72 <groupId>org.springframework</groupId>
73 <artifactId>spring-context</artifactId>
74 <version>${org.springframework.version}</version>
75 </dependency>
76
77 <dependency>
78 <groupId>org.springframework.boot</groupId>
79 <artifactId>spring-boot-starter-web</artifactId>
80 <version>2.3.1.RELEASE</version>
81 <exclusions>
82 <exclusion>
83 <groupId>org.springframework.boot</groupId>
84 <artifactId>spring-boot-starter-tomcat</artifactId>
85 </exclusion>
86 </exclusions>
87 </dependency>
88
89 <dependency>
90 <groupId>commons-logging</groupId>
91 <artifactId>commons-logging</artifactId>
92 <version>1.1.1</version>
93 <scope>${lib_scope}</scope>
94 </dependency>
95 <!--
96 Core utilities used by other modules.
97 Define this if you use Spring Utility APIs (org.springframework.core.*/org.springframework.util.*)
98 -->
99 <dependency>
100 <groupId>org.springframework</groupId>
101 <artifactId>spring-core</artifactId>
102 <version>${org.springframework.version}</version>
103 <scope>${lib_scope}</scope>
104 </dependency>
105
106 <!--
107 Expression Language (depends on spring-core)
108 Define this if you use Spring Expression APIs (org.springframework.expression.*)
109 -->
110 <dependency>
111 <groupId>org.springframework</groupId>
112 <artifactId>spring-expression</artifactId>
113 <version>${org.springframework.version}</version>
114 <scope>${lib_scope}</scope>
115 </dependency>
116
117 <!--
118 Bean Factory and JavaBeans utilities (depends on spring-core)
119 Define this if you use Spring Bean APIs (org.springframework.beans.*)
120 -->
121 <dependency>
122 <groupId>org.springframework</groupId>
123 <artifactId>spring-beans</artifactId>
124 <version>${org.springframework.version}</version>
125 <scope>${lib_scope}</scope>
126 </dependency>
127
128 <!--
129 Aspect Oriented Programming (AOP) Framework (depends on spring-core, spring-beans)
130 Define this if you use Spring AOP APIs (org.springframework.aop.*)
131 -->
132 <dependency>
133 <groupId>org.springframework</groupId>
134 <artifactId>spring-aop</artifactId>
135 <version>${org.springframework.version}</version>
136 <scope>${lib_scope}</scope>
137 </dependency>
138
139 <!--
140 Application Context (depends on spring-core, spring-expression, spring-aop, spring-beans)
141 This is the central artifact for Spring's Dependency Injection Container and is generally always defined
142 -->
143 <dependency>
144 <groupId>org.springframework</groupId>
145 <artifactId>spring-context</artifactId>
146 <version>${org.springframework.version}</version>
147 <exclusions>
148 <exclusion>
149 <groupId>commons-logging</groupId>
150 <artifactId>commons-logging</artifactId>
151 </exclusion>
152 </exclusions>
153 <scope>${lib_scope}</scope>
154 </dependency>
155
156 <dependency>
157 <groupId>org.springframework.security</groupId>
158 <artifactId>spring-security-core</artifactId>
159 <version>${org.springframework.version}</version>
160 <scope>${lib_scope}</scope>
161 </dependency>
162
163 <dependency>
164 <groupId>org.apache.commons</groupId>
165 <artifactId>commons-io</artifactId>
166 <version>1.3.2</version>
167 <scope>${lib_scope}</scope>
168 </dependency>
169
170 <!--
171 Various Application Context utilities, including EhCache, JavaMail, Quartz, and Freemarker integration
172 Define this if you need any of these integrations
173 -->
174 <dependency>
175 <groupId>org.springframework</groupId>
176 <artifactId>spring-context-support</artifactId>
177 <version>${org.springframework.version}</version>
178 <scope>${lib_scope}</scope>
179 </dependency>
180
181 <!--
182 Transaction Management Abstraction (depends on spring-core, spring-beans, spring-aop, spring-context)
183 Define this if you use Spring Transactions or DAO Exception Hierarchy
184 (org.springframework.transaction.*/org.springframework.dao.*)
185 -->
186 <dependency>
187 <groupId>org.springframework</groupId>
188 <artifactId>spring-tx</artifactId>
189 <version>${org.springframework.version}</version>
190 <scope>${lib_scope}</scope>
191 </dependency>
192
193 <!--
194 JDBC Data Access Library (depends on spring-core, spring-beans, spring-context, spring-tx)
195 Define this if you use Spring's JdbcTemplate API (org.springframework.jdbc.*)
196 -->
197 <dependency>
198 <groupId>org.springframework</groupId>
199 <artifactId>spring-jdbc</artifactId>
200 <version>${org.springframework.version}</version>
201 <scope>${lib_scope}</scope>
202 </dependency>
203
204 <!--
205 Object-to-Relation-Mapping (ORM) integration with Hibernate, JPA, and iBatis.
206 (depends on spring-core, spring-beans, spring-context, spring-tx)
207 Define this if you need ORM (org.springframework.orm.*)
208 -->
209 <dependency>
210 <groupId>org.springframework</groupId>
211 <artifactId>spring-orm</artifactId>
212 <version>${org.springframework.version}</version>
213 <scope>${lib_scope}</scope>
214 </dependency>
215
216 <!--
217 Object-to-XML Mapping (OXM) abstraction and integration with JAXB, JiBX, Castor, XStream, and XML Beans.
218 (depends on spring-core, spring-beans, spring-context)
219 Define this if you need OXM (org.springframework.oxm.*)
220 -->
221 <dependency>
222 <groupId>org.springframework</groupId>
223 <artifactId>spring-oxm</artifactId>
224 <version>${org.springframework.version}</version>
225 <scope>${lib_scope}</scope>
226 </dependency>
227
228 <!--
229 Web application development utilities applicable to both Servlet and Portlet Environments
230 (depends on spring-core, spring-beans, spring-context)
231 Define this if you use Spring MVC, or wish to use Struts, JSF, or another web framework with Spring (org.springframework.web.*)
232 -->
233 <dependency>
234 <groupId>org.springframework</groupId>
235 <artifactId>spring-web</artifactId>
236 <version>${org.springframework.version}</version>
237 <scope>${lib_scope}</scope>
238 </dependency>
239
240 <!--
241 Spring MVC for Servlet Environments (depends on spring-core, spring-beans, spring-context, spring-web)
242 Define this if you use Spring MVC with a Servlet Container such as Apache Tomcat (org.springframework.web.servlet.*)
243 -->
244 <dependency>
245 <groupId>org.springframework</groupId>
246 <artifactId>spring-webmvc</artifactId>
247 <version>${org.springframework.version}</version>
248 <scope>${lib_scope}</scope>
249 </dependency>
250
251 <dependency>
252 <groupId>org.atmosphere</groupId>
253 <artifactId>atmosphere-runtime</artifactId>
254 <version>2.4.5</version>
255 <scope>${lib_scope}</scope>
256 </dependency>
257
258</dependencies>
259<build>
260 <plugins>
261 <plugin>
262 <groupId>org.apache.maven.plugins</groupId>
263 <artifactId>maven-surefire-plugin</artifactId>
264 <version>2.19.1</version>
265 <configuration>
266 <testFailureIgnore>true</testFailureIgnore>
267 </configuration>
268 </plugin>
269
270
271 <plugin>
272 <groupId>org.apache.maven.plugins</groupId>
273 <artifactId>maven-antrun-plugin</artifactId>
274 <version>1.6</version>
275 <executions>
276 <execution>
277 <id>unzip-war</id>
278 <phase>package</phase>
279 <configuration>
280 <tasks>
281 <echo message="unzip phase"/>
282 <unzip src="${project.build.directory}/${project.build.finalName}.war"
283 dest="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca"/>
284 <delete dir="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/css/joined/"/>
285 <delete dir="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/css/notjoined/"/>
286 <delete dir="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/js/joined/"/>
287 <delete file="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/js/jquery-1.7.11.0.js"/>
288 <delete file="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/js/jquery-1.7.1.min1.0.js"/>
289 <delete file="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/js/jquery-1.7.1.js"/>
290 </tasks>
291 </configuration>
292 <goals>
293 <goal>run</goal>
294 </goals>
295 </execution>
296 </executions>
297 </plugin>
298 <plugin>
299 <artifactId>maven-compiler-plugin</artifactId>
300 <configuration>
301 <source>1.7</source>
302 <target>1.7</target>
303 </configuration>
304 </plugin>
305
306 <plugin>
307 <groupId>org.apache.maven.plugins</groupId>
308 <artifactId>maven-war-plugin</artifactId>
309 <version>2.2</version>
310 <executions>
311 <execution>
312 <id>package-with-source-js-css</id>
313 <phase>package</phase>
314 </execution>
315 </executions>
316 </plugin>
317
318
319 <plugin>
320 <groupId>net.alchim31.maven</groupId>
321 <artifactId>yuicompressor-maven-plugin</artifactId>
322 <version>1.3.0</version>
323 <executions>
324 <execution>
325 <phase>process-sources</phase>
326 <goals>
327 <goal>compress</goal>
328 </goals>
329 </execution>
330 </executions>
331 <configuration>
332 <statistics>true</statistics>
333 <nosuffix>false</nosuffix>
334 <failOnWarning>false</failOnWarning>
335 <gzip>false</gzip>
336 <suffix>${TR-CA-VERSION}</suffix>
337 <aggregations>
338 <aggregation>
339 <removeIncluded>false</removeIncluded>
340 <inputDir>src/main/webapp/css/joined</inputDir>
341 <includes>
342 <include>**/*.css</include>
343 </includes>
344 <output>${project.build.directory}/${project.build.finalName}/css/all.css</output>
345 </aggregation>
346 <aggregation>
347 <removeIncluded>false</removeIncluded>
348 <inputDir>src/main/webapp/css/joinedNew</inputDir>
349 <includes>
350 <include>**/*.css</include>
351 </includes>
352 <output>${project.build.directory}/${project.build.finalName}/css/allnew.css</output>
353 </aggregation>
354 <aggregation>
355 <!-- remove files after aggregation (default: false) -->
356 <removeIncluded>false</removeIncluded>
357 <inputDir>src/main/webapp/js/joined</inputDir>
358 <includes>
359 <include>**/*.js</include>
360 </includes>
361 <output>${project.build.directory}/${project.build.finalName}/js/all.js</output>
362 </aggregation>
363 </aggregations>
364 </configuration>
365 </plugin>
366
367 </plugins>
368</build>
369
370<pluginRepositories>
371 <pluginRepository>
372 <name>oss.sonatype.org - github-releases</name>
373 <id>oss.sonatype.org-github-releases</id>
374 <url>http://oss.sonatype.org/content/repositories/github-releases</url>
375 </pluginRepository>
376</pluginRepositories>
377<?xml version="1.0" encoding="UTF-8"?>
378
tiles.xml
1src
2 -main
3 -webapp
4 -js
5 -pages
6 -css
7 -tiles
8 -WEB-INF
9 -web.xml
10 -tiles.xml
11 -springservlet-servlet.xml
12 -applicationContext.xml
13 -pom.xml
14<packaging>war</packaging>
15<version>1.0</version>
16<!-- Shared version number properties -->
17
18<properties>
19 <org.springframework.version>3.1.0.RELEASE</org.springframework.version>
20 <TR-CA-VERSION>1.0</TR-CA-VERSION>
21 <lib_scope>provided</lib_scope>
22 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23 <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
24</properties>
25
26
27<profiles>
28 <profile>
29 <id>local-dev</id>
30 <activation>
31 <activeByDefault>true</activeByDefault>
32 </activation>
33 <build>
34 <plugins>
35 <plugin>
36 <groupId>org.apache.maven.plugins</groupId>
37 <artifactId>maven-antrun-plugin</artifactId>
38 <version>1.6</version>
39 <executions>
40 <execution>
41 <id>unzip-war</id>
42 <phase>none</phase> <!-- this disables plugin -->
43 </execution>
44 </executions>
45 </plugin>
46 </plugins>
47 </build>
48 </profile>
49 <profile>
50 <id>production-artifact-compilation</id>
51 <activation>
52 <property>
53 <name>env</name>
54 <value>production-artifact-compilation</value>
55 </property>
56 </activation>
57
58 </profile>
59</profiles>
60
61
62
63<dependencies>
64 <dependency>
65 <groupId>ru.berkana</groupId>
66 <artifactId>crm-server</artifactId>
67 <version>1.0</version>
68 <scope>compile</scope>
69 </dependency>
70
71 <dependency>
72 <groupId>org.springframework</groupId>
73 <artifactId>spring-context</artifactId>
74 <version>${org.springframework.version}</version>
75 </dependency>
76
77 <dependency>
78 <groupId>org.springframework.boot</groupId>
79 <artifactId>spring-boot-starter-web</artifactId>
80 <version>2.3.1.RELEASE</version>
81 <exclusions>
82 <exclusion>
83 <groupId>org.springframework.boot</groupId>
84 <artifactId>spring-boot-starter-tomcat</artifactId>
85 </exclusion>
86 </exclusions>
87 </dependency>
88
89 <dependency>
90 <groupId>commons-logging</groupId>
91 <artifactId>commons-logging</artifactId>
92 <version>1.1.1</version>
93 <scope>${lib_scope}</scope>
94 </dependency>
95 <!--
96 Core utilities used by other modules.
97 Define this if you use Spring Utility APIs (org.springframework.core.*/org.springframework.util.*)
98 -->
99 <dependency>
100 <groupId>org.springframework</groupId>
101 <artifactId>spring-core</artifactId>
102 <version>${org.springframework.version}</version>
103 <scope>${lib_scope}</scope>
104 </dependency>
105
106 <!--
107 Expression Language (depends on spring-core)
108 Define this if you use Spring Expression APIs (org.springframework.expression.*)
109 -->
110 <dependency>
111 <groupId>org.springframework</groupId>
112 <artifactId>spring-expression</artifactId>
113 <version>${org.springframework.version}</version>
114 <scope>${lib_scope}</scope>
115 </dependency>
116
117 <!--
118 Bean Factory and JavaBeans utilities (depends on spring-core)
119 Define this if you use Spring Bean APIs (org.springframework.beans.*)
120 -->
121 <dependency>
122 <groupId>org.springframework</groupId>
123 <artifactId>spring-beans</artifactId>
124 <version>${org.springframework.version}</version>
125 <scope>${lib_scope}</scope>
126 </dependency>
127
128 <!--
129 Aspect Oriented Programming (AOP) Framework (depends on spring-core, spring-beans)
130 Define this if you use Spring AOP APIs (org.springframework.aop.*)
131 -->
132 <dependency>
133 <groupId>org.springframework</groupId>
134 <artifactId>spring-aop</artifactId>
135 <version>${org.springframework.version}</version>
136 <scope>${lib_scope}</scope>
137 </dependency>
138
139 <!--
140 Application Context (depends on spring-core, spring-expression, spring-aop, spring-beans)
141 This is the central artifact for Spring's Dependency Injection Container and is generally always defined
142 -->
143 <dependency>
144 <groupId>org.springframework</groupId>
145 <artifactId>spring-context</artifactId>
146 <version>${org.springframework.version}</version>
147 <exclusions>
148 <exclusion>
149 <groupId>commons-logging</groupId>
150 <artifactId>commons-logging</artifactId>
151 </exclusion>
152 </exclusions>
153 <scope>${lib_scope}</scope>
154 </dependency>
155
156 <dependency>
157 <groupId>org.springframework.security</groupId>
158 <artifactId>spring-security-core</artifactId>
159 <version>${org.springframework.version}</version>
160 <scope>${lib_scope}</scope>
161 </dependency>
162
163 <dependency>
164 <groupId>org.apache.commons</groupId>
165 <artifactId>commons-io</artifactId>
166 <version>1.3.2</version>
167 <scope>${lib_scope}</scope>
168 </dependency>
169
170 <!--
171 Various Application Context utilities, including EhCache, JavaMail, Quartz, and Freemarker integration
172 Define this if you need any of these integrations
173 -->
174 <dependency>
175 <groupId>org.springframework</groupId>
176 <artifactId>spring-context-support</artifactId>
177 <version>${org.springframework.version}</version>
178 <scope>${lib_scope}</scope>
179 </dependency>
180
181 <!--
182 Transaction Management Abstraction (depends on spring-core, spring-beans, spring-aop, spring-context)
183 Define this if you use Spring Transactions or DAO Exception Hierarchy
184 (org.springframework.transaction.*/org.springframework.dao.*)
185 -->
186 <dependency>
187 <groupId>org.springframework</groupId>
188 <artifactId>spring-tx</artifactId>
189 <version>${org.springframework.version}</version>
190 <scope>${lib_scope}</scope>
191 </dependency>
192
193 <!--
194 JDBC Data Access Library (depends on spring-core, spring-beans, spring-context, spring-tx)
195 Define this if you use Spring's JdbcTemplate API (org.springframework.jdbc.*)
196 -->
197 <dependency>
198 <groupId>org.springframework</groupId>
199 <artifactId>spring-jdbc</artifactId>
200 <version>${org.springframework.version}</version>
201 <scope>${lib_scope}</scope>
202 </dependency>
203
204 <!--
205 Object-to-Relation-Mapping (ORM) integration with Hibernate, JPA, and iBatis.
206 (depends on spring-core, spring-beans, spring-context, spring-tx)
207 Define this if you need ORM (org.springframework.orm.*)
208 -->
209 <dependency>
210 <groupId>org.springframework</groupId>
211 <artifactId>spring-orm</artifactId>
212 <version>${org.springframework.version}</version>
213 <scope>${lib_scope}</scope>
214 </dependency>
215
216 <!--
217 Object-to-XML Mapping (OXM) abstraction and integration with JAXB, JiBX, Castor, XStream, and XML Beans.
218 (depends on spring-core, spring-beans, spring-context)
219 Define this if you need OXM (org.springframework.oxm.*)
220 -->
221 <dependency>
222 <groupId>org.springframework</groupId>
223 <artifactId>spring-oxm</artifactId>
224 <version>${org.springframework.version}</version>
225 <scope>${lib_scope}</scope>
226 </dependency>
227
228 <!--
229 Web application development utilities applicable to both Servlet and Portlet Environments
230 (depends on spring-core, spring-beans, spring-context)
231 Define this if you use Spring MVC, or wish to use Struts, JSF, or another web framework with Spring (org.springframework.web.*)
232 -->
233 <dependency>
234 <groupId>org.springframework</groupId>
235 <artifactId>spring-web</artifactId>
236 <version>${org.springframework.version}</version>
237 <scope>${lib_scope}</scope>
238 </dependency>
239
240 <!--
241 Spring MVC for Servlet Environments (depends on spring-core, spring-beans, spring-context, spring-web)
242 Define this if you use Spring MVC with a Servlet Container such as Apache Tomcat (org.springframework.web.servlet.*)
243 -->
244 <dependency>
245 <groupId>org.springframework</groupId>
246 <artifactId>spring-webmvc</artifactId>
247 <version>${org.springframework.version}</version>
248 <scope>${lib_scope}</scope>
249 </dependency>
250
251 <dependency>
252 <groupId>org.atmosphere</groupId>
253 <artifactId>atmosphere-runtime</artifactId>
254 <version>2.4.5</version>
255 <scope>${lib_scope}</scope>
256 </dependency>
257
258</dependencies>
259<build>
260 <plugins>
261 <plugin>
262 <groupId>org.apache.maven.plugins</groupId>
263 <artifactId>maven-surefire-plugin</artifactId>
264 <version>2.19.1</version>
265 <configuration>
266 <testFailureIgnore>true</testFailureIgnore>
267 </configuration>
268 </plugin>
269
270
271 <plugin>
272 <groupId>org.apache.maven.plugins</groupId>
273 <artifactId>maven-antrun-plugin</artifactId>
274 <version>1.6</version>
275 <executions>
276 <execution>
277 <id>unzip-war</id>
278 <phase>package</phase>
279 <configuration>
280 <tasks>
281 <echo message="unzip phase"/>
282 <unzip src="${project.build.directory}/${project.build.finalName}.war"
283 dest="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca"/>
284 <delete dir="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/css/joined/"/>
285 <delete dir="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/css/notjoined/"/>
286 <delete dir="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/js/joined/"/>
287 <delete file="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/js/jquery-1.7.11.0.js"/>
288 <delete file="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/js/jquery-1.7.1.min1.0.js"/>
289 <delete file="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/js/jquery-1.7.1.js"/>
290 </tasks>
291 </configuration>
292 <goals>
293 <goal>run</goal>
294 </goals>
295 </execution>
296 </executions>
297 </plugin>
298 <plugin>
299 <artifactId>maven-compiler-plugin</artifactId>
300 <configuration>
301 <source>1.7</source>
302 <target>1.7</target>
303 </configuration>
304 </plugin>
305
306 <plugin>
307 <groupId>org.apache.maven.plugins</groupId>
308 <artifactId>maven-war-plugin</artifactId>
309 <version>2.2</version>
310 <executions>
311 <execution>
312 <id>package-with-source-js-css</id>
313 <phase>package</phase>
314 </execution>
315 </executions>
316 </plugin>
317
318
319 <plugin>
320 <groupId>net.alchim31.maven</groupId>
321 <artifactId>yuicompressor-maven-plugin</artifactId>
322 <version>1.3.0</version>
323 <executions>
324 <execution>
325 <phase>process-sources</phase>
326 <goals>
327 <goal>compress</goal>
328 </goals>
329 </execution>
330 </executions>
331 <configuration>
332 <statistics>true</statistics>
333 <nosuffix>false</nosuffix>
334 <failOnWarning>false</failOnWarning>
335 <gzip>false</gzip>
336 <suffix>${TR-CA-VERSION}</suffix>
337 <aggregations>
338 <aggregation>
339 <removeIncluded>false</removeIncluded>
340 <inputDir>src/main/webapp/css/joined</inputDir>
341 <includes>
342 <include>**/*.css</include>
343 </includes>
344 <output>${project.build.directory}/${project.build.finalName}/css/all.css</output>
345 </aggregation>
346 <aggregation>
347 <removeIncluded>false</removeIncluded>
348 <inputDir>src/main/webapp/css/joinedNew</inputDir>
349 <includes>
350 <include>**/*.css</include>
351 </includes>
352 <output>${project.build.directory}/${project.build.finalName}/css/allnew.css</output>
353 </aggregation>
354 <aggregation>
355 <!-- remove files after aggregation (default: false) -->
356 <removeIncluded>false</removeIncluded>
357 <inputDir>src/main/webapp/js/joined</inputDir>
358 <includes>
359 <include>**/*.js</include>
360 </includes>
361 <output>${project.build.directory}/${project.build.finalName}/js/all.js</output>
362 </aggregation>
363 </aggregations>
364 </configuration>
365 </plugin>
366
367 </plugins>
368</build>
369
370<pluginRepositories>
371 <pluginRepository>
372 <name>oss.sonatype.org - github-releases</name>
373 <id>oss.sonatype.org-github-releases</id>
374 <url>http://oss.sonatype.org/content/repositories/github-releases</url>
375 </pluginRepository>
376</pluginRepositories>
377<?xml version="1.0" encoding="UTF-8"?>
378<bean class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
379 <property name="definitions">
380 <list>
381 <!--Set up your Tiles definition RIGHT HERE-->
382 <value>/WEB-INF/tiles.xml</value>
383 </list>
384 </property>
385</bean>
386
387<bean id="messageSource"
388 class="ru.berkana.crm.util.web.CustomMessageSource">
389 <property name="basename" value="/WEB-INF/classes/locales/strings_ru_STUDY_CLUB.properties" />
390 <property name="defaultEncoding" value="UTF-8"/>
391</bean>
392
393<bean id="localeResolver"
394 class="ru.berkana.crm.util.web.CustomLocaleResolver">
395</bean>
396
web.xml
1src
2 -main
3 -webapp
4 -js
5 -pages
6 -css
7 -tiles
8 -WEB-INF
9 -web.xml
10 -tiles.xml
11 -springservlet-servlet.xml
12 -applicationContext.xml
13 -pom.xml
14<packaging>war</packaging>
15<version>1.0</version>
16<!-- Shared version number properties -->
17
18<properties>
19 <org.springframework.version>3.1.0.RELEASE</org.springframework.version>
20 <TR-CA-VERSION>1.0</TR-CA-VERSION>
21 <lib_scope>provided</lib_scope>
22 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23 <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
24</properties>
25
26
27<profiles>
28 <profile>
29 <id>local-dev</id>
30 <activation>
31 <activeByDefault>true</activeByDefault>
32 </activation>
33 <build>
34 <plugins>
35 <plugin>
36 <groupId>org.apache.maven.plugins</groupId>
37 <artifactId>maven-antrun-plugin</artifactId>
38 <version>1.6</version>
39 <executions>
40 <execution>
41 <id>unzip-war</id>
42 <phase>none</phase> <!-- this disables plugin -->
43 </execution>
44 </executions>
45 </plugin>
46 </plugins>
47 </build>
48 </profile>
49 <profile>
50 <id>production-artifact-compilation</id>
51 <activation>
52 <property>
53 <name>env</name>
54 <value>production-artifact-compilation</value>
55 </property>
56 </activation>
57
58 </profile>
59</profiles>
60
61
62
63<dependencies>
64 <dependency>
65 <groupId>ru.berkana</groupId>
66 <artifactId>crm-server</artifactId>
67 <version>1.0</version>
68 <scope>compile</scope>
69 </dependency>
70
71 <dependency>
72 <groupId>org.springframework</groupId>
73 <artifactId>spring-context</artifactId>
74 <version>${org.springframework.version}</version>
75 </dependency>
76
77 <dependency>
78 <groupId>org.springframework.boot</groupId>
79 <artifactId>spring-boot-starter-web</artifactId>
80 <version>2.3.1.RELEASE</version>
81 <exclusions>
82 <exclusion>
83 <groupId>org.springframework.boot</groupId>
84 <artifactId>spring-boot-starter-tomcat</artifactId>
85 </exclusion>
86 </exclusions>
87 </dependency>
88
89 <dependency>
90 <groupId>commons-logging</groupId>
91 <artifactId>commons-logging</artifactId>
92 <version>1.1.1</version>
93 <scope>${lib_scope}</scope>
94 </dependency>
95 <!--
96 Core utilities used by other modules.
97 Define this if you use Spring Utility APIs (org.springframework.core.*/org.springframework.util.*)
98 -->
99 <dependency>
100 <groupId>org.springframework</groupId>
101 <artifactId>spring-core</artifactId>
102 <version>${org.springframework.version}</version>
103 <scope>${lib_scope}</scope>
104 </dependency>
105
106 <!--
107 Expression Language (depends on spring-core)
108 Define this if you use Spring Expression APIs (org.springframework.expression.*)
109 -->
110 <dependency>
111 <groupId>org.springframework</groupId>
112 <artifactId>spring-expression</artifactId>
113 <version>${org.springframework.version}</version>
114 <scope>${lib_scope}</scope>
115 </dependency>
116
117 <!--
118 Bean Factory and JavaBeans utilities (depends on spring-core)
119 Define this if you use Spring Bean APIs (org.springframework.beans.*)
120 -->
121 <dependency>
122 <groupId>org.springframework</groupId>
123 <artifactId>spring-beans</artifactId>
124 <version>${org.springframework.version}</version>
125 <scope>${lib_scope}</scope>
126 </dependency>
127
128 <!--
129 Aspect Oriented Programming (AOP) Framework (depends on spring-core, spring-beans)
130 Define this if you use Spring AOP APIs (org.springframework.aop.*)
131 -->
132 <dependency>
133 <groupId>org.springframework</groupId>
134 <artifactId>spring-aop</artifactId>
135 <version>${org.springframework.version}</version>
136 <scope>${lib_scope}</scope>
137 </dependency>
138
139 <!--
140 Application Context (depends on spring-core, spring-expression, spring-aop, spring-beans)
141 This is the central artifact for Spring's Dependency Injection Container and is generally always defined
142 -->
143 <dependency>
144 <groupId>org.springframework</groupId>
145 <artifactId>spring-context</artifactId>
146 <version>${org.springframework.version}</version>
147 <exclusions>
148 <exclusion>
149 <groupId>commons-logging</groupId>
150 <artifactId>commons-logging</artifactId>
151 </exclusion>
152 </exclusions>
153 <scope>${lib_scope}</scope>
154 </dependency>
155
156 <dependency>
157 <groupId>org.springframework.security</groupId>
158 <artifactId>spring-security-core</artifactId>
159 <version>${org.springframework.version}</version>
160 <scope>${lib_scope}</scope>
161 </dependency>
162
163 <dependency>
164 <groupId>org.apache.commons</groupId>
165 <artifactId>commons-io</artifactId>
166 <version>1.3.2</version>
167 <scope>${lib_scope}</scope>
168 </dependency>
169
170 <!--
171 Various Application Context utilities, including EhCache, JavaMail, Quartz, and Freemarker integration
172 Define this if you need any of these integrations
173 -->
174 <dependency>
175 <groupId>org.springframework</groupId>
176 <artifactId>spring-context-support</artifactId>
177 <version>${org.springframework.version}</version>
178 <scope>${lib_scope}</scope>
179 </dependency>
180
181 <!--
182 Transaction Management Abstraction (depends on spring-core, spring-beans, spring-aop, spring-context)
183 Define this if you use Spring Transactions or DAO Exception Hierarchy
184 (org.springframework.transaction.*/org.springframework.dao.*)
185 -->
186 <dependency>
187 <groupId>org.springframework</groupId>
188 <artifactId>spring-tx</artifactId>
189 <version>${org.springframework.version}</version>
190 <scope>${lib_scope}</scope>
191 </dependency>
192
193 <!--
194 JDBC Data Access Library (depends on spring-core, spring-beans, spring-context, spring-tx)
195 Define this if you use Spring's JdbcTemplate API (org.springframework.jdbc.*)
196 -->
197 <dependency>
198 <groupId>org.springframework</groupId>
199 <artifactId>spring-jdbc</artifactId>
200 <version>${org.springframework.version}</version>
201 <scope>${lib_scope}</scope>
202 </dependency>
203
204 <!--
205 Object-to-Relation-Mapping (ORM) integration with Hibernate, JPA, and iBatis.
206 (depends on spring-core, spring-beans, spring-context, spring-tx)
207 Define this if you need ORM (org.springframework.orm.*)
208 -->
209 <dependency>
210 <groupId>org.springframework</groupId>
211 <artifactId>spring-orm</artifactId>
212 <version>${org.springframework.version}</version>
213 <scope>${lib_scope}</scope>
214 </dependency>
215
216 <!--
217 Object-to-XML Mapping (OXM) abstraction and integration with JAXB, JiBX, Castor, XStream, and XML Beans.
218 (depends on spring-core, spring-beans, spring-context)
219 Define this if you need OXM (org.springframework.oxm.*)
220 -->
221 <dependency>
222 <groupId>org.springframework</groupId>
223 <artifactId>spring-oxm</artifactId>
224 <version>${org.springframework.version}</version>
225 <scope>${lib_scope}</scope>
226 </dependency>
227
228 <!--
229 Web application development utilities applicable to both Servlet and Portlet Environments
230 (depends on spring-core, spring-beans, spring-context)
231 Define this if you use Spring MVC, or wish to use Struts, JSF, or another web framework with Spring (org.springframework.web.*)
232 -->
233 <dependency>
234 <groupId>org.springframework</groupId>
235 <artifactId>spring-web</artifactId>
236 <version>${org.springframework.version}</version>
237 <scope>${lib_scope}</scope>
238 </dependency>
239
240 <!--
241 Spring MVC for Servlet Environments (depends on spring-core, spring-beans, spring-context, spring-web)
242 Define this if you use Spring MVC with a Servlet Container such as Apache Tomcat (org.springframework.web.servlet.*)
243 -->
244 <dependency>
245 <groupId>org.springframework</groupId>
246 <artifactId>spring-webmvc</artifactId>
247 <version>${org.springframework.version}</version>
248 <scope>${lib_scope}</scope>
249 </dependency>
250
251 <dependency>
252 <groupId>org.atmosphere</groupId>
253 <artifactId>atmosphere-runtime</artifactId>
254 <version>2.4.5</version>
255 <scope>${lib_scope}</scope>
256 </dependency>
257
258</dependencies>
259<build>
260 <plugins>
261 <plugin>
262 <groupId>org.apache.maven.plugins</groupId>
263 <artifactId>maven-surefire-plugin</artifactId>
264 <version>2.19.1</version>
265 <configuration>
266 <testFailureIgnore>true</testFailureIgnore>
267 </configuration>
268 </plugin>
269
270
271 <plugin>
272 <groupId>org.apache.maven.plugins</groupId>
273 <artifactId>maven-antrun-plugin</artifactId>
274 <version>1.6</version>
275 <executions>
276 <execution>
277 <id>unzip-war</id>
278 <phase>package</phase>
279 <configuration>
280 <tasks>
281 <echo message="unzip phase"/>
282 <unzip src="${project.build.directory}/${project.build.finalName}.war"
283 dest="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca"/>
284 <delete dir="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/css/joined/"/>
285 <delete dir="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/css/notjoined/"/>
286 <delete dir="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/js/joined/"/>
287 <delete file="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/js/jquery-1.7.11.0.js"/>
288 <delete file="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/js/jquery-1.7.1.min1.0.js"/>
289 <delete file="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/js/jquery-1.7.1.js"/>
290 </tasks>
291 </configuration>
292 <goals>
293 <goal>run</goal>
294 </goals>
295 </execution>
296 </executions>
297 </plugin>
298 <plugin>
299 <artifactId>maven-compiler-plugin</artifactId>
300 <configuration>
301 <source>1.7</source>
302 <target>1.7</target>
303 </configuration>
304 </plugin>
305
306 <plugin>
307 <groupId>org.apache.maven.plugins</groupId>
308 <artifactId>maven-war-plugin</artifactId>
309 <version>2.2</version>
310 <executions>
311 <execution>
312 <id>package-with-source-js-css</id>
313 <phase>package</phase>
314 </execution>
315 </executions>
316 </plugin>
317
318
319 <plugin>
320 <groupId>net.alchim31.maven</groupId>
321 <artifactId>yuicompressor-maven-plugin</artifactId>
322 <version>1.3.0</version>
323 <executions>
324 <execution>
325 <phase>process-sources</phase>
326 <goals>
327 <goal>compress</goal>
328 </goals>
329 </execution>
330 </executions>
331 <configuration>
332 <statistics>true</statistics>
333 <nosuffix>false</nosuffix>
334 <failOnWarning>false</failOnWarning>
335 <gzip>false</gzip>
336 <suffix>${TR-CA-VERSION}</suffix>
337 <aggregations>
338 <aggregation>
339 <removeIncluded>false</removeIncluded>
340 <inputDir>src/main/webapp/css/joined</inputDir>
341 <includes>
342 <include>**/*.css</include>
343 </includes>
344 <output>${project.build.directory}/${project.build.finalName}/css/all.css</output>
345 </aggregation>
346 <aggregation>
347 <removeIncluded>false</removeIncluded>
348 <inputDir>src/main/webapp/css/joinedNew</inputDir>
349 <includes>
350 <include>**/*.css</include>
351 </includes>
352 <output>${project.build.directory}/${project.build.finalName}/css/allnew.css</output>
353 </aggregation>
354 <aggregation>
355 <!-- remove files after aggregation (default: false) -->
356 <removeIncluded>false</removeIncluded>
357 <inputDir>src/main/webapp/js/joined</inputDir>
358 <includes>
359 <include>**/*.js</include>
360 </includes>
361 <output>${project.build.directory}/${project.build.finalName}/js/all.js</output>
362 </aggregation>
363 </aggregations>
364 </configuration>
365 </plugin>
366
367 </plugins>
368</build>
369
370<pluginRepositories>
371 <pluginRepository>
372 <name>oss.sonatype.org - github-releases</name>
373 <id>oss.sonatype.org-github-releases</id>
374 <url>http://oss.sonatype.org/content/repositories/github-releases</url>
375 </pluginRepository>
376</pluginRepositories>
377<?xml version="1.0" encoding="UTF-8"?>
378<bean class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
379 <property name="definitions">
380 <list>
381 <!--Set up your Tiles definition RIGHT HERE-->
382 <value>/WEB-INF/tiles.xml</value>
383 </list>
384 </property>
385</bean>
386
387<bean id="messageSource"
388 class="ru.berkana.crm.util.web.CustomMessageSource">
389 <property name="basename" value="/WEB-INF/classes/locales/strings_ru_STUDY_CLUB.properties" />
390 <property name="defaultEncoding" value="UTF-8"/>
391</bean>
392
393<bean id="localeResolver"
394 class="ru.berkana.crm.util.web.CustomLocaleResolver">
395</bean>
396<filter>
397 <filter-name>EncodingFilter</filter-name>
398 <filter-class>ru.berkana.crm.util.web.AllRequestsFilter</filter-class>
399</filter>
400<filter-mapping>
401 <filter-name>EncodingFilter</filter-name>
402 <url-pattern>/*</url-pattern>
403</filter-mapping>
404
405<listener>
406 <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
407</listener>
408
409<listener>
410 <listener-class>ru.berkana.crm.util.web.ContextLoaderListener</listener-class>
411</listener>
412
413<listener>
414 <listener-class>ru.berkana.crm.util.web.TRCASessionListener</listener-class>
415</listener>
416
417<servlet>
418 <servlet-name>springservlet</servlet-name>
419 <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
420 <load-on-startup>1</load-on-startup>
421</servlet>
422
423<servlet>
424 <servlet-name>changepassword</servlet-name>
425 <servlet-class>ru.berkana.crm.util.web.ChangePasswordServlet</servlet-class>
426</servlet>
427
428<servlet>
429 <servlet-name>login</servlet-name>
430 <jsp-file>/tiles/login.jsp</jsp-file>
431</servlet>
432
433<servlet>
434 <servlet-name>zadarma</servlet-name>
435 <servlet-class>ru.berkana.crm.providers.servlets.ZadarmaAPIServlet</servlet-class>
436</servlet>
437
438<servlet>
439 <servlet-name>mango</servlet-name>
440 <servlet-class>ru.berkana.crm.providers.servlets.MangoAPIServlet</servlet-class>
441</servlet>
442
443<servlet>
444 <servlet-name>robomarket</servlet-name>
445 <servlet-class>ru.berkana.crm.robomarket.RobomarketAPIServlet</servlet-class>
446</servlet>
447
448<servlet>
449 <servlet-name>robokassa</servlet-name>
450 <servlet-class>ru.berkana.crm.robomarket.RobokassaAPIServlet</servlet-class>
451</servlet>
452
453<servlet>
454 <servlet-name>push_callback</servlet-name>
455 <jsp-file>/pages/pushcallback.jsp</jsp-file>
456</servlet>
457
458<servlet>
459 <servlet-name>push_confirm</servlet-name>
460 <servlet-class>ru.berkana.crm.providers.servlets.PushConfirmServlet</servlet-class>
461</servlet>
462
463<servlet>
464 <servlet-name>push</servlet-name>
465 <servlet-class>org.atmosphere.cpr.MeteorServlet</servlet-class>
466 <init-param>
467 <param-name>org.atmosphere.servlet</param-name>
468 <param-value>org.springframework.web.servlet.DispatcherServlet</param-value>
469 </init-param>
470 <init-param>
471 <param-name>contextClass</param-name>
472 <param-value>
473 org.springframework.web.context.support.AnnotationConfigWebApplicationContext
474 </param-value>
475 </init-param>
476 <init-param>
477 <param-name>org.atmosphere.useNative</param-name>
478 <param-value>true</param-value>
479 </init-param>
480 <init-param>
481 <param-name>org.atmosphere.websocket.suppressJSR356</param-name>
482 <param-value>true</param-value>
483 </init-param>
484 <load-on-startup>1</load-on-startup>
485</servlet>
486
487
488<filter>
489 <filter-name>springSecurityFilterChain</filter-name>
490 <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
491</filter>
492
493<filter>
494 <filter-name>loginredirection</filter-name>
495 <filter-class>ru.berkana.crm.security.LoginRedirectionFilter</filter-class>
496</filter>
497
498
499<filter-mapping>
500 <filter-name>springSecurityFilterChain</filter-name>
501 <url-pattern>/*</url-pattern>
502</filter-mapping>
503
504<filter-mapping>
505 <filter-name>loginredirection</filter-name>
506 <url-pattern>/login</url-pattern>
507</filter-mapping>
508
509<servlet-mapping>
510 <servlet-name>login</servlet-name>
511 <url-pattern>/login</url-pattern>
512</servlet-mapping>
513
514
515<servlet-mapping>
516 <servlet-name>changepassword</servlet-name>
517 <url-pattern>/changePassword.htm</url-pattern>
518</servlet-mapping>
519
520<servlet-mapping>
521 <servlet-name>zadarma</servlet-name>
522 <url-pattern>/zadarmaapi.htm</url-pattern>
523</servlet-mapping>
524
525<servlet-mapping>
526 <servlet-name>mango</servlet-name>
527 <url-pattern>/mangoapi.htm</url-pattern>
528</servlet-mapping>
529
530<servlet-mapping>
531 <servlet-name>mango</servlet-name>
532 <url-pattern>/mangoapi/*</url-pattern> <!-- mango api test-->
533</servlet-mapping>
534
535<servlet-mapping>
536 <servlet-name>mango</servlet-name>
537 <url-pattern>/mangoapi/events/call</url-pattern> <!-- mango api test-->
538</servlet-mapping>
539
540<servlet-mapping>
541 <servlet-name>robomarket</servlet-name>
542 <url-pattern>/robomarketapi.htm</url-pattern>
543</servlet-mapping>
544
545<servlet-mapping>
546 <servlet-name>push</servlet-name>
547 <url-pattern>/push.htm</url-pattern>
548</servlet-mapping>
549
550<servlet-mapping>
551 <servlet-name>push_confirm</servlet-name>
552 <url-pattern>/pushconfirm</url-pattern>
553</servlet-mapping>
554
555<servlet-mapping>
556 <servlet-name>push_callback</servlet-name>
557 <url-pattern>/pushcallback.htm</url-pattern>
558</servlet-mapping>
559
560<servlet-mapping>
561 <servlet-name>springservlet</servlet-name>
562 <url-pattern>*.htm</url-pattern>
563</servlet-mapping>
564
565<servlet-mapping>
566 <servlet-name>robokassa</servlet-name>
567 <url-pattern>/robokassa.htm</url-pattern>
568</servlet-mapping>
569
570<error-page>
571 <error-code>500</error-code>
572 <location>/tiles/error.jsp</location>
573</error-page>
574
575<error-page>
576 <error-code>404</error-code>
577 <location>/tiles/error404.jsp</location>
578</error-page>
579
580<session-config>
581 <session-timeout>30</session-timeout>
582</session-config>
583
What I've already done:
Added spring-asm-3.1.4.RELEASE.jar
cleared the cache
Added to pom.xml
1src
2 -main
3 -webapp
4 -js
5 -pages
6 -css
7 -tiles
8 -WEB-INF
9 -web.xml
10 -tiles.xml
11 -springservlet-servlet.xml
12 -applicationContext.xml
13 -pom.xml
14<packaging>war</packaging>
15<version>1.0</version>
16<!-- Shared version number properties -->
17
18<properties>
19 <org.springframework.version>3.1.0.RELEASE</org.springframework.version>
20 <TR-CA-VERSION>1.0</TR-CA-VERSION>
21 <lib_scope>provided</lib_scope>
22 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23 <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
24</properties>
25
26
27<profiles>
28 <profile>
29 <id>local-dev</id>
30 <activation>
31 <activeByDefault>true</activeByDefault>
32 </activation>
33 <build>
34 <plugins>
35 <plugin>
36 <groupId>org.apache.maven.plugins</groupId>
37 <artifactId>maven-antrun-plugin</artifactId>
38 <version>1.6</version>
39 <executions>
40 <execution>
41 <id>unzip-war</id>
42 <phase>none</phase> <!-- this disables plugin -->
43 </execution>
44 </executions>
45 </plugin>
46 </plugins>
47 </build>
48 </profile>
49 <profile>
50 <id>production-artifact-compilation</id>
51 <activation>
52 <property>
53 <name>env</name>
54 <value>production-artifact-compilation</value>
55 </property>
56 </activation>
57
58 </profile>
59</profiles>
60
61
62
63<dependencies>
64 <dependency>
65 <groupId>ru.berkana</groupId>
66 <artifactId>crm-server</artifactId>
67 <version>1.0</version>
68 <scope>compile</scope>
69 </dependency>
70
71 <dependency>
72 <groupId>org.springframework</groupId>
73 <artifactId>spring-context</artifactId>
74 <version>${org.springframework.version}</version>
75 </dependency>
76
77 <dependency>
78 <groupId>org.springframework.boot</groupId>
79 <artifactId>spring-boot-starter-web</artifactId>
80 <version>2.3.1.RELEASE</version>
81 <exclusions>
82 <exclusion>
83 <groupId>org.springframework.boot</groupId>
84 <artifactId>spring-boot-starter-tomcat</artifactId>
85 </exclusion>
86 </exclusions>
87 </dependency>
88
89 <dependency>
90 <groupId>commons-logging</groupId>
91 <artifactId>commons-logging</artifactId>
92 <version>1.1.1</version>
93 <scope>${lib_scope}</scope>
94 </dependency>
95 <!--
96 Core utilities used by other modules.
97 Define this if you use Spring Utility APIs (org.springframework.core.*/org.springframework.util.*)
98 -->
99 <dependency>
100 <groupId>org.springframework</groupId>
101 <artifactId>spring-core</artifactId>
102 <version>${org.springframework.version}</version>
103 <scope>${lib_scope}</scope>
104 </dependency>
105
106 <!--
107 Expression Language (depends on spring-core)
108 Define this if you use Spring Expression APIs (org.springframework.expression.*)
109 -->
110 <dependency>
111 <groupId>org.springframework</groupId>
112 <artifactId>spring-expression</artifactId>
113 <version>${org.springframework.version}</version>
114 <scope>${lib_scope}</scope>
115 </dependency>
116
117 <!--
118 Bean Factory and JavaBeans utilities (depends on spring-core)
119 Define this if you use Spring Bean APIs (org.springframework.beans.*)
120 -->
121 <dependency>
122 <groupId>org.springframework</groupId>
123 <artifactId>spring-beans</artifactId>
124 <version>${org.springframework.version}</version>
125 <scope>${lib_scope}</scope>
126 </dependency>
127
128 <!--
129 Aspect Oriented Programming (AOP) Framework (depends on spring-core, spring-beans)
130 Define this if you use Spring AOP APIs (org.springframework.aop.*)
131 -->
132 <dependency>
133 <groupId>org.springframework</groupId>
134 <artifactId>spring-aop</artifactId>
135 <version>${org.springframework.version}</version>
136 <scope>${lib_scope}</scope>
137 </dependency>
138
139 <!--
140 Application Context (depends on spring-core, spring-expression, spring-aop, spring-beans)
141 This is the central artifact for Spring's Dependency Injection Container and is generally always defined
142 -->
143 <dependency>
144 <groupId>org.springframework</groupId>
145 <artifactId>spring-context</artifactId>
146 <version>${org.springframework.version}</version>
147 <exclusions>
148 <exclusion>
149 <groupId>commons-logging</groupId>
150 <artifactId>commons-logging</artifactId>
151 </exclusion>
152 </exclusions>
153 <scope>${lib_scope}</scope>
154 </dependency>
155
156 <dependency>
157 <groupId>org.springframework.security</groupId>
158 <artifactId>spring-security-core</artifactId>
159 <version>${org.springframework.version}</version>
160 <scope>${lib_scope}</scope>
161 </dependency>
162
163 <dependency>
164 <groupId>org.apache.commons</groupId>
165 <artifactId>commons-io</artifactId>
166 <version>1.3.2</version>
167 <scope>${lib_scope}</scope>
168 </dependency>
169
170 <!--
171 Various Application Context utilities, including EhCache, JavaMail, Quartz, and Freemarker integration
172 Define this if you need any of these integrations
173 -->
174 <dependency>
175 <groupId>org.springframework</groupId>
176 <artifactId>spring-context-support</artifactId>
177 <version>${org.springframework.version}</version>
178 <scope>${lib_scope}</scope>
179 </dependency>
180
181 <!--
182 Transaction Management Abstraction (depends on spring-core, spring-beans, spring-aop, spring-context)
183 Define this if you use Spring Transactions or DAO Exception Hierarchy
184 (org.springframework.transaction.*/org.springframework.dao.*)
185 -->
186 <dependency>
187 <groupId>org.springframework</groupId>
188 <artifactId>spring-tx</artifactId>
189 <version>${org.springframework.version}</version>
190 <scope>${lib_scope}</scope>
191 </dependency>
192
193 <!--
194 JDBC Data Access Library (depends on spring-core, spring-beans, spring-context, spring-tx)
195 Define this if you use Spring's JdbcTemplate API (org.springframework.jdbc.*)
196 -->
197 <dependency>
198 <groupId>org.springframework</groupId>
199 <artifactId>spring-jdbc</artifactId>
200 <version>${org.springframework.version}</version>
201 <scope>${lib_scope}</scope>
202 </dependency>
203
204 <!--
205 Object-to-Relation-Mapping (ORM) integration with Hibernate, JPA, and iBatis.
206 (depends on spring-core, spring-beans, spring-context, spring-tx)
207 Define this if you need ORM (org.springframework.orm.*)
208 -->
209 <dependency>
210 <groupId>org.springframework</groupId>
211 <artifactId>spring-orm</artifactId>
212 <version>${org.springframework.version}</version>
213 <scope>${lib_scope}</scope>
214 </dependency>
215
216 <!--
217 Object-to-XML Mapping (OXM) abstraction and integration with JAXB, JiBX, Castor, XStream, and XML Beans.
218 (depends on spring-core, spring-beans, spring-context)
219 Define this if you need OXM (org.springframework.oxm.*)
220 -->
221 <dependency>
222 <groupId>org.springframework</groupId>
223 <artifactId>spring-oxm</artifactId>
224 <version>${org.springframework.version}</version>
225 <scope>${lib_scope}</scope>
226 </dependency>
227
228 <!--
229 Web application development utilities applicable to both Servlet and Portlet Environments
230 (depends on spring-core, spring-beans, spring-context)
231 Define this if you use Spring MVC, or wish to use Struts, JSF, or another web framework with Spring (org.springframework.web.*)
232 -->
233 <dependency>
234 <groupId>org.springframework</groupId>
235 <artifactId>spring-web</artifactId>
236 <version>${org.springframework.version}</version>
237 <scope>${lib_scope}</scope>
238 </dependency>
239
240 <!--
241 Spring MVC for Servlet Environments (depends on spring-core, spring-beans, spring-context, spring-web)
242 Define this if you use Spring MVC with a Servlet Container such as Apache Tomcat (org.springframework.web.servlet.*)
243 -->
244 <dependency>
245 <groupId>org.springframework</groupId>
246 <artifactId>spring-webmvc</artifactId>
247 <version>${org.springframework.version}</version>
248 <scope>${lib_scope}</scope>
249 </dependency>
250
251 <dependency>
252 <groupId>org.atmosphere</groupId>
253 <artifactId>atmosphere-runtime</artifactId>
254 <version>2.4.5</version>
255 <scope>${lib_scope}</scope>
256 </dependency>
257
258</dependencies>
259<build>
260 <plugins>
261 <plugin>
262 <groupId>org.apache.maven.plugins</groupId>
263 <artifactId>maven-surefire-plugin</artifactId>
264 <version>2.19.1</version>
265 <configuration>
266 <testFailureIgnore>true</testFailureIgnore>
267 </configuration>
268 </plugin>
269
270
271 <plugin>
272 <groupId>org.apache.maven.plugins</groupId>
273 <artifactId>maven-antrun-plugin</artifactId>
274 <version>1.6</version>
275 <executions>
276 <execution>
277 <id>unzip-war</id>
278 <phase>package</phase>
279 <configuration>
280 <tasks>
281 <echo message="unzip phase"/>
282 <unzip src="${project.build.directory}/${project.build.finalName}.war"
283 dest="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca"/>
284 <delete dir="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/css/joined/"/>
285 <delete dir="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/css/notjoined/"/>
286 <delete dir="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/js/joined/"/>
287 <delete file="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/js/jquery-1.7.11.0.js"/>
288 <delete file="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/js/jquery-1.7.1.min1.0.js"/>
289 <delete file="C:/Users/Наталья/IdeaProjects/Berkana/tr-ca-private-cs/common/1/current/web/trca/js/jquery-1.7.1.js"/>
290 </tasks>
291 </configuration>
292 <goals>
293 <goal>run</goal>
294 </goals>
295 </execution>
296 </executions>
297 </plugin>
298 <plugin>
299 <artifactId>maven-compiler-plugin</artifactId>
300 <configuration>
301 <source>1.7</source>
302 <target>1.7</target>
303 </configuration>
304 </plugin>
305
306 <plugin>
307 <groupId>org.apache.maven.plugins</groupId>
308 <artifactId>maven-war-plugin</artifactId>
309 <version>2.2</version>
310 <executions>
311 <execution>
312 <id>package-with-source-js-css</id>
313 <phase>package</phase>
314 </execution>
315 </executions>
316 </plugin>
317
318
319 <plugin>
320 <groupId>net.alchim31.maven</groupId>
321 <artifactId>yuicompressor-maven-plugin</artifactId>
322 <version>1.3.0</version>
323 <executions>
324 <execution>
325 <phase>process-sources</phase>
326 <goals>
327 <goal>compress</goal>
328 </goals>
329 </execution>
330 </executions>
331 <configuration>
332 <statistics>true</statistics>
333 <nosuffix>false</nosuffix>
334 <failOnWarning>false</failOnWarning>
335 <gzip>false</gzip>
336 <suffix>${TR-CA-VERSION}</suffix>
337 <aggregations>
338 <aggregation>
339 <removeIncluded>false</removeIncluded>
340 <inputDir>src/main/webapp/css/joined</inputDir>
341 <includes>
342 <include>**/*.css</include>
343 </includes>
344 <output>${project.build.directory}/${project.build.finalName}/css/all.css</output>
345 </aggregation>
346 <aggregation>
347 <removeIncluded>false</removeIncluded>
348 <inputDir>src/main/webapp/css/joinedNew</inputDir>
349 <includes>
350 <include>**/*.css</include>
351 </includes>
352 <output>${project.build.directory}/${project.build.finalName}/css/allnew.css</output>
353 </aggregation>
354 <aggregation>
355 <!-- remove files after aggregation (default: false) -->
356 <removeIncluded>false</removeIncluded>
357 <inputDir>src/main/webapp/js/joined</inputDir>
358 <includes>
359 <include>**/*.js</include>
360 </includes>
361 <output>${project.build.directory}/${project.build.finalName}/js/all.js</output>
362 </aggregation>
363 </aggregations>
364 </configuration>
365 </plugin>
366
367 </plugins>
368</build>
369
370<pluginRepositories>
371 <pluginRepository>
372 <name>oss.sonatype.org - github-releases</name>
373 <id>oss.sonatype.org-github-releases</id>
374 <url>http://oss.sonatype.org/content/repositories/github-releases</url>
375 </pluginRepository>
376</pluginRepositories>
377<?xml version="1.0" encoding="UTF-8"?>
378<bean class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
379 <property name="definitions">
380 <list>
381 <!--Set up your Tiles definition RIGHT HERE-->
382 <value>/WEB-INF/tiles.xml</value>
383 </list>
384 </property>
385</bean>
386
387<bean id="messageSource"
388 class="ru.berkana.crm.util.web.CustomMessageSource">
389 <property name="basename" value="/WEB-INF/classes/locales/strings_ru_STUDY_CLUB.properties" />
390 <property name="defaultEncoding" value="UTF-8"/>
391</bean>
392
393<bean id="localeResolver"
394 class="ru.berkana.crm.util.web.CustomLocaleResolver">
395</bean>
396<filter>
397 <filter-name>EncodingFilter</filter-name>
398 <filter-class>ru.berkana.crm.util.web.AllRequestsFilter</filter-class>
399</filter>
400<filter-mapping>
401 <filter-name>EncodingFilter</filter-name>
402 <url-pattern>/*</url-pattern>
403</filter-mapping>
404
405<listener>
406 <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
407</listener>
408
409<listener>
410 <listener-class>ru.berkana.crm.util.web.ContextLoaderListener</listener-class>
411</listener>
412
413<listener>
414 <listener-class>ru.berkana.crm.util.web.TRCASessionListener</listener-class>
415</listener>
416
417<servlet>
418 <servlet-name>springservlet</servlet-name>
419 <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
420 <load-on-startup>1</load-on-startup>
421</servlet>
422
423<servlet>
424 <servlet-name>changepassword</servlet-name>
425 <servlet-class>ru.berkana.crm.util.web.ChangePasswordServlet</servlet-class>
426</servlet>
427
428<servlet>
429 <servlet-name>login</servlet-name>
430 <jsp-file>/tiles/login.jsp</jsp-file>
431</servlet>
432
433<servlet>
434 <servlet-name>zadarma</servlet-name>
435 <servlet-class>ru.berkana.crm.providers.servlets.ZadarmaAPIServlet</servlet-class>
436</servlet>
437
438<servlet>
439 <servlet-name>mango</servlet-name>
440 <servlet-class>ru.berkana.crm.providers.servlets.MangoAPIServlet</servlet-class>
441</servlet>
442
443<servlet>
444 <servlet-name>robomarket</servlet-name>
445 <servlet-class>ru.berkana.crm.robomarket.RobomarketAPIServlet</servlet-class>
446</servlet>
447
448<servlet>
449 <servlet-name>robokassa</servlet-name>
450 <servlet-class>ru.berkana.crm.robomarket.RobokassaAPIServlet</servlet-class>
451</servlet>
452
453<servlet>
454 <servlet-name>push_callback</servlet-name>
455 <jsp-file>/pages/pushcallback.jsp</jsp-file>
456</servlet>
457
458<servlet>
459 <servlet-name>push_confirm</servlet-name>
460 <servlet-class>ru.berkana.crm.providers.servlets.PushConfirmServlet</servlet-class>
461</servlet>
462
463<servlet>
464 <servlet-name>push</servlet-name>
465 <servlet-class>org.atmosphere.cpr.MeteorServlet</servlet-class>
466 <init-param>
467 <param-name>org.atmosphere.servlet</param-name>
468 <param-value>org.springframework.web.servlet.DispatcherServlet</param-value>
469 </init-param>
470 <init-param>
471 <param-name>contextClass</param-name>
472 <param-value>
473 org.springframework.web.context.support.AnnotationConfigWebApplicationContext
474 </param-value>
475 </init-param>
476 <init-param>
477 <param-name>org.atmosphere.useNative</param-name>
478 <param-value>true</param-value>
479 </init-param>
480 <init-param>
481 <param-name>org.atmosphere.websocket.suppressJSR356</param-name>
482 <param-value>true</param-value>
483 </init-param>
484 <load-on-startup>1</load-on-startup>
485</servlet>
486
487
488<filter>
489 <filter-name>springSecurityFilterChain</filter-name>
490 <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
491</filter>
492
493<filter>
494 <filter-name>loginredirection</filter-name>
495 <filter-class>ru.berkana.crm.security.LoginRedirectionFilter</filter-class>
496</filter>
497
498
499<filter-mapping>
500 <filter-name>springSecurityFilterChain</filter-name>
501 <url-pattern>/*</url-pattern>
502</filter-mapping>
503
504<filter-mapping>
505 <filter-name>loginredirection</filter-name>
506 <url-pattern>/login</url-pattern>
507</filter-mapping>
508
509<servlet-mapping>
510 <servlet-name>login</servlet-name>
511 <url-pattern>/login</url-pattern>
512</servlet-mapping>
513
514
515<servlet-mapping>
516 <servlet-name>changepassword</servlet-name>
517 <url-pattern>/changePassword.htm</url-pattern>
518</servlet-mapping>
519
520<servlet-mapping>
521 <servlet-name>zadarma</servlet-name>
522 <url-pattern>/zadarmaapi.htm</url-pattern>
523</servlet-mapping>
524
525<servlet-mapping>
526 <servlet-name>mango</servlet-name>
527 <url-pattern>/mangoapi.htm</url-pattern>
528</servlet-mapping>
529
530<servlet-mapping>
531 <servlet-name>mango</servlet-name>
532 <url-pattern>/mangoapi/*</url-pattern> <!-- mango api test-->
533</servlet-mapping>
534
535<servlet-mapping>
536 <servlet-name>mango</servlet-name>
537 <url-pattern>/mangoapi/events/call</url-pattern> <!-- mango api test-->
538</servlet-mapping>
539
540<servlet-mapping>
541 <servlet-name>robomarket</servlet-name>
542 <url-pattern>/robomarketapi.htm</url-pattern>
543</servlet-mapping>
544
545<servlet-mapping>
546 <servlet-name>push</servlet-name>
547 <url-pattern>/push.htm</url-pattern>
548</servlet-mapping>
549
550<servlet-mapping>
551 <servlet-name>push_confirm</servlet-name>
552 <url-pattern>/pushconfirm</url-pattern>
553</servlet-mapping>
554
555<servlet-mapping>
556 <servlet-name>push_callback</servlet-name>
557 <url-pattern>/pushcallback.htm</url-pattern>
558</servlet-mapping>
559
560<servlet-mapping>
561 <servlet-name>springservlet</servlet-name>
562 <url-pattern>*.htm</url-pattern>
563</servlet-mapping>
564
565<servlet-mapping>
566 <servlet-name>robokassa</servlet-name>
567 <url-pattern>/robokassa.htm</url-pattern>
568</servlet-mapping>
569
570<error-page>
571 <error-code>500</error-code>
572 <location>/tiles/error.jsp</location>
573</error-page>
574
575<error-page>
576 <error-code>404</error-code>
577 <location>/tiles/error404.jsp</location>
578</error-page>
579
580<session-config>
581 <session-timeout>30</session-timeout>
582</session-config>
583 <dependency>
584 <groupId>org.springframework.boot</groupId>
585 <artifactId>spring-boot-starter-web</artifactId>
586 <version>2.3.1.RELEASE</version>
587 <exclusions>
588 <exclusion>
589 <groupId>org.springframework.boot</groupId>
590 <artifactId>spring-boot-starter-tomcat</artifactId>
591 </exclusion>
592 </exclusions>
593 </dependency>
594
ANSWER
Answered 2020-Nov-13 at 12:51I was able to solve the problem by moving all the necessary jars to the WEB-INF/lib folder. Turns out they were in a different directory
QUESTION
Is it Possible to add PostSharp for dynamic compilation using c# compiler
Asked 2020-Aug-17 at 10:26I am using Microsoft.CodeDom.Providers.DotNetCompilerPlatform
nuget packge for compilation of code at runtime. It is achievable but in my scenario my dynamic class needs to use Postsharp
for aspect oriented programming.
Can anyone point me to the commandline support to add Postsharp
dependency injection for the compiled assembly using the csc.exe
, like what is done by the MSBuild or Visualstudio.
ANSWER
Answered 2020-Aug-17 at 10:26You can't easily do that with the current versions of PostSharp. The last version to have command-line execution is 5.0 and that is no longer supported.
The problem is that PostSharp reads too many properties in MSBuild or passed to it by MSBuild.
If it's possible for you to generate an msbuild file, you can then build it the Microsoft.Build NuGet package and have PostSharp run on the generated code that way.
QUESTION
Check User Authorization with Aspect Oriented Programming in Asp.Net Core 3.1 Web Api
Asked 2020-Mar-02 at 10:03I want to check user authorization in the api method.
Method responsible for get for an employee by id. So user should render this method if the user works the same company with employee. So I mean user CompanyId should be same with the Employee CompanyId.
Think about like this api method:
1 public async Task<IActionResult> GetEmployeeById([FromRoute]int id)
2 {
3 try
4 {
5 var entity = await _employeeRepository.GetAsync(p => p.Id == id);
6 if (entity == null)
7 {
8 return NotFound();
9 }
10
11 //user's CompanyId should be same with Employee CompanyId
12 var user = await _userManager.FindByIdAsync(User.Identity.Name);
13
14 if (user.CompanyId != eployee.CompanyId)
15 {
16 return Unauthorized();
17 }
18
19 return Ok(entity);
20 }
21 catch (Exception ex)
22 {
23 throw ex;
24 }
25 }
26
I have to check user company in all api methods. So I want to do this by Aspect Oriented Programming.So method should be like this after AOP implementation:
1 public async Task<IActionResult> GetEmployeeById([FromRoute]int id)
2 {
3 try
4 {
5 var entity = await _employeeRepository.GetAsync(p => p.Id == id);
6 if (entity == null)
7 {
8 return NotFound();
9 }
10
11 //user's CompanyId should be same with Employee CompanyId
12 var user = await _userManager.FindByIdAsync(User.Identity.Name);
13
14 if (user.CompanyId != eployee.CompanyId)
15 {
16 return Unauthorized();
17 }
18
19 return Ok(entity);
20 }
21 catch (Exception ex)
22 {
23 throw ex;
24 }
25 }
26 [CheckUserCompany]
27 public async Task<IActionResult> GetEmployeeById([FromRoute]int id)
28 {
29 try
30 {
31 var entity = await _employeeRepository.GetAsync(p => p.Id == id);
32 if (entity == null)
33 {
34 return NotFound();
35 }
36
37 return Ok(entity);
38 }
39 catch (Exception ex)
40 {
41 throw ex;
42 }
43 }
44
How can I do this with Aspect Oriented Programming in Asp.Net Core 3.1 Web Api?
Thanks
ANSWER
Answered 2020-Mar-02 at 10:03You could customize a ActionFilter like below:
1 public async Task<IActionResult> GetEmployeeById([FromRoute]int id)
2 {
3 try
4 {
5 var entity = await _employeeRepository.GetAsync(p => p.Id == id);
6 if (entity == null)
7 {
8 return NotFound();
9 }
10
11 //user's CompanyId should be same with Employee CompanyId
12 var user = await _userManager.FindByIdAsync(User.Identity.Name);
13
14 if (user.CompanyId != eployee.CompanyId)
15 {
16 return Unauthorized();
17 }
18
19 return Ok(entity);
20 }
21 catch (Exception ex)
22 {
23 throw ex;
24 }
25 }
26 [CheckUserCompany]
27 public async Task<IActionResult> GetEmployeeById([FromRoute]int id)
28 {
29 try
30 {
31 var entity = await _employeeRepository.GetAsync(p => p.Id == id);
32 if (entity == null)
33 {
34 return NotFound();
35 }
36
37 return Ok(entity);
38 }
39 catch (Exception ex)
40 {
41 throw ex;
42 }
43 }
44 public class CheckUserCompany:IActionFilter
45{
46 private readonly ApplicationDbContext _dbcontext;
47 private readonly UserManager<ApplicationUser> _userManager;
48 public CheckUserCompany(ApplicationDbContext dbcontext, UserManager<ApplicationUser> userManager)
49 {
50 _dbcontext = dbcontext;
51 _userManager = userManager;
52 }
53
54 // Do something before the action executes.
55 public void OnActionExecuting(ActionExecutingContext context)
56 {
57 var id = (int)context.ActionArguments["id"];
58 var employee = _dbcontext.Employee.Find(id);
59 var user = _userManager.FindByNameAsync(context.HttpContext.User.Identity.Name);
60
61 if (user.Result.CompanyId != employee.CompanyId)
62 {
63 throw new UnauthorizedAccessException();
64 }
65 return;
66 }
67
68 // Do something after the action executes.
69 public void OnActionExecuted(ActionExecutedContext context)
70 {
71 }
72}
73
If we want to use our filter as a service type on the Action or Controller level, we need to register it in the same ConfigureServices
method but as a service in the IoC container:
1 public async Task<IActionResult> GetEmployeeById([FromRoute]int id)
2 {
3 try
4 {
5 var entity = await _employeeRepository.GetAsync(p => p.Id == id);
6 if (entity == null)
7 {
8 return NotFound();
9 }
10
11 //user's CompanyId should be same with Employee CompanyId
12 var user = await _userManager.FindByIdAsync(User.Identity.Name);
13
14 if (user.CompanyId != eployee.CompanyId)
15 {
16 return Unauthorized();
17 }
18
19 return Ok(entity);
20 }
21 catch (Exception ex)
22 {
23 throw ex;
24 }
25 }
26 [CheckUserCompany]
27 public async Task<IActionResult> GetEmployeeById([FromRoute]int id)
28 {
29 try
30 {
31 var entity = await _employeeRepository.GetAsync(p => p.Id == id);
32 if (entity == null)
33 {
34 return NotFound();
35 }
36
37 return Ok(entity);
38 }
39 catch (Exception ex)
40 {
41 throw ex;
42 }
43 }
44 public class CheckUserCompany:IActionFilter
45{
46 private readonly ApplicationDbContext _dbcontext;
47 private readonly UserManager<ApplicationUser> _userManager;
48 public CheckUserCompany(ApplicationDbContext dbcontext, UserManager<ApplicationUser> userManager)
49 {
50 _dbcontext = dbcontext;
51 _userManager = userManager;
52 }
53
54 // Do something before the action executes.
55 public void OnActionExecuting(ActionExecutingContext context)
56 {
57 var id = (int)context.ActionArguments["id"];
58 var employee = _dbcontext.Employee.Find(id);
59 var user = _userManager.FindByNameAsync(context.HttpContext.User.Identity.Name);
60
61 if (user.Result.CompanyId != employee.CompanyId)
62 {
63 throw new UnauthorizedAccessException();
64 }
65 return;
66 }
67
68 // Do something after the action executes.
69 public void OnActionExecuted(ActionExecutedContext context)
70 {
71 }
72}
73services.AddScoped<CheckUserCompany>();
74
Finally, to use a filter registered on the Action or Controller level, we need to place it on top of the Controller or Action as a ServiceType:
1 public async Task<IActionResult> GetEmployeeById([FromRoute]int id)
2 {
3 try
4 {
5 var entity = await _employeeRepository.GetAsync(p => p.Id == id);
6 if (entity == null)
7 {
8 return NotFound();
9 }
10
11 //user's CompanyId should be same with Employee CompanyId
12 var user = await _userManager.FindByIdAsync(User.Identity.Name);
13
14 if (user.CompanyId != eployee.CompanyId)
15 {
16 return Unauthorized();
17 }
18
19 return Ok(entity);
20 }
21 catch (Exception ex)
22 {
23 throw ex;
24 }
25 }
26 [CheckUserCompany]
27 public async Task<IActionResult> GetEmployeeById([FromRoute]int id)
28 {
29 try
30 {
31 var entity = await _employeeRepository.GetAsync(p => p.Id == id);
32 if (entity == null)
33 {
34 return NotFound();
35 }
36
37 return Ok(entity);
38 }
39 catch (Exception ex)
40 {
41 throw ex;
42 }
43 }
44 public class CheckUserCompany:IActionFilter
45{
46 private readonly ApplicationDbContext _dbcontext;
47 private readonly UserManager<ApplicationUser> _userManager;
48 public CheckUserCompany(ApplicationDbContext dbcontext, UserManager<ApplicationUser> userManager)
49 {
50 _dbcontext = dbcontext;
51 _userManager = userManager;
52 }
53
54 // Do something before the action executes.
55 public void OnActionExecuting(ActionExecutingContext context)
56 {
57 var id = (int)context.ActionArguments["id"];
58 var employee = _dbcontext.Employee.Find(id);
59 var user = _userManager.FindByNameAsync(context.HttpContext.User.Identity.Name);
60
61 if (user.Result.CompanyId != employee.CompanyId)
62 {
63 throw new UnauthorizedAccessException();
64 }
65 return;
66 }
67
68 // Do something after the action executes.
69 public void OnActionExecuted(ActionExecutedContext context)
70 {
71 }
72}
73services.AddScoped<CheckUserCompany>();
74[ServiceFilter(typeof(CheckUserCompany))]
75public async Task<IActionResult> GetEmployeeById([FromRoute]int id)
76
QUESTION
Install AspectJ Eclipse
Asked 2020-Jan-05 at 15:41I'm trying to get started with aspect oriented programming. I'm using latest eclipse (currently 12-2019)
1public aspect Observer {
2
3}
4
This Results in an error
Syntax error on token "aspect", interface expected
According to https://www.eclipse.org/ajdt/downloads
I added http://download.eclipse.org/tools/ajdt/43/update
as an update site to eclipse
However eclipse tells me that some parts could not be installed
It looks Like some parts are missing
Cannot complete the install because one or more required items could not be found. Software being installed: AspectJ Development Tools 2.2.3.e43x-RELEASE-20130627-0800 (org.eclipse.ajdt.feature.group 2.2.3.e43x-RELEASE-20130627-0800) Missing requirement: AspectJ 1.7.3.20130613144500-a (org.aspectj.ajde 1.7.3.20130613144500-a) requires 'osgi.bundle; org.eclipse.core.runtime.compatibility 0.0.0' but it could not be found Cannot satisfy dependency: From: AspectJ Compiler 1.7.3.20130613144500-a (org.aspectj.feature.group 1.7.3.20130613144500-a) To: org.eclipse.equinox.p2.iu; org.aspectj.ajde [1.7.3.20130613144500-a,1.7.3.20130613144500-a] Cannot satisfy dependency: From: AspectJ Development Tools 2.2.3.e43x-RELEASE-20130627-0800 (org.eclipse.ajdt.feature.group 2.2.3.e43x-RELEASE-20130627-0800) To: org.eclipse.equinox.p2.iu; org.aspectj.feature.group [1.7.3.20130613144500-a,1.7.3.20130613144500-a]
How could I Get Aspects to run in Eclipse? Could you help me out?
ANSWER
Answered 2020-Jan-05 at 14:42Your problem caused by the removal of org.eclipse.core.runtime.compatibility
plugin from Eclipse 4.6 .
Read more about this problem here.
The correct solution is to:
Install AspectJ
from the correct download link.
The most updated to Eclipse 4.10 is: http://download.eclipse.org/tools/ajdt/410/dev/update
Another solution is to:
Uninstall Eclipse.
Install Eclipse 4.3 (matching your
AspectJ
version) .Retry AspectJ install.
The more complex solution is:
Locate and build/extract
org.eclipse.core.runtime.compatibility
jar file from Maven repository.Put
org.eclipse.core.runtime.compatibility
jar file into Eclipse plugins directory.Run
eclipse
in--clean
mode to rebuild and register the added plugin.Retry AspectJ install.
You might encounter more missing dependencies for org.eclipse.core.runtime.compatibility
, eventually will have to load all the related plugins (long effort).
Community Discussions contain sources that include Stack Exchange Network
Tutorials and Learning Resources in Aspect Oriented
Tutorials and Learning Resources are not available at this moment for Aspect Oriented