Community
Participate
Working Groups
Build Identifier: I have defined an osgi reference to a javax.sql.DataSource with blueprint 1.0GA, and added an aspect with a aspectj-style pointcut "execution(* javax.sql.DataSource.getConnection(..))". The strange thing is that the aspect is only applied about 70% of the times the application starts (the bean is created every time, of course). In the other cases, it's just ignored. The same thing happens with Spring DM 1.2.1, which I used at first. Reproducible: Sometimes Steps to Reproduce: 1. Create a reference to a data source 2. Create an aspect in the same context with pointcut "execution(* javax.sql.DataSource.getConnection(..))" 3. Trigger getConnection() and see it the advice is active
I have some more info: In the cases where the aspect works, the data source bean classloader is BundleDelegatingClassLoader, while in the cases where it doesn't work, it's org.eclipse.gemini.blueprint.context.support.internal.classloader.ChainedClassLoader I found this out by creating a bean: public class DataSourceChecker { private Logger log = LoggerFactory.getLogger(getClass()); @Autowired public DataSourceChecker(DataSource dataSource) { log.info("DataSource classloader = " + dataSource.getClass().getClassLoader()); } }
(In reply to comment #1) > I have some more info: > In the cases where the aspect works, the data source bean classloader is > BundleDelegatingClassLoader, while in the cases where it doesn't work, it's > org.eclipse.gemini.blueprint.context.support.internal.classloader. > ChainedClassLoader > I found this out by creating a bean: > public class DataSourceChecker { > > private Logger log = LoggerFactory.getLogger(getClass()); > > @Autowired > public DataSourceChecker(DataSource dataSource) { > log.info("DataSource classloader = " + > dataSource.getClass().getClassLoader()); > } > } That's weird because it means that sometimes ChainedClassLoader is supposedly the defining class loader of DataSource. I'm afraid I can't invest the time to reproduce this problem and look into it. If it's still of interest to you, you may care to attach a sample project which reproduces the problem plus steps to reproduce the problem. That might encourage someone else to invest the time. Sorry!
There has not been any activity on this ticket since a long time. Also, this behavior needs to be re-tested with the recent most release. I'll close this as won't fix. To be re-opened if the requirement arises.