You can do it with blueprint even if you use spring beans. You can also use Aries blueprint spring extender but the namespace is blueprint anyway.
Regards JB > Le 14 sept. 2021 à 11:13, Andrei Petru Mura <[email protected]> a écrit : > > > Hi Jean, > > I sent the email too quick. > > I need to publish my spring beans as OSGI services, so that I would be able > to use them from other bundles which are also spring based bundles. Why I > need spring? Because my platform is built on top of spring framework. > Would this be possible? Or do I have to change all my configuration to OSGI > beans? > > Andrei > >> On Tue, Sep 14, 2021 at 12:11 PM Andrei Petru Mura <[email protected]> >> wrote: >> Hi Jean, >> >> I need to publish my spring beans as OSGI services, so that I would be able >> to use them from other bundles which are also spring based. Why I need >> spring? Because my platform is built on top of it. Would this be >> >>> On Mon, Sep 13, 2021 at 3:14 PM Jean-Baptiste Onofré <[email protected]> >>> wrote: >>> Hi Andrei, >>> >>> OK, let me try to summarize. >>> >>> spring-dm is a spring extension allowing you to use OSGi services in spring. >>> >>> For instance, you use spring-dm to have <osgi:service/> or >>> <osgi:reference/> elements. >>> >>> If you don't need this, you can use spring directly in Karaf (not need >>> to use blueprint). >>> >>> If you want to use blueprint <service/> and <reference/> (blueprint is >>> the specification coming from spring-dm), then, you need blueprint only >>> (no need to use spring). >>> >>> A bean can be used in blueprint the same way you do in spring: >>> >>> <bean id="foo" class="..."/> >>> >>> So, migrating from spring-dm to blueprint is pretty straight forward >>> (change namespace and <osgi:*/>). >>> >>> Now, about the blueprint-spring-extender, it allows you to use some >>> spring elements in blueprint XML (like <transaction/>, etc). >>> >>> Regards >>> JB >>> >>> On 13/09/2021 11:40, Andrei Petru Mura wrote: >>> > I'm trying to upgrade my Karaf 4.0.4 to 4.3.2. In 4.0.4, my bundles are >>> > deployed as spring apps loaded by spring-dm. In karaf 4.3.2 I have no >>> > longer spring-dm. I think the only way to do this, is via blueprint: >>> > Aries or Gemini. But as Aries is the default in Karaf, I would go for >>> > Aries. >>> > 1. Do you have a specific scenario on how I can start my spring bundles >>> > other then blueprint? Or using blueprint? >>> > 2. If I have no other option than to switch to blueprint, do I have to >>> > replace my spring beans with Java beans? >>> > >>> > Thanks, >>> > Mura Andrei >>> > >>> > On Mon, Sep 13, 2021 at 12:33 PM Jean-Baptiste Onofré <[email protected] >>> > <mailto:[email protected]>> wrote: >>> > >>> > I'm not sure I follow what you are trying ;) >>> > >>> > It seems you are mixing CamelContext Spring and Blueprint. >>> > >>> > If you use Spring CamelContext you don't need blueprint. >>> > >>> > If you want to use blueprint (eventually with the extender), you can >>> > use >>> > blueprint namespace. >>> > >>> > So, my point is: what namespace do you want to use ? spring or >>> > blueprint ? >>> > >>> > Regards >>> > JB >>> > >>> > On 13/09/2021 11:30, Jean-Baptiste Onofré wrote: >>> > > The aries-blueprint-spring extender is to support spring context. >>> > So as >>> > > you use spring camel context in your camel bundle, it's the one >>> > involved. >>> > > >>> > > Why not using camel-blueprint namespace ? >>> > > >>> > > <camelContext xmlns="http://camel.apache.org/schema/blueprint >>> > <http://camel.apache.org/schema/blueprint>"/> >>> > > >>> > > and using OSGI-INF/blueprint for your loading ? >>> > > >>> > > Regards >>> > > JB >>> > > >>> > > On 13/09/2021 11:04, Andrei Petru Mura wrote: >>> > >> Hi Jean, >>> > >> >>> > >> Do you think this can be related to spring loading? If I modify >>> > the >>> > >> context file to this: >>> > >> >>> > >> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0 >>> > <http://www.osgi.org/xmlns/blueprint/v1.0.0> >>> > >> <http://www.osgi.org/xmlns/blueprint/v1.0.0 >>> > <http://www.osgi.org/xmlns/blueprint/v1.0.0>>"> >>> > >> </blueprint> >>> > >> >>> > >> I get this: >>> > >> Unable to start container for blueprint bundle >>> > >> *my-bundle/version.of.the.bundle* >>> > >> java.lang.RuntimeException: >>> > >> >>> > >>> > org.springframework.beans.factory.parsing.BeanDefinitionParsingException: >>> > >>> > >> Configuration problem: Failed to import bean definitions from URL >>> > >> location >>> > >> >>> > >>> > [bundle://6f3b550d-56d9-4050-9a00-265a618c1c72_120.0:0/META-INF/spring/camel-context.xml] >>> > >>> > >> >>> > >> Offending resource: URL >>> > >> >>> > >>> > [file:/apache-karaf/data/tmp/blueprint-spring-extender300655750637593520.xml]; >>> > >>> > >> nested exception is >>> > >> >>> > org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: >>> > >> Line 11 in XML document from URL >>> > >> >>> > >>> > [bundle://6f3b550d-56d9-4050-9a00-265a618c1c72_120.0:0/META-INF/spring/camel-context.xml] >>> > >>> > >> is invalid; nested exception is org.xml.sax.SAXParseException; >>> > >> lineNumber: 11; columnNumber: 63; cvc-elt.1: Cannot find the >>> > >> declaration of element 'blueprint'. >>> > >> >>> > >> So, it seems to me the loading is made by spring, not by aries. >>> > Below >>> > >> are my spring related installed features (I put only the installed >>> > >> ones for the sake of readability): >>> > >> >>> > >> karaf@root()> feature:list | grep -i spring >>> > >> spring x 5.3.5.1 x >>> > >> x Started x spring-4.3.2 x Spring >>> > 5.3.x support >>> > >> spring-jdbc x 5.3.5.1 x >>> > >> x Started x spring-4.3.2 x Spring >>> > 5.3.x JDBC >>> > >> support >>> > >> spring-orm x 5.3.5.1 x x >>> > >> x Started x spring-4.3.2 x Spring >>> > 5.3.x ORM >>> > >> supportrt >>> > >> spring-tx x 5.3.5.1 x >>> > >> x Started x spring-4.3.2 x Spring 5.3.x >>> > >> Transaction (TX) support >>> > >> aries-blueprint-spring x 0.0.0 x x >>> > >> x Started x spring-4.3.2 x >>> > >> camel-spring x 2.25.4 x x >>> > >> x Started x camel-2.25.4 x >>> > >> >>> > >> Anyway, taking in account that aries-blueprint-spring is the one >>> > which >>> > >> starts the loading, I'm a bit confused. >>> > >> Any guidance would be appreciated. Thanks. >>> > >> >>> > >> Andrei >>> > >> >>> > >> On Mon, Sep 13, 2021 at 11:50 AM Andrei Petru Mura >>> > >> <[email protected] <mailto:[email protected]> >>> > <mailto:[email protected] <mailto:[email protected]>>> wrote: >>> > >> >>> > >> Hi Jean, >>> > >> >>> > >> Yes, I do. >>> > >> >>> > >> karaf@root()> feature:list | grep -i blueprint >>> > >> aries-blueprint-spring x 0.0.0 x >>> > x >>> > >> x Started x spring-4.3.2 x >>> > >> camel-blueprint x 2.25.4 x >>> > x >>> > >> x Started x camel-2.25.4 x >>> > >> aries-blueprint x 4.3.2 x >>> > >> x Started x standard-4.3.2 x Aries >>> > Blueprint >>> > >> jaas-deployer x 4.3.2 x >>> > >> x Uninstalled x standard-4.3.2 x Allow >>> > >> support of blueprint JAAS configuration in >>> > >> blueprint-web x 4.3.2 x >>> > >> x Uninstalled x standard-4.3.2 x Provides an >>> > >> OSGI-aware Servlet ContextListener fo >>> > >> >>> > >> Andrei >>> > >> >>> > >> On Mon, Sep 13, 2021 at 11:47 AM Jean-Baptiste Onofré >>> > >> <[email protected] <mailto:[email protected]> >>> > <mailto:[email protected] <mailto:[email protected]>>> wrote: >>> > >> >>> > >> Hi Andrei, >>> > >> >>> > >> do you have aries-blueprint feature installed ? >>> > >> >>> > >> Aries Blueprint provides the namespace handler. >>> > >> >>> > >> You can find the feature/example in Karaf repo: >>> > >> >>> > >> >>> > >>> > https://github.com/apache/karaf/tree/main/examples/karaf-camel-example/karaf-camel-example-blueprint >>> > >>> > <https://github.com/apache/karaf/tree/main/examples/karaf-camel-example/karaf-camel-example-blueprint> >>> > >>> > >> >>> > >> >>> > >> >>> > >>> > <https://github.com/apache/karaf/tree/main/examples/karaf-camel-example/karaf-camel-example-blueprint >>> > >>> > <https://github.com/apache/karaf/tree/main/examples/karaf-camel-example/karaf-camel-example-blueprint>> >>> > >>> > >> >>> > >> >>> > >> Regards >>> > >> JB >>> > >> >>> > >> On 13/09/2021 10:44, Andrei Petru Mura wrote: >>> > >> > Hi all, >>> > >> > >>> > >> > I'm trying to get ready a bundle in Karaf 4.3.2. In >>> > karaf I >>> > >> have >>> > >> > installed camel, spring and aries by default (along >>> > it's >>> > >> > aries-blueprint-spring feature). >>> > >> > My blueprint XML file looks like below (I reduced it to >>> > >> minimum). >>> > >> > >>> > >> > <blueprint >>> > xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0 >>> > <http://www.osgi.org/xmlns/blueprint/v1.0.0> >>> > >> <http://www.osgi.org/xmlns/blueprint/v1.0.0 >>> > <http://www.osgi.org/xmlns/blueprint/v1.0.0>> >>> > >> > <http://www.osgi.org/xmlns/blueprint/v1.0.0 >>> > <http://www.osgi.org/xmlns/blueprint/v1.0.0> >>> > >> <http://www.osgi.org/xmlns/blueprint/v1.0.0 >>> > <http://www.osgi.org/xmlns/blueprint/v1.0.0>>>" >>> > >> > >>> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance >>> > <http://www.w3.org/2001/XMLSchema-instance> >>> > >> <http://www.w3.org/2001/XMLSchema-instance >>> > <http://www.w3.org/2001/XMLSchema-instance>> >>> > >> > <http://www.w3.org/2001/XMLSchema-instance >>> > <http://www.w3.org/2001/XMLSchema-instance> >>> > >> <http://www.w3.org/2001/XMLSchema-instance >>> > <http://www.w3.org/2001/XMLSchema-instance>>>" >>> > >> > >>> > >> > >>> > >> >>> > >> >>> > xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 >>> > <http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0> >>> > >> >>> > <http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 >>> > <http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0>> >>> > >> > >>> > <http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 >>> > <http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0> >>> > >> >>> > <http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 >>> > <http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0>>>" >>> > >> > xsi:schemaLocation=" >>> > >> > http://www.osgi.org/xmlns/blueprint/v1.0.0 >>> > <http://www.osgi.org/xmlns/blueprint/v1.0.0> >>> > >> <http://www.osgi.org/xmlns/blueprint/v1.0.0 >>> > <http://www.osgi.org/xmlns/blueprint/v1.0.0>> >>> > >> > <http://www.osgi.org/xmlns/blueprint/v1.0.0 >>> > <http://www.osgi.org/xmlns/blueprint/v1.0.0> >>> > >> <http://www.osgi.org/xmlns/blueprint/v1.0.0 >>> > <http://www.osgi.org/xmlns/blueprint/v1.0.0>>> >>> > >> > >>> > http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd >>> > <http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd> >>> > >> >>> > <http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd >>> > <http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd>> >>> > >> > >>> > <http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd >>> > <http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd> >>> > >> >>> > <http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd >>> > <http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd>>> >>> > >> > "> >>> > >> > </blueprint> >>> > >> > >>> > >> > When I try to start the bundle, I get this in logs: >>> > >> > INFO [pool-8-thread-3] Blueprint bundle >>> > >> > *my-bundle/version.of.the.bundle* is waiting for >>> > namespace >>> > >> handlers >>> > >> > [http://www.osgi.org/xmlns/blueprint/v1.0.0 >>> > <http://www.osgi.org/xmlns/blueprint/v1.0.0> >>> > >> <http://www.osgi.org/xmlns/blueprint/v1.0.0 >>> > <http://www.osgi.org/xmlns/blueprint/v1.0.0>> >>> > >> > <http://www.osgi.org/xmlns/blueprint/v1.0.0 >>> > <http://www.osgi.org/xmlns/blueprint/v1.0.0> >>> > >> <http://www.osgi.org/xmlns/blueprint/v1.0.0 >>> > <http://www.osgi.org/xmlns/blueprint/v1.0.0>>>] >>> > >> > >>> > >> > Does anyone have any idea how I can fix this? >>> > >> > >>> > >> > Thanks, >>> > >> > Andrei >>> > >> >>> >
