Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gemini » Context initialisation failed(Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/context])
Context initialisation failed [message #987772] Tue, 27 November 2012 23:38 Go to next message
Eban Escott is currently offline Eban Escott
Messages: 61
Registered: July 2009
Member
Hi,

I am trying to get a Gemini 1.0.2, Spring 3.1.3, and Jetty 8.1.7 web application working using a SpringMVC-based bundle. I have all the bundles in and I am able to startup the Equniox 3.7.1 OSGi container. However, I get the following namespace error:

SEVERE: Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/context]
Offending resource: ServletContext resource [/WEB-INF/springmvc-servlet.xml]

	at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
	at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
	at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80)


My spring servlet xml context is:

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

	<context:component-scan base-package="sandbox.springmvc" />

	<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="prefix" value="/WEB-INF/jsp/" />
		<property name="suffix" value=".jsp" />
	</bean>
</beans>


The strange thing is that if I remove the context namespace, and just leave the bean namespace, I do not get any errors. Meaning the bean namespace is being found in its bundle. I checked the spring bundles and the xsd's are where they are suppose to be and the bundles start up fine and are resolved. I have also tried using spring.schemas and spring.handlers next to the manifest but no change.

I did find another post http://www.eclipse.org/forums/index.php/t/204946/ and I tried changing the start levels but still no joy.

Any ideas what else I could do?

Thanks
Eban
Re: Context initialisation failed [message #987823 is a reply to message #987772] Wed, 28 November 2012 05:02 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
I think by Gemini 1.0.2, you mean Gemini Blueprint 1.0.2.

This is probably not the answer you are looking for, but you could try using Virgo Jetty Server (see the Virgo home page for download and docs) as this pre-integrates Jetty, Gemini Blueprint, and Spring framework. The results may be the same, but then you would have eliminated integration issues on your part.
Re: Context initialisation failed [message #988233 is a reply to message #987772] Wed, 28 November 2012 21:46 Go to previous messageGo to next message
Eban Escott is currently offline Eban Escott
Messages: 61
Registered: July 2009
Member
Hi Glyn,

Yes, I meant Gemini Blueprint and the problem has been sloved by one of the other developers.

I cannot post what he has done because he is unsure of how he fixed it, but we are unblocked. I am really sorry as its one of my pet dislikes when you read forum posts and the author does not post the solution. If I do work it out then I will post it up here later.

Cheers
Eban
Re: Context initialisation failed [message #988284 is a reply to message #988233] Thu, 29 November 2012 04:33 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
Glad you are, at least temporarily, sorted. Smile
Re: Context initialisation failed [message #989620 is a reply to message #987772] Thu, 06 December 2012 19:54 Go to previous message
Eban Escott is currently offline Eban Escott
Messages: 61
Registered: July 2009
Member
Ok,

I believe it to be an issue with starting up a web application and it not having visibility of the OSGi classpath, therefore it could not find the XSDs. The documentation I found suggested I needed to use the OsgiBundleXmlWebApplicationContext in the web.xml but this class has been removed from Gemini Blueprint.

As Glyn pointed out Virgo could be used instead except that I do not want to add in Gemini Web and Virgo to my technology stack, too many already. So my solution was to write my own OsgiBundleXmlWebApplicationContext like:

import org.eclipse.gemini.blueprint.context.support.OsgiBundleXmlApplicationContext;
import org.springframework.web.context.ConfigurableWebApplicationContext

public class OsgiBundleXmlWebApplicationContext extends OsgiBundleXmlApplicationContext implements ConfigurableWebApplicationContext {

}


I based the code on a class I found in the Virgo project named ServerOsgiBundleXmlApplicationContext (I think that is what it was called). Anyway, once this class was implemented the web application became OSGi-aware and could see the JARs (bundles) which contained the XSDs on the classpath.

Hope this helps
Eban

Previous Topic:Gemini DBAccess 1.1.0 Milestone 4
Next Topic:Using Gemini DBAccess/JPA in services
Goto Forum:
  


Current Time: Fri Apr 18 14:19:32 EDT 2014

Powered by FUDForum. Page generated in 0.02314 seconds