views:

99

answers:

2

Anybody has an idea why adding the annotation-driven declaration leads to the aopalliance classes not found. I have not explicitly defined the weaving so using Spring defaults.

Any help is appreciated

+2  A: 

I'm unsure what the real question is (if it is about the real cause1, providing the full stacktrace might be helpful) but the fact is that you are currently missing the aopalliance.jar on your classpath (which was previously included in Spring jars as mentioned in this thread or this blog post).

1 With the provided level of details, my guess is that Spring is loading its TransactionInterceptor which is an implementation of o.a.a.Advice and is looking for the dependency, which is missing.

Pascal Thivent
I found the issue. The reason is that obviously Hibernate and Spring use different version of some jars. Switching to the right versions of both frameworks has resolved the issue.
Alois Reitbauer
+2  A: 

Spring has two modes of creating proxies to support transactions. The default mode is to create JDK proxies, but that only works if you inject interfaces. If you inject classes, CGLib proxies will be used, and they are created using AspectJ (and hence the aopalliance.jar and the spring-aspects.jar are needed on the classpath).

My advice: refer to your services and daos by interface:

private MyDaoInterface dao;

public void setDao(MyDaoInterface dao){
}

and Spring will automatically choose the Proxy-based approach.

See:

seanizer