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 14:13 Go to next message
Sebastian Lorenz is currently offline Sebastian LorenzFriend
Messages: 42
Registered: November 2010
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 17: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 10:07 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
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 10:18 Go to previous messageGo to next message
Sebastian Lorenz is currently offline Sebastian LorenzFriend
Messages: 42
Registered: November 2010
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 10:35 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
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 11:52 Go to previous messageGo to next message
Sebastian Lorenz is currently offline Sebastian LorenzFriend
Messages: 42
Registered: November 2010
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 13:48 Go to previous messageGo to next message
eis - is currently offline eis -Friend
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 14:00 Go to previous messageGo to next message
eis - is currently offline eis -Friend
Messages: 16
Registered: September 2012
Junior Member
Ah, nevermind, this seems to be due to same classloding thing I have in the other thread.
Re: Mixing Blueprint and Spring namespaces in configuration files [message #1101410 is a reply to message #990631] Wed, 04 September 2013 12:28 Go to previous messageGo to next message
Soniya Chavan is currently offline Soniya ChavanFriend
Messages: 4
Registered: September 2013
Junior Member
Thanks for the above discussion it was great help.
I want to declare reference-list element inside a property element is that possible?
<blueprint 
[Added required namespace here]
>
       
       <beans:bean name="remoteManager" class="com.myapp.platform.remote.RemoteManager" init-method="start">
                     <beans:property name="services">
                           <reference-list id="serviceRefList" interface="com.myapp.IRemoteServiceProvider" member-type="service-object" />
                     </beans>
       </beans:bean>
</blueprint>


But I get an error The matching wildcard is strict, but no declaration can be found for element 'reference-list'.

If I place the <reference-list> outside the <beans:bean> then I do not get any error but the <reference-list> is supposed to get updated dynamically if new services are registered that implement the IRemoteServiceProvider interface and I want the services property to be updated too.

Please help.
Re: Mixing Blueprint and Spring namespaces in configuration files [message #1101444 is a reply to message #1101410] Wed, 04 September 2013 13:16 Go to previous messageGo to next message
Sebastian Lorenz is currently offline Sebastian LorenzFriend
Messages: 42
Registered: November 2010
Member
Did you try:
<reference-list id="serviceRefList" interface="com.myapp.IRemoteServiceProvider" member-type="service-object" />

<beans:bean name="remoteManager" class="com.myapp.platform.remote.RemoteManager" init-method="start">
    <beans:property name="services" ref="serviceRefList"/>
</beans:bean>

?

[Updated on: Wed, 04 September 2013 13:16]

Report message to a moderator

Re: Mixing Blueprint and Spring namespaces in configuration files [message #1101446 is a reply to message #1101444] Wed, 04 September 2013 13:19 Go to previous messageGo to next message
Soniya Chavan is currently offline Soniya ChavanFriend
Messages: 4
Registered: September 2013
Junior Member
Yes thanks I tried that. There is no error but then the services property of the bean does not get changed dynamically even if the list gets updated based on the services available.
Re: Mixing Blueprint and Spring namespaces in configuration files [message #1102195 is a reply to message #1101446] Thu, 05 September 2013 13:49 Go to previous message
Sebastian Lorenz is currently offline Sebastian LorenzFriend
Messages: 42
Registered: November 2010
Member
Hm, this should work. As soon as IRemoteServiceProviders get available/unavailable the services list property in the RemoteManager should get updated automatically.

[Updated on: Thu, 05 September 2013 13:49]

Report message to a moderator

Previous Topic:Gemini Naming 1.0.3.RELEASE is now available
Next Topic:osgi:list with a listener to a bean with prototype scope
Goto Forum:
  


Current Time: Fri Nov 21 18:11:26 GMT 2014

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

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