|
Hello Costin,
I'm sorry I didn't make my point clear enough. The change you made, fixes my current problem but I still think I could be confusing in some ways. If I override createPlatform in my test like this @Override protected OsgiPlatform createPlatform() { final OsgiPlatform platform = super.createPlatform(); final Properties props = platform.getConfigurationProperties(); props.setProperty("some.prop", "valueA"); props.setProperty("other.prop", "valueB"); return platform; } then I would expect these properties to be set in platform. But in the current implementation I have to think about system properties and - the more confusing part in my eyes - properties from getPlatformProperties(), which I can only find in the source code. I'm now aware of this behaviour but other users, especially new users may not. So I would suggest something like: public Properties getConfigurationProperties() { if (configurationProperties == null) { configurationProperties = new Properties(); // local properties configurationProperties.putAll(getPlatformProperties()); // system properties configurationProperties.putAll(System.getProperties()); } return configurationProperties; } so the properties would be initiated with the default and system values but after that it's up to the user to change them. I hope I make my point clear and you understand what I mean. Cheers Björn Björn, you are right - the getPlatformProperties was not meant to be protected - only package protected. I've changed the implementation and marked the method as deprecated - after RC1 I plan to change it to package protected.
Let me know if this works for you now (seems to do so in the tests). Hello Costin
The configuration problem of the testplatform has gone, when I use 1.1.0-rc1-SNAPSHOT, but now I get this error during the startup of my test bundles 2008-06-09 10:32:29,103 ERROR [SpringOsgiExtenderThread-6] (ServiceDynamicInterc eptor ) - Event org.springframework.osgi.service.importer.event.OsgiServic eDependencySatisfiedEvent[source=org.springframework.osgi.service.importer.suppo rt.OsgiServiceProxyFactoryBean@1bfa303] not published as the publisher is not in itialized - usually this is caused by eager initialization of the importers by p ost processing java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - c all 'refresh' before multicasting events via the context: org.springframework.os gi.context.support.OsgiBundleXmlApplicationContext@95ef17: display name [OsgiBun dleXmlApplicationContext(bundle=ag.pinguin.app-inkasso-service, config=osgibundl e:/META-INF/spring/*.xml)]; startup date [Mon Jun 09 10:32:28 CEST 2008]; root o f context hierarchy at org.springframework.context.support.AbstractApplicationContext.getApp licationEventMulticaster(AbstractApplicationContext.java:288) at org.springframework.context.support.AbstractApplicationContext.publis hEvent(AbstractApplicationContext.java:275) at org.springframework.osgi.service.importer.support.internal.aop.Servic eDynamicInterceptor.publishEvent(ServiceDynamicInterceptor.java:423) at org.springframework.osgi.service.importer.support.internal.aop.Servic eDynamicInterceptor.access$200(ServiceDynamicInterceptor.java:64) at org.springframework.osgi.service.importer.support.internal.aop.Servic eDynamicInterceptor$EventSenderRetryTemplate.execute(ServiceDynamicInterceptor.j ava:101) at org.springframework.osgi.service.importer.support.internal.aop.Servic eDynamicInterceptor.lookupService(ServiceDynamicInterceptor.java:409) at org.springframework.osgi.service.importer.support.internal.aop.Servic eDynamicInterceptor.getTarget(ServiceDynamicInterceptor.java:391) at org.springframework.osgi.service.importer.support.internal.aop.Servic eDynamicInterceptor.afterPropertiesSet(ServiceDynamicInterceptor.java:455) at org.springframework.osgi.service.importer.support.OsgiServiceProxyFac toryBean.createProxy(OsgiServiceProxyFactoryBean.java:173) at org.springframework.osgi.service.importer.support.AbstractOsgiService ImportFactoryBean.getObject(AbstractOsgiServiceImportFactoryBean.java:101) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport$ 1.run(FactoryBeanRegistrySupport.java:121) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport. doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:116) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport. getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:91) at org.springframework.beans.factory.support.AbstractBeanFactory.getObje ctForBeanInstance(AbstractBeanFactory.java:1285) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe an(AbstractBeanFactory.java:275) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.BeanDefinitionValueResolver .resolveReference(BeanDefinitionValueResolver.java:269) at org.springframework.beans.factory.support.BeanDefinitionValueResolver .resolveValueIfNecessary(BeanDefinitionValueResolver.java:104) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1244) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory.populateBean(AbstractAutowireCapableBeanFactory.java:1008) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:470) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.BeanDefinitionValueResolver .resolveInnerBean(BeanDefinitionValueResolver.java:219) at org.springframework.beans.factory.support.BeanDefinitionValueResolver .resolveValueIfNecessary(BeanDefinitionValueResolver.java:122) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1244) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory.populateBean(AbstractAutowireCapableBeanFactory.java:1008) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:470) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb ject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr y.getSingleton(DefaultSingletonBeanRegistry.java:220) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe an(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:164) at org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetriev alHelper.findAdvisorBeans(BeanFactoryAdvisorRetrievalHelper.java:87) at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyC reator.findCandidateAdvisors(AbstractAdvisorAutoProxyCreator.java:98) at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyC reator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:84) at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyC reator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:66) at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator. wrapIfNecessary(AbstractAutoProxyCreator.java:345) at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator. postProcessAfterInitialization(AbstractAutoProxyCreator.java:309) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFa ctory.java:361) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1342) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:471) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb ject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr y.getSingleton(DefaultSingletonBeanRegistry.java:220) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe an(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:164) at org.springframework.osgi.extender.internal.dependencies.startup.Manda toryImporterDependencyFactory.getServiceDependencies(MandatoryImporterDependency Factory.java:54) at org.springframework.osgi.extender.internal.dependencies.startup.Depen dencyServiceManager.findServiceDependencies(DependencyServiceManager.java:214) at org.springframework.osgi.extender.internal.dependencies.startup.Depen dencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContex tExecutor.java:249) at org.springframework.osgi.extender.internal.dependencies.startup.Depen dencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContext Executor.java:173) at org.springframework.osgi.context.support.AbstractDelegatedExecutionAp plicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:136) at org.springframework.osgi.extender.internal.activator.ContextLoaderLis tener$2.run(ContextLoaderListener.java:749) at java.lang.Thread.run(Thread.java:595) If I use 1.1.0-m2 everything works fine. I don't think it has something to do with this issue, but I want to ask for any changes in the behaviour of the test framework from 1.1.0-m2 to 1.1.0-rc1-SNAPSHOT There aren't any connections - please open a separate issue. Make sure first that you are using the latest snapshot of both Spring-DM 1.1 RC1 and Spring 2.5.5. The problem, in your case, is caused by too early initialization of the importers during dependency detection. Since the importer trigger an event before waiting and the application context is not initialized, you'll end up with that exception.
The latest snapshot throws a warning/error message instead of throwing the exception - check out the logs and let me know if you still encounter the problem. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Cheers,