Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gemini » required property 'bundleContext' has not been set
required property 'bundleContext' has not been set [message #912887] Fri, 14 September 2012 06:50 Go to next message
Sebastian Lorenz is currently offline Sebastian Lorenz
Messages: 36
Registered: November 2010
Member
I want to export a bean as an osgi service using this spring.xml file:
<beans>
		
	<osgi:service interface="mein.test.ITest">
		<bean class="mein.test.Test"/>
	</osgi:service>	

</beans>


Most of the time it works but nearly every 5th start ends with the following exception:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean#0': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: required property 'bundleContext' has not been set
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
	at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:60)
	at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:325)
	at org.eclipse.gemini.blueprint.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
	at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:290)
	at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:137)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: required property 'bundleContext' has not been set
	at org.springframework.util.Assert.notNull(Assert.java:112)
	at org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean.afterPropertiesSet(OsgiServiceFactoryBean.java:179)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)


What is wrong? I already set the start level of all of my springframework and gemini bundles to 1. All my application bundles (there is only one at the moment) have their default start level of 4.
Btw. I'm using springframework 3.1.1 and gemini blueprint 1.0.2.
Thanks.
Re: required property 'bundleContext' has not been set [message #915405 is a reply to message #912887] Mon, 17 September 2012 04:01 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
On the face of it, this looks like a bug in Gemini Blueprint or Spring. Please could you create a bug report and attach a testcase. I haven't come across this before, so there may be something novel about your environment. Please specify the operating system and Java versions in the bug report.

Unless someone else can reproduce the problem, you may be faced with debugging it yourself. The approach I would take is to find out what method should be called to set the bundle context property and then stop on that method in a debugger (on a hopefully successful run). Then work your way up the stack and by judicious placement of breakpoints, see what's happening in the failure case.
Re: required property 'bundleContext' has not been set [message #917795 is a reply to message #915405] Thu, 20 September 2012 08:45 Go to previous messageGo to next message
Sebastian Lorenz is currently offline Sebastian Lorenz
Messages: 36
Registered: November 2010
Member
Didn't work on this test project for some days now. Today I opened the project again and everything seems to be fine. No errors at all. If all my problems could be solved this way...
Re: required property 'bundleContext' has not been set [message #917809 is a reply to message #917795] Thu, 20 September 2012 08:59 Go to previous message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
I hate it when that happens as it's now not clear whether there was a bug or a setup problem. But we have to assume the latter and march on I think. At least you're in business again! Smile
Previous Topic:Gemini JPA 1.1.0 RC1 now available
Next Topic:Spring OSGI Testing Framework
Goto Forum:
  


Current Time: Sun Aug 31 00:38:12 EDT 2014

Powered by FUDForum. Page generated in 0.04241 seconds