Mixing Blueprint and Spring namespaces in configuration files [message #990631] |
Thu, 13 December 2012 14:13  |
Eclipse User |
|
|
|
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] by Moderator Report message to a moderator
|
|
|
|
Re: Mixing Blueprint and Sprint namespaces in configuration files [message #990798 is a reply to message #990795] |
Fri, 14 December 2012 10:18   |
Eclipse User |
|
|
|
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 #990853 is a reply to message #990804] |
Fri, 14 December 2012 13:48   |
Eclipse User |
|
|
|
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 Spring namespaces in configuration files [message #1101410 is a reply to message #990631] |
Wed, 04 September 2013 12:28   |
Eclipse User |
|
|
|
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.
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04387 seconds