AspectJExpressionPointcut unpredictable behavior in OSGi environment [SPR-10871] #15498
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: bulk-closed
An outdated, unresolved issue that's closed in bulk as part of a cleaning process
Temnov Aleksey opened SPR-10871 and commented
Hi,
We have a java application consisting of multiple OSGi modules running with Apache Felix container. Spring DM is responsible for loading spring application contexts of our bundles.
We faced this kind of error:
After some researching we found that this exception is thrown while trying to match this aop expression:
So, we looked up for an issue #13973 and made a small test project that represents the architecture of problematic funсtionality in our project. After we coded it, we faced another problem. Every time we start felix, we randomly get one of two different errors. One of them I already specified upwards and the other one is:
The logic of this functionality is very easy:
We have Bundle-1, that contains just one class, we called it "FirstAbstractClass".
Bundle-2 contains class "SecondAbstractClass" that extends "FirstAbstractClass" from bundle-1, aspect "CommonAspect" with expression that I specified earlier and an interface, called "MarkerInterface".
Bundle-3 contains OSGi service classes "ConcreteClass" and "ConcreteClassMarkered", that extend "SecondAbstractClass" and aspect declaration in bundle-3-context file:
This is it.
If you comment declaration of "concreteClass" bean in bundle-3 spring context, all the bundles will start fine, but if you comment "concreteClassMarkered" - application won't work.
If you import package of "FirstAbstractClass" from first bundle to third one - it will solve the problem. But I guess it's a weird workaround, and application should work perfectly without it.
I guess, first type of error caused by using wrong classloader during aspect expression processing (guess it was classloader from bundle-1, that can't see bundle-3 "MarkerInterface"). What causes the second one - I don't know.
So, we found that this is a wrong and unpredictable behavior and made this bug.
Test project is also commited to: spring-framework-issues SPR-10871
Affects: 3.2.4
Reference URL: https://github.com/bsko/Spring-SPR-9335-own
1 votes, 2 watchers
The text was updated successfully, but these errors were encountered: