Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Exception: ...required property 'bundleContext' has not been set
Exception: ...required property 'bundleContext' has not been set [message #654595] Wed, 16 February 2011 12:54 Go to next message
Ivana Missing name is currently offline Ivana Missing nameFriend
Messages: 14
Registered: December 2010
Junior Member
Hi all,

I am using the same projects, sometimes there isn't problem, sometimes there is.

I am using virgo 2.1.0 with spring-osgi-* 1.2.1, gemini.web* 1.1.0, gemini.blueprint.* 1.0.0.M1.., spring 3.0.5.release..

In attached logs differents are started at line 65(no exception) , 61(exception)

Thanks in advance,

Iv
  • Attachment: log.zip
    (Size: 7.75KB, Downloaded 304 times)
Re: Exception: ...required property 'bundleContext' has not been set [message #654633 is a reply to message #654595] Wed, 16 February 2011 14:30 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
This may not help, but check the namespaces in your spring/blueprint XML files to make sure they are correct. I've seen similar problems when people have accidentally referred to Spring DM namespaces beyond 1.2.1.
Re: Exception: ...required property 'bundleContext' has not been set [message #655076 is a reply to message #654633] Fri, 18 February 2011 09:32 Go to previous messageGo to next message
Ivana Missing name is currently offline Ivana Missing nameFriend
Messages: 14
Registered: December 2010
Junior Member
I think that this is ok ? It looks like something else is a problem.


<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd">


In attachment I added two simple test projects, maybe you will notice something that I didn't.

Thank you again for your time and help
  • Attachment: test1.zip
    (Size: 27.31KB, Downloaded 330 times)

[Updated on: Thu, 24 February 2011 18:00]

Report message to a moderator

Re: Exception: ...required property 'bundleContext' has not been set [message #655221 is a reply to message #655076] Fri, 18 February 2011 17:10 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
That header looks ok. The zip doesn't seem to want to download at the moment. I'll hopefully get to take a look at it next week, although I'm on vacation on Monday.
Re: Exception: ...required property 'bundleContext' has not been set [message #655692 is a reply to message #654595] Tue, 22 February 2011 10:39 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
I took a look at the test projects and it strikes me that the main difference between your web project and one that works, e.g. that of the greenpages sample, is that you have Spring configuration in both META-INF/spring and web/conf. So I imagine that the Spring DM extender is racing with Virgo's web support to build an application context.

I'm no web expert, so I'll ask Chris to comment when he's back in the office tomorrow.
Re: Exception: ...required property 'bundleContext' has not been set [message #655968 is a reply to message #655692] Wed, 23 February 2011 15:20 Go to previous messageGo to next message
Chris Frost is currently offline Chris FrostFriend
Messages: 230
Registered: January 2010
Location: Southampton, England
Senior Member

Hi,

I've tried downloading the zip twice and it keeps unzipping to 'test1.zip.cpgz' which I can't do anything with. Will take a copy from Glyn tomorrow if he still has one.

You are indeed right about the extender racing Virgo. You must keep all osgi context files in the META-INF/spring folder otherwise there are problems with both the spring-dm extender trying to create an application context and Gemini Web trying to configure the servlet container at the same time. (META-INF may suffice but I can't quite remember.)

Chris


------------------------------------------------
Chris Frost, Twitter @cgfrost
Springsource, a divison of VMware.
Re: Exception: ...required property 'bundleContext' has not been set [message #656169 is a reply to message #655968] Thu, 24 February 2011 12:34 Go to previous messageGo to next message
Ivana Missing name is currently offline Ivana Missing nameFriend
Messages: 14
Registered: December 2010
Junior Member
I hope that with rar won't be problems .

I changed web.xml and added context files in META-INF/spring but following exceptions were logged, but if I put these files in src/main/webapp/WEB-INF again sometimes there is problem with setting bundle context, sometimes there isn't.

web.xml is ok or I made some mistake?


SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanDefinitionStoreExcepti on: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReade r.loadBeanDefinitions(XmlBeanDefinitionReader.java:341)

....

java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/springmvc-servlet.xml]
at org.springframework.web.context.support.ServletContextResour ce.getInputStream(ServletContextResource.java:118)
  • Attachment: test2.rar
    (Size: 15.15KB, Downloaded 251 times)

[Updated on: Thu, 24 February 2011 18:04]

Report message to a moderator

Re: Exception: ...required property 'bundleContext' has not been set [message #656431 is a reply to message #656169] Fri, 25 February 2011 15:42 Go to previous messageGo to next message
Chris Frost is currently offline Chris FrostFriend
Messages: 230
Registered: January 2010
Location: Southampton, England
Senior Member

Hi,

I've been having a look through it all and I think we are on the right track. In your web.xml why have you specified the contextClass twice, both globally and specifically for the dispatcher servlet. You should only need it globally.

Also, what are you using to build this, could you attach a built bundle, I want to have a look inside it. I've often had problems where the source is fine but my build is putting things in the wrong place (or not at all).

Although we aren't there yet, I think you will also need to move the osgi:reference line into the applicationContext.xml file. I'm not sure but I think the 'ServerOsgiBundleXmlWebApplicationContext' will only be able to wire OSGi services in as beans to the application context but not individual servlet contexts.

Finally, it wouldn't hurt to tidy up the namespace declarations. If you move the osgi reference as I say then you should only need the following for the applicationContext.xml.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:osgi="http://www.springframework.org/schema/osgi"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">


and then for springmvc-servlet.xml

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
				http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">


I've mainly made this suggestion as I've never used the JEE namespace before and I don't know what effect it will have. Also, if I'm right the servlet context won't know what to do with the osgi namespace.

If you attach the built bundles I'll have a look at those and in the mean time you can try out some of my suggestions above.

Thanks for looking at Virgo,
Chris.


------------------------------------------------
Chris Frost, Twitter @cgfrost
Springsource, a divison of VMware.
Re: Exception: ...required property 'bundleContext' has not been set [message #656757 is a reply to message #656431] Mon, 28 February 2011 13:03 Go to previous messageGo to next message
Ivana Missing name is currently offline Ivana Missing nameFriend
Messages: 14
Registered: December 2010
Junior Member
I will test what you said.

I said "sometimes this works", that is what I don't understand. Sometimes when I start osgi, and call http://localhost:8080/peradetlic/hello_world.ivana, I will see in explorer window message from bundle service1. I wouldn't see that if controller wasn't be able to see service/bean from service1 bundle, right? That scanning, catching service was putted in springmvc-servlet.xml.

Sometimes there was exception not recognizing osgi namespace in springmvc-servlet.xml, you was right about that, but sometimes it works fine. Why?.. That is question.. That is maybe question for gemini team?

About build bundles, for these test-projects I just export project as plugin. In application which is more serious we use maven plugins for bundling our projects.

Thank you for time and patience, I will try what you said, and I hope that problem will be solved.

Ivana
  • Attachment: test3.rar
    (Size: 20.76KB, Downloaded 292 times)
Re: Exception: ...required property 'bundleContext' has not been set [message #656801 is a reply to message #656757] Mon, 28 February 2011 16:39 Go to previous messageGo to next message
Chris Frost is currently offline Chris FrostFriend
Messages: 230
Registered: January 2010
Location: Southampton, England
Senior Member

Hi,

I'm glad you've made some progress, if you want us to help figure out why it sometime fails we will need built jar files so we can run it. It is odd and quite a simple case so we are happy to do so.

Chris.


------------------------------------------------
Chris Frost, Twitter @cgfrost
Springsource, a divison of VMware.
Re: Exception: ...required property 'bundleContext' has not been set [message #656808 is a reply to message #656801] Mon, 28 February 2011 17:03 Go to previous messageGo to next message
Ivana Missing name is currently offline Ivana Missing nameFriend
Messages: 14
Registered: December 2010
Junior Member
I have already added bundles in test3.rar in my last message, two source projects and two jars, you probably didn't see? I could put somewhere my target-platform so you can just start osgi?
Re: Exception: ...required property 'bundleContext' has not been set [message #656816 is a reply to message #656808] Mon, 28 February 2011 17:30 Go to previous messageGo to next message
Chris Frost is currently offline Chris FrostFriend
Messages: 230
Registered: January 2010
Location: Southampton, England
Senior Member

Hi,

Apologies, I missed those completely which is quite embarrassing on my part as I did have a quick look inside to look at the context files. I will try running these tomorrow morning and get back to you.

Chris.


------------------------------------------------
Chris Frost, Twitter @cgfrost
Springsource, a divison of VMware.
Re: Exception: ...required property 'bundleContext' has not been set [message #657030 is a reply to message #656808] Tue, 01 March 2011 12:00 Go to previous message
Chris Frost is currently offline Chris FrostFriend
Messages: 230
Registered: January 2010
Location: Southampton, England
Senior Member

Hi,

I've had a go at deploying your bundles and this is where I got to.

Your using 3.0.2 of the springframework, just as it's quicker for me I changed your manifests to 3.0.0 rather than putting 3.0.2 in my Virgo install. I see no reason for this to be causing you problems. The services bundle now deployed with no problems.

In the web bundle I had to move the 'webHibernate' package to a new directory in WEB-INF called classes. This is the normal place for class files in War files and it hasn't changed for OSGi. The manifest couldn't find the activator otherwise. The bundle now gets further but the Activator fails during startup with a class not found. You are being correctly wired to a bundle provinding the 'org.apache.log4j' package but it dosn't provide the 'PropertyConfigurator' class which your activator needs. I would need to do further work to find out how this works but I thought I'd made some progress at least and you might just know how to fix this last problem.

The bundles I changed are attached for you to have a look at. Let me know if this helps.

Chris.
  • Attachment: bundles.zip
    (Size: 8.14KB, Downloaded 393 times)


------------------------------------------------
Chris Frost, Twitter @cgfrost
Springsource, a divison of VMware.
Previous Topic:How to deploy a WAR to ROOT web context (/)?
Next Topic:Hot deployment and run-time modification to Plan artifacts
Goto Forum:
  


Current Time: Thu Mar 28 19:46:24 GMT 2024

Powered by FUDForum. Page generated in 0.03944 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top