New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unsafe fallback pointcut construction in AspectJExpressionPointcut [SPR-9335] #13973
Comments
Dietrich Schulten commented Same symptom and stacktrace on WebSphere 6.1 with a bean in request scope from a shared lib, which must be proxified in order to be request-scoped. Going back from 3.1.RELEASE to 3.0.7 solves the issue. For that bean there is no simple workaround since it must be request scoped. Excluding it from autoproxying is therefore not an option. Therefore I vote for this issue, it is a showstopper. What makes things worse is the fact that the error message points to a totally different class which is not used at all by the bean which cannot be instantiated, and it cannot match a fully qualified class name which is never mentioned as such in any pointcut. |
Chris Beams commented Krzysiek, thanks for the detailed analysis. I've added Dave Syer as a watcher here. The change he committed for #10419 seems to be the cause of this regression. It was pretty tricky stuff, so understandable that something might have cropped up as a side effect. |
Chris Beams commented ping for |
Dave Syer commented There has never been a unit test for all the catch blocks that refer to ReflectionWorldException in Spring AOP. I added some tests in 3.1 to spring-context for the groovy bug I was fixing, but that only hit the first catch block and I couldn't find a way to tickle the second one. Maybe we need to get Andy's opinion? Or maybe he could come up with a test case at least. |
Chris Beams commented Andy Clement, your thoughts? |
Dave Syer commented Dietrich Schulten: it seems your way of tickling the bug is easier to reproduce than the original post, but there wasn't enough detail for me to be able to do it. Can you make a test project (e.g. using the spring-issues project on github)? |
Chris Beams commented per Dave's comment, see https://github.com/SpringSource/spring-framework-issues#readme |
Chris Beams commented |
Krzysiek Kasprzyk commented Are there any plans for fixing this issue in 3.2.x or 4.0.x line? |
Juergen Hoeller commented We're defensively handling fallback expression parsing now, never causing an exception from it. This will be available in both 4.0.4 and 3.2.9. Juergen |
Juergen Hoeller commented Krzysiek, does this work for you now, against 4.0.4 and/or the latest 3.2.9 snapshot? We'll be releasing 4.0.5 and 3.2.9 in about a week's time, so it's a great time to give it a try... Juergen |
Jason Day commented I was having the same issue when I upgraded from 3.0.4 to 3.2.8 (Apache Felix container + Eclipse blueprint 1.0.2). I pulled the 3.2.9.BUILD-SNAPSHOT and can confirm this change resolved the error for me. |
Juergen Hoeller commented Good to hear, Jason! Thanks for your feedback... Juergen |
Krzysiek Kasprzyk opened SPR-9335 and commented
Hi,
I have a Java EE application consisting of multiple OSGi bundles running within Apache Felix container on Weblogic 10.3. Spring DM Extender is responsible for loading application contexts of my Spring-powered bundles.
After switch from Spring 3.0.5.RELEASE to Spring 3.1.1.RELEASE the following error arised in a couple of bundles:
It prevents some bundles from starting successfully. I did some debugging and found out that this exception is thrown while
AspectJAwareAdvisorAutoProxyCreator
is trying to matchpointcut against a bean which is actually an object retrieved from Weblogic JNDI registry (
weblogic.jdbc.common.internal.RmiDataSource
data source to be precise).pl.some.package.SomeClass
is my bundle's internal class that is visible only to classloader dedicated to this bundle. On the other hand bundle's classloader is unable to load Weblogic'sweblogic.jdbc.common.internal.RmiDataSource
class.After a small investigation i discovered that the following change in
org.springframework.aop.aspectj.AspectJExpressionPointcut.getShadowMatch()
method is responsible for mentioned error:versus
Normally
AspectJExpressionPointcut
buildsPointcutExpression
using AspectJ'sPointcutParser
and classloader fetched viaThread.currentThread().getContextClassLoader()
method. Spring DM Extender ensures that at this point of context creation provided classloader delegates to bundle's internal classloader. Thanks to that creation ofAspectJExpressionPointcut.pointcutExpression
(equal to parsing pointcut expression by AspectJ classes) works fine. UnfortunatelyPointcutExpression
that uses bundle's classloader cant't matchweblogic.jdbc.common.internal.RmiDataSource.getConnection()
method of the problematic bean.ReflectionWorldException
exception is thrown and Spring tries to constructfallbackPointcutExpression
using classloader that loadedweblogic.jdbc.common.internal.RmiDataSource
class:Parsing pointcut expression using such classloader fails because this classloader doesn't see
pl.some.package.SomeClass
. AspectJ'sPointcutParser
throwsIllegalArgumentException
in this case:However Spring is not prepared for
IllegalArgumentException
in this place (only forReflectionWorldException
):Finally
IllegalArgumentException
is propagated through the call stack and in the end initialization of application context fails. From my point of view this is undesirable behaviour so i report this as a bug.Note: i can probably workaround this issue by excluding
RmiDataSource
bean from autoproxing but this is fragile IMHO.Affects: 3.1.1
Issue Links:
@args
as pointcut, there is case that occur a NPE at calling the unrelated methodReferenced from: commits 89398b0, 228a586, ce4912b
Backported to: 3.2.9
5 votes, 9 watchers
The text was updated successfully, but these errors were encountered: