Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gemini » Namespace discovery problem inside a WAR bundle (Describe the trouble I have deploying my war and share what I found about it)
Namespace discovery problem inside a WAR bundle [message #1142724] Thu, 17 October 2013 20:28 Go to next message
Michael De Bellefeuille is currently offline Michael De BellefeuilleFriend
Messages: 2
Registered: October 2013
Junior Member
I'm using Gemini Blueprint 2.0.0.M02 deployed on a Glassfish server V3.1.2 in which I encountered this problem when I deploy a war bundle :

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem:
Unable to locate Spring NamespaceHandler for XML schema namespace [http\://www.eclipse.org/gemini/blueprint/schema/blueprint]
Offending resource: ServletContext resource [/WEB-INF/applicationContext.xml]

I'm having the same problem with the context namespace, depending which one is first in the xml, here is a similar issue : http\://www.eclipse.org/forums/index.php/t/204946/ (pretty old post so I started a new one)

Note : added '\' to be able to post, cannot post links

Here is my application context :

<?xml version="1.0" encoding="UTF-8"?>
<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"
	xmlns:osgi="http\://www.eclipse.org/gemini/blueprint/schema/blueprint"
	xsi:schemaLocation="http\://www.springframework.org/schema/beans http\://www.springframework.org/schema/beans/spring-beans-3.2.xsd
		http\://www.springframework.org/schema/context http\://www.springframework.org/schema/context/spring-context-3.2.xsd
		http\://www.eclipse.org/gemini/blueprint/schema/blueprint http\://www.eclipse.org/gemini/blueprint/schema/blueprint/gemini-blueprint.xsd">

	<bean id="wakarimashitaJSF" class="com.sti.sigbud.servlet.WakarimashitaJSF">
		<property name="loggingTestServiceInterface" ref="loggingService" />
	</bean>
	
	<osgi:reference id="loggingService" interface="com.sti.loggingservices.serviceinterface.LoggingServiceInterface" availability="optional"/>
	<context:component-scan base-package="com.sti.sigbud"/>
</beans>


Manifest:
Manifest-Version: 1.0
Bnd-LastModified: 1382037086095
Build-Jdk: 1.6.0_45
Built-By: debellefeuillem
Bundle-ClassPath: .,WEB-INF/classes,WEB-INF/lib
Bundle-Description: Core Sigbud
Bundle-ManifestVersion: 2
Bundle-Name: sigbud
Bundle-SymbolicName: sigbud
Bundle-Version: 3.0.0.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Export-Package: com.sti.sigbud.servlet;uses:="com.sti.loggingservices.se
 rviceinterface,javax.servlet,javax.servlet.http";version="3.0.0.SNAPSHO
 T"
Import-Package: javax.servlet;version="[3.0,4)",javax.servlet.http;versi
 on="[3.0,4)",com.sti.loggingservices.serviceinterface;version="[1.0,2)"
 ,javax.servlet.jsp,javax.servlet.jsp.tagext,org.springframework.web.con
 text.request;version="[3.2,4)",org.eclipse.gemini.blueprint.service.imp
 orter.support;version="[2.0,3)",org.springframework.aop,org.springframe
 work.beans.propertyeditors,org.eclipse.gemini.blueprint.service.importe
 r;version="[2.0,3)",org.springframework.web.jsf.el;version="[3.2,4)",or
 g.springframework.beans.factory.xml,org.springframework.web.context;ver
 sion="[3.2,4)",javax.faces.bean;version="2.1",org.aopalliance.aop,org.e
 clipse.gemini.blueprint.service.exporter.support;version="[2.0,3)",org.
 springframework.stereotype,org.springframework.context.annotation,com.s
 un.enterprise.security.jmac.config,javax.servlet.jsp.el,org.springframe
 work.context.config,org.osgi.framework;version="1.5.0",org.xml.sax,org.
 eclipse.gemini.blueprint.context.support;version="[2.0,3)",org.springfr
 amework.aop.framework
Spring-Context: WEB-INF/applicationContext*.xml
Tool: Bnd-2.1.0.20130426-122213
Web-ContextPath: /sigbud
Webapp-Context: /sigbud


N.B. : I tried with and without the Spring-Context header, explaining further the behaviour

I found something intriguing because I deployed a Gemini managed Bundle packaged as a jar and it was deployed correctly along with the service it produce.

Jar Manifest :
Manifest-Version: 1.0
Bnd-LastModified: 1381949781885
Build-Jdk: 1.6.0_45
Built-By: debellefeuillem
Bundle-ClassPath: .,classes
Bundle-Description: Application Logging Management
Bundle-ManifestVersion: 2
Bundle-Name: logging
Bundle-SymbolicName: logging
Bundle-Version: 1.0.0.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Import-Package: org.apache.log4j;version="1.2.17",org.apache.log4j.spi;v
 ersion="1.2.17",com.sti.loggingservices.serviceinterface;version="[1.0,
 2)",org.osgi.framework;version="1.5.0"
Spring-Context: springconfig/logging*.xml
Tool: Bnd-2.1.0.20130426-122213


Jar Spring XML
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http\://www.eclipse.org/gemini/blueprint/schema/blueprint"
	xmlns:xsi="http\://www.w3.org/2001/XMLSchema-instance"
	xmlns:beans="http\://www.springframework.org/schema/beans"
	xsi:schemaLocation="http\://www.springframework.org/schema/beans http\://www.springframework.org/schema/beans/spring-beans.xsd
		http\://www.eclipse.org/gemini/blueprint/schema/blueprint http\://www.eclipse.org/gemini/blueprint/schema/blueprint/gemini-blueprint.xsd">

	<service id="loggingService" ref="loggingServiceImplementation" interface="com.sti.loggingservices.serviceinterface.LoggingServiceInterface"/>
</beans:beans>

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http\://www.springframework.org/schema/beans"
	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.xsd">
	
	<bean id="loggingServiceImplementation" class= "com.sti.logging.service.LoggingService"/>
</beans>


Realizing that my jar was ok but not my war, I decided to remote debug the deployment of both of them to see what was happening. So I put a breakpoint in the class org.springframework.beans.factory.xml.BeanDefinitionParserDelegate(line 1433) I discovered that:

Deploying my Jar bundle, only one thread (Thread [EclipseGeminiBlueprintExtenderThread-66]) is calling that method and it discovers the namespace. So there is no problems for that one.

But, when deploying my War bundle, the thread reading the applicationContext file is not the one managed by EclipseGeminiBlueprintExtenderThread, doing so it cannot find the Context namespace nor the OSGi namespace. I tried adding into the manifest the Spring-Context header, doing so I saw while remote debuging that there were 2 threads calling that methods (Thread [EclipseGeminiBlueprintExtenderThread-68] and Thread[pool-15-thread-1]), the thread EclipseGeminiBlueprintExtenderThread works as supposed finding the namespace and all my injections are done correctly, but the second thread doesn't find the namespace and throws the exception making my application context deployment failing.

In spring DM there was a context parameter to add to the web.xml :
<context-param>
	<param-name>contextClass</param-name>
	<param-value>
		org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext
	</param-value>
</context-param>
<context-param>
	<param-name>contextConfigLocation</param-name>
	<param-value>
		WEB-INF/applicationContext.xml,
		WEB-INF/applicationContext-osgi.xml
	</param-value>
</context-param>


The class was provided by the jar spring-osgi-web, This class is not available in Gemini Blueprint, I tried with org.eclipse.gemini.blueprint.context.support.OsgiBundleXmlApplicationContext but it doesn't work because that class does not implement org.springframework.web.context.ConfigurableWebApplicationContext, is there something similar to the context-param or something else that I need to do to make it deploy correctly?
Re: Namespace discovery problem inside a WAR bundle [message #1142957 is a reply to message #1142724] Thu, 17 October 2013 23:57 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry SklyutFriend
Messages: 279
Registered: January 2010
Senior Member
Hello Michael,

Web support for spring dm was dropped when Spring DM moved to eclipse. That part went into Virgo.
See http://www.eclipse.org/virgo/documentation/virgo-documentation-3.6.2.RELEASE/docs/virgo-programmer-guide/html/ch04s05.html

You could try using Virgo org.eclipse.virgo.web.dm bundle instead of spring-osgi-web bundle. I have not tried it, so I am not sure if you will encounter any issues. Looking at the imports of ServerOsgiBundleXmlWebApplicationContext I don't see anything that might cause issues on the resolution side.

Link to source -> http://git.eclipse.org/c/virgo/org.eclipse.virgo.web.git/tree/org.eclipse.virgo.web.dm/src/main/java/org/eclipse/virgo/web/dm/ServerOsgiBundleXmlWebApplicationContext.java

Virgo download link -> http://www.eclipse.org/virgo/download/

Regards,
Dmitry
Re: Namespace discovery problem inside a WAR bundle [message #1143962 is a reply to message #1142957] Fri, 18 October 2013 14:47 Go to previous message
Michael De Bellefeuille is currently offline Michael De BellefeuilleFriend
Messages: 2
Registered: October 2013
Junior Member
Hello Dmitry,

I want to thank you very much, that was my missing puzzle piece, that made my day. Very Happy

Regards,
Michaël
Previous Topic:Having issues with Kepler SR1 and Gemini Web
Next Topic:Gemini JPA + Gemini Naming
Goto Forum:
  


Current Time: Wed Apr 24 20:06:28 GMT 2024

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

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

Back to the top