Context initialisation failed [message #987772] |
Tue, 27 November 2012 23:38  |
Eclipse User |
|
|
|
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 #989620 is a reply to message #987772] |
Thu, 06 December 2012 19:54  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03970 seconds