Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gemini » Mixing Blueprint and Spring namespaces in configuration files(...does not work.)
Mixing Blueprint and Spring namespaces in configuration files [message #990631] Thu, 13 December 2012 09:13 Go to next message
Sebastian Lorenz is currently offline Sebastian Lorenz
Messages: 25
Registered: November 2010
Junior Member
In the Gemini Reference Documentation (http://www.eclipse.org/gemini/blueprint/documentation/reference/1.0.1.RELEASE/html/blueprint.html) I found the following example configuration:

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:bp="http://www.osgi.org/xmlns/blueprint/v1.0.0"
	xmlns:p="http://www.springframework.org/schema/p"
	xmlns:osgi="http://www.springframework.org/schema/osgi"
	xmlns:task="http://www.springframework.org/schema/task"
	xmlns:util="http://www.springframework.org/schema/util"
	xsi:schemaLocation="
		http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
		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
		http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd		
		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
    
    <util:constant id="thread-priority" static-field="java.lang.Thread.MIN_PRIORITY"/>
    
    <bean id="exampleThread" class="java.lang.Thread" p:priority-ref="thread-priority">
    	<constructor-arg>
    	   <bp:bean class="org.example.SomeRunnable"/>
    	</constructor-arg>
    </bean>
    
    <task:executor id="rangeWithBoundedQueue" size="7-42" queue-capacity="#{ T(java.lang.Math).random() * 30.0 }"/>

    <bp:reference-list id="cloneableServices" interface="java.lang.Cloneable" />
</beans>


If I try to use this configuration I get an error
cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'bp:reference-list'.


For me, mixing Blueprint and Spring namespaces does not work at all. I separated my bundle configuration into two configuration files. One with a Spring namespace and the other with the Blueprint namespace, containing the reference list.

[Updated on: Fri, 14 December 2012 12:06]

Report message to a moderator

Re: Mixing Blueprint and Sprint namespaces in configuration files [message #990795 is a reply to message #990631] Fri, 14 December 2012 05:07 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn Normington
Messages: 1186
Registered: July 2009
Senior Member
I wonder if that example was wrong? I trimmed down the example to something more basic, and therefore more reliable recently. Have you tried something really basic?

For more details, please see: http://git.eclipse.org/c/gemini.blueprint/org.eclipse.gemini.blueprint.git/commit/?id=b998e148ba4581429852c88380d277c72e6a39d9
Re: Mixing Blueprint and Sprint namespaces in configuration files [message #990798 is a reply to message #990795] Fri, 14 December 2012 05:18 Go to previous messageGo to next message
Sebastian Lorenz is currently offline Sebastian Lorenz
Messages: 25
Registered: November 2010
Junior Member
Yes, I trimmed it down until I only had the bp:reference-list element under the Srpring bean element, like:
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:bp="http://www.osgi.org/xmlns/blueprint/v1.0.0"
	xmlns:p="http://www.springframework.org/schema/p"
	xmlns:osgi="http://www.springframework.org/schema/osgi"
	xmlns:task="http://www.springframework.org/schema/task"
	xmlns:util="http://www.springframework.org/schema/util"
	xsi:schemaLocation="
		http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
		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
		http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd		
		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
    
    <bp:reference-list id="cloneableServices" interface="java.lang.Cloneable" />
</beans>


This fails.
Btw: Even the Eclipse XML Editor shows the "...no declaration can be found for element 'bp:reference-list'."-error
Re: Mixing Blueprint and Sprint namespaces in configuration files [message #990804 is a reply to message #990798] Fri, 14 December 2012 05:35 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn Normington
Messages: 1186
Registered: July 2009
Senior Member
Ah, sorry, I remember now - this is a restriction which was raised in bug 356681. If you make blueprint the default namespace, you should be able to mix the namespaces.
Re: Mixing Blueprint and Sprint namespaces in configuration files [message #990838 is a reply to message #990804] Fri, 14 December 2012 06:52 Go to previous messageGo to next message
Sebastian Lorenz is currently offline Sebastian Lorenz
Messages: 25
Registered: November 2010
Junior Member
Thanks, I'll try it.
Re: Mixing Blueprint and Sprint namespaces in configuration files [message #990853 is a reply to message #990804] Fri, 14 December 2012 08:48 Go to previous messageGo to next message
eis - is currently offline eis -
Messages: 16
Registered: September 2012
Junior Member
I tried doing this for the default petclinic application, but this is what I seemed to always get:

15:31:13,749 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/petclinic-gemini]] (MSC service thread 1-4) Servlet /petclinic-gemini threw load() exception: org.springframework.beans.FatalBeanException: Class [org.eclipse.gemini.blueprint.blueprint.config.BlueprintNamespaceHandler] for namespace [http://www.osgi.org/xmlns/blueprint/v1.0.0] does not implement the [org.springframework.beans.factory.xml.NamespaceHandler] interface
        at org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver


I tried to move petclinic-servlet.xml to WEB-INF/spring and to META-INF/spring, but that'll just give FileNotFoundException.

Is there something simple I'm missing?

Tried with

<?xml version="1.0" encoding="UTF-8"?>
<!--
    - DispatcherServlet application context for PetClinic's web tier.
-->
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" 
        xmlns:beans="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:p="http://www.springframework.org/schema/p"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:oxm="http://www.springframework.org/schema/oxm"
        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
                http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd
                http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">



and then having beans: namespace etc in all the existing entries.
Re: Mixing Blueprint and Sprint namespaces in configuration files [message #990854 is a reply to message #990853] Fri, 14 December 2012 09:00 Go to previous message
eis - is currently offline eis -
Messages: 16
Registered: September 2012
Junior Member
Ah, nevermind, this seems to be due to same classloding thing I have in the other thread.
Previous Topic:Blueprint xml namespace issues, pt2
Next Topic:Gemini Web 2.2.0 RC1 is now available
Goto Forum:
  


Current Time: Wed Jun 19 17:31:50 EDT 2013

Powered by FUDForum. Page generated in 0.01612 seconds