Hi all, not quite done yet.
So new day, new problems. After another round of try/error -- it worked, and did not work next day. Even "one xml deploy" bundle was not working. Now, I am more focused into the CXF project. I am quite sure, this "works today, does not work tomorrow" is due to bundle deploy order. I've found out, that there are multiple Xerces instances flying around. I had one, for some legacy SOAP client generated from WSDL using Axis 1.4. It had Xerces, after a lot of redeploys I've figured out that when Xerces bundle is deployed Karaf is not able to resolve/deploy bundle with Spring XML configuration. I am getting "org.osgi.service.blueprint.container.ComponentDefinitionException: Unsupported node namespace:" ( notice empty namespace ). When I do uninstall of the Xerces bundle -- and restart Spring XML configuration bundle, it works. Repeat Xerces bundle install, Spring XML configuration bundle fails to load. When cxf feature is installed bundle: 313 │ Active │ 30 │ 2.11.0.1 │ org.apache.servicemix.bundles.xerces is installed. I've exported bundles for the feature cxf and JAR file name is: org.apache.servicemix.bundles.xerces-2.11.0_1.jar This is also in line with my first voodoo , when I was asking if it is possible that some dependency makes a mess. I would say, this is the "main problem". Other issue was with ActiveMQ and Camel, and "class cast exceptions" for Spring's classes, also some nice pitfalls there ( all solved with correct bundle deploy order ). What I've notices is - order of the feature/bundle loading is the key and it is not easy. One "innocent" dependency and whole tree of un-wanted bundles is put into the Karaf. I would really really like to know, am I doing so much something extra and no one else has this issues? As all I am doing is loading bundle with spring xml configuration and SOAP server ( with CXF ) and all stops working. It is hard to believe this is "only my problem". The more likely thing is : I am doing all wrong. Also if this is true, I would really like to know what? How can it be, that if I load Apache CXF feature and in another bundle Spring XML Configuration, one "overrides" XML/XSD namespace resolution. To me this is interesting as I would really like to know, how is this connected and how this is even possible. So today's finding is: If you have errors like: No URL is defined for schema http://www.springframework.org/schema/osgi, org.osgi.service.blueprint.container.ComponentDefinitionException: Unsupported node namespace:, go and check if you have Xerces bundle installed. If so, try to uninstall it and restart failed bundle. My guess is - it will start to work. But what now. How to replace Xerces - it is like part of every web/xml related project. I have no answer for this. I've checked CXF source code, and noticed that Spring bundles and versions are not in sync ( version part of the Karaf - referencing CXF Karaf repository ) ... so I would suspect this will be another land mine I will blindly step on. But when things are working, when Karaf is able to load ( over Aries ) bundle with Spring XML configuration -- it works really well and it is really easy to make it work. That is one of the biggest frustration, as it is such a nice platform, but one wrong JAR and all stops working ... Kind Regards, Miroslav V V čet., 11. okt. 2018 ob 12:52 je oseba Miroslav Beranič < [email protected]> napisala: > Hi all, > > I found a solution. > > To repeat/clarify first: > - I am using Karaf 4.2.2 > - I am using "as much as I can" "built in" features > - I am using Spring 4.3 ( features from Karaf's spring-legacy > repository/features ) > - I am using Karaf's feature "aries-blueprint-spring" to get "Spring > Framework XSD namespace" support ( > http://www.springframework.org/schema/osgi ), part of the Aries project, > file located at > /aries/blueprint/blueprint-spring-extender/src/main/resources/org.apache.aries.blueprint.spring.extender/spring-osgi-1.2.xsd, > because of the implementation > org.apache.aries.blueprint.spring.extender.SpringOsgiNamespaceHandler, one > can reference XSD file as spring-osgi.xsd ( it is "renamed" to > spring-osgi-1.2.xsd ). > - I am using bundle from ServiceMix Bundles > org.apache.servicemix.bundles:org.apache.servicemix.bundles.spring-beans/4.3.18 > to get Spring Framework 4.3 XSD files, one can also use > http://www.springframework.org/schema/beans/spring-beans.xsd and will get > http://www.springframework.org/schema/beans/spring-beans-4.3.xsd ( if > bundle version 4.3 is the only one installed , it is in my case ). > - I am not using spring-dm feature from Karaf's repository > > Here, the fun part starts. As I said, it was all working ( one day ) and > than next day ( when installed on new virtual dev box ) it stopped working > throwing errors like: > > 11:09:19.614 ERROR [pool-20-thread-1] Unable to start blueprint container > for bundle framework.service/5.0.1.SNAPSHOT > java.lang.RuntimeException: > org.springframework.beans.factory.parsing.BeanDefinitionParsingException: > Configuration problem: Failed to import bean definitions from URL location > [bundle://90.0:0/META-INF/spring/mm-context.xml] > Offending resource: URL > [file:/path/to/karaf-4.2.2/data/tmp/blueprint-spring-extender1091125880178019981.xml]; > nested exception is > org.springframework.beans.factory.parsing.BeanDefinitionParsingException: > Configuration problem: Failed to import bean definitions from URL location > [classpath:/META-INF/mm/spring/mm-dl-management-beans.xml] > Offending resource: URL [bundle://90.0:0/META-INF/spring/mm-context.xml]; > nested exception is > org.springframework.beans.factory.parsing.BeanDefinitionParsingException: > Configuration problem: Unable to locate Spring NamespaceHandler for XML > schema namespace [http://www.springframework.org/schema/osgi] > Offending resource: class path resource > [META-INF/mm/spring/mm-dl-management-beans.xml] > > at > org.apache.aries.blueprint.spring.BlueprintNamespaceHandler.parse(BlueprintNamespaceHandler.java:132) > ~[?:?] > at > org.apache.aries.blueprint.parser.Parser.parseCustomElement(Parser.java:1369) > ~[47:org.apache.aries.blueprint.core:1.9.0] > at > org.apache.aries.blueprint.parser.Parser.loadComponents(Parser.java:427) > ~[47:org.apache.aries.blueprint.core:1.9.0] > at org.apache.aries.blueprint.parser.Parser.populate(Parser.java:331) > ~[47:org.apache.aries.blueprint.core:1.9.0] > at > org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:351) > [47:org.apache.aries.blueprint.core:1.9.0] > at > org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:278) > [47:org.apache.aries.blueprint.core:1.9.0] > at > org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:299) > [47:org.apache.aries.blueprint.core:1.9.0] > at > org.apache.aries.blueprint.container.BlueprintExtender.access$1100(BlueprintExtender.java:68) > [47:org.apache.aries.blueprint.core:1.9.0] > at > org.apache.aries.blueprint.container.BlueprintExtender$BlueprintContainerServiceImpl.createContainer(BlueprintExtender.java:617) > [47:org.apache.aries.blueprint.core:1.9.0] > at > org.apache.aries.blueprint.spring.extender.SpringOsgiExtension.start(SpringOsgiExtension.java:112) > [49:org.apache.aries.blueprint.spring.extender:0.4.0] > at > org.apache.felix.utils.extender.AbstractExtender$1.run(AbstractExtender.java:265) > [49:org.apache.aries.blueprint.spring.extender:0. > > > And even some times I got even more strange error: > > 12:13:12.969 ERROR [Blueprint Extender: 1] Unable to start blueprint > container for bundle framework.service/5.0.1.SNAPSHOT > org.osgi.service.blueprint.container.ComponentDefinitionException: > Unsupported node namespace: > at > org.apache.aries.blueprint.parser.Parser.getNamespaceHandler(Parser.java:1386) > ~[111:org.apache.aries.blueprint.core:1.9.0] > at > org.apache.aries.blueprint.parser.Parser.getNamespaceHandler(Parser.java:1374) > ~[111:org.apache.aries.blueprint.core:1.9.0] > at > org.apache.aries.blueprint.parser.Parser.decorateCustomNode(Parser.java:1361) > ~[111:org.apache.aries.blueprint.core:1.9.0] > at > org.apache.aries.blueprint.parser.Parser.handleCustomAttributes(Parser.java:1340) > ~[111:org.apache.aries.blueprint.core:1.9.0] > at > org.apache.aries.blueprint.parser.Parser.loadComponents(Parser.java:403) > ~[111:org.apache.aries.blueprint.core:1.9.0] > at org.apache.aries.blueprint.parser.Parser.populate(Parser.java:331) > ~[111:org.apache.aries.blueprint.core:1.9.0] > at > org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:351) > [111:org.apache.aries.blueprint.core:1.9.0] > at > org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:278) > [111:org.apache.aries.blueprint.core:1.9.0] > > ( notice the "empty" namespace ... ) > > > After all the strange things done, to make it work again, I've started > vanilla project ... and it worked. As expected. Simple as putting one xml > inside bundle class path /META-INF/spring/context.xml. > > So, the fun part was -- I "wanted to clean up" config files and I moved > XML files to /META-INF/mm/spring/*.xml and include/import them from > context.xml. > > And this was the issue. It turned out, Blueprint/Spring support will fly > out of the window, when http://www.springframework.org/schema/osgi is > used in a XML file being referenced / included / imported. > > So to fix my issue, I have all the Spring XML files ( that have > http://www.springframework.org/schema/osgi namespace ) stored inside > folder /META-INF/spring/ and all other Spring-only namespaced files in > other locations. > > Did not have the time to look over the source code why is this so, but to > me, this is strange implementation. This is also not "pointed out" in the > documentation or so, so ... fun fun fun. Took me days too long to figure > this out. > > > Kind Regards, > Miroslav > > > > V V sre., 10. okt. 2018 ob 14:39 je oseba Jean-Baptiste Onofré < > [email protected]> napisala: > >> Afair spring-dm doesn't support spring 4.3 either. It's up to spring 4.2. >> so you have to install providing the target version. >> >> Further more you have to install spring-dm or blueprint spring extension. >> >> Regards >> JB >> Le 10 oct. 2018, à 15:34, "Miroslav Beranič" <[email protected]> >> a écrit: >>> >>> Hi both, >>> >>> I thought I wrote too much and lost focus. >>> >>> So, I already use spring-legacy repository, and I get spring-* 4.3.x. I >>> already had all this working. I do not use spring-dm feature ( I see it is >>> available, version 1.2.1, spring-dm and spring-dm-web, did not even notice >>> it before ). >>> >>> I am using aries-blueprint-spring from Karaf's repository. >>> <feature name="aries-blueprint-spring"> >>> <feature>aries-blueprint</feature> >>> <feature>spring</feature> >>> >>> <bundle>mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.spring/${aries.blueprint.spring.version}</bundle> >>> >>> >>> <bundle>mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.spring.extender/${aries.blueprint.spring.extender.version}</bundle> >>> >>> </feature> >>> >>> First I install Spring 4.3 from spring-legacy, next I install >>> aries-blueprint-spring ( as if not in this order, Spring 5.0.x is installed >>> ). >>> <features name="spring-legacy-${project.version}" >>> >>> >>> To do "dry run". In practice this is "correct way" : >>> spring-4.3.x from repository spring-legacy and aries-blueprint-spring >>> from repository spring and I should be all green, or? >>> >>> Any idea what else could go wrong ... some other JMS/JPA/PAX/... >>> dependency/feature to mix it up? >>> >>> My biggest pain is -- as I had working setup, and now I can not make it >>> work anymore. I've reverted my work and Karaf, no luck - either way. >>> >>> >>> Thanks for the directions. >>> >>> >>> Kind Regards, >>> Miroslav >>> >>> >>> >>> >>> V V sre., 10. okt. 2018 ob 14:13 je oseba Guillaume Nodet < >>> [email protected]> napisala: >>> >>>> You can also install the aries-blueprint-spring feature which should >>>> provide support for the spring namespaces. >>>> >>>> Le mer. 10 oct. 2018 à 14:07, Jean-Baptiste Onofré < [email protected]> >>>> a écrit : >>>> >>>>> Hi >>>>> >>>>> It's because your are using spring-dm which is deprecated and works >>>>> only with spring up to 4. >>>>> >>>>> So you have to add the spring-legacy features repo and then you will >>>>> have the spring-dm feature. >>>>> >>>>> Regards >>>>> JB >>>>> Le 10 oct. 2018, à 15:04, "Miroslav Beranič" < >>>>> [email protected]> a écrit: >>>>>> >>>>>> Hi all, >>>>>> >>>>>> I've read some messages in this mailing list ( last I found was in >>>>>> August 2018 ), but I think, I have something different scenario. >>>>>> >>>>>> So, up until today ( when I was doing clean environment setup ) I was >>>>>> able to use define Spring Beans using XML ( as I am porting application, >>>>>> this is like top feature ), but now - out of the blue, I've started to >>>>>> get >>>>>> errors on deployment: >>>>>> >>>>>> 12:13:12.912 INFO [pool-33-thread-1] Generated blueprint for bundle >>>>>> framework.service/5.0.1.SNAPSHOT at >>>>>> /path/to/assemblies/apache-karaf/target/assembly/data/tmp/blueprint-spring-extender1831035315356717600.xml >>>>>> >>>>>> 12:13:12.917 INFO [pool-33-thread-1] Bundle >>>>>> framework.service/5.0.1.SNAPSHOT is waiting for namespace handlers [ >>>>>> http://www.springframework.org/schema/osgi] >>>>>> >>>>>> 12:13:12.895 INFO [features-3-thread-1] >>>>>> org.apache.aries.blueprint.spring.extender/0.4.0 >>>>>> 12:13:12.935 WARN [Blueprint Extender: 1] No URL is defined for >>>>>> schema http://www.springframework.org/schema/osgi. This schema will >>>>>> not be validated >>>>>> 12:13:12.969 ERROR [Blueprint Extender: 1] Unable to start blueprint >>>>>> container for bundle framework.service/5.0.1.SNAPSHOT >>>>>> org.osgi.service.blueprint.container.ComponentDefinitionException: >>>>>> Unsupported node namespace: >>>>>> at >>>>>> org.apache.aries.blueprint.parser.Parser.getNamespaceHandler(Parser.java:1386) >>>>>> ~[111:org.apache.aries.blueprint.core:1.9.0] >>>>>> at >>>>>> org.apache.aries.blueprint.parser.Parser.getNamespaceHandler(Parser.java:1374) >>>>>> ~[111:org.apache.aries.blueprint.core:1.9.0] >>>>>> at >>>>>> org.apache.aries.blueprint.parser.Parser.decorateCustomNode(Parser.java:1361) >>>>>> ~[111:org.apache.aries.blueprint.core:1.9.0] >>>>>> at >>>>>> org.apache.aries.blueprint.parser.Parser.handleCustomAttributes(Parser.java:1340) >>>>>> ~[111:org.apache.aries.blueprint.core:1.9.0] >>>>>> at >>>>>> org.apache.aries.blueprint.parser.Parser.loadComponents(Parser.java:403) >>>>>> ~[111:org.apache.aries.blueprint.core:1.9.0] >>>>>> at >>>>>> org.apache.aries.blueprint.parser.Parser.populate(Parser.java:331) >>>>>> ~[111:org.apache.aries.blueprint.core:1.9.0] >>>>>> at >>>>>> org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:351) >>>>>> [111:org.apache.aries.blueprint.core:1.9.0] >>>>>> at >>>>>> org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:278) >>>>>> [111:org.apache.aries.blueprint.core:1.9.0] >>>>>> at >>>>>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) >>>>>> [?:?] >>>>>> at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?] >>>>>> at >>>>>> org.apache.aries.blueprint.container.ExecutorServiceWrapper.run(ExecutorServiceWrapper.java:106) >>>>>> [111:org.apache.aries.blueprint.core:1.9.0] >>>>>> at >>>>>> org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:45) >>>>>> [111:org.apache.aries.blueprint.core:1.9.0] >>>>>> at >>>>>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) >>>>>> [?:?] >>>>>> at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?] >>>>>> at >>>>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) >>>>>> [?:?] >>>>>> at >>>>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) >>>>>> [?:?] >>>>>> at >>>>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) >>>>>> [?:?] >>>>>> at >>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) >>>>>> [?:?] >>>>>> at java.lang.Thread.run(Thread.java:748) [?:?] >>>>>> >>>>>> So, has something changed about Spring ( Spring DM ) from Karaf's >>>>>> point? I went over GIT commits ( for Karaf 4.2.2, last few weeks ), but >>>>>> did >>>>>> not find anything regarding Spring. I am using Spring 4.3.x ( from Karaf >>>>>> features ). >>>>>> >>>>>> I have spring-beans.xml inside /META-INF/spring/ folder, and I used >>>>>> http://www.springframework.org/schema/osgi namespace to "import" >>>>>> osgi:reference -- and this all worked like a charm. >>>>>> >>>>>> Now I get this error and no way to find any solution. I "kind of" >>>>>> gave up ( as I read JB's comments - why not use ( only ) Blueprint ), so >>>>>> I >>>>>> gave it a try. But than I was starting getting even more strange errors, >>>>>> for example Blueprint failed to set property defined in parent class, >>>>>> or create instance that takes Map as input into class constructor - as I >>>>>> failed to find matching property descriptor or class constructor. >>>>>> >>>>>> Than I went back to original question ... what has changed, that >>>>>> http://www.springframework.org/schema/osgi has stopped working ( as >>>>>> far as I know, spring-dm is even older ( based on the mailing messages >>>>>> I've >>>>>> read ) ), >>>>>> so I've uses aries-blueprint-spring. >>>>>> >>>>>> What am I missing? >>>>>> >>>>>> Kind Regards, >>>>>> Miroslav >>>>>> >>>>>> >>>> >>>> -- >>>> ------------------------ >>>> Guillaume Nodet >>>> >>>> >>> >>> -- >>> Miroslav Beranič >>> MIBESIS >>> +386(0)40/814-843 >>> [email protected] >>> http://www.mibesis.si >>> >> > > -- > Miroslav Beranič > MIBESIS > +386(0)40/814-843 > [email protected] > http://www.mibesis.si > -- Miroslav Beranič MIBESIS +386(0)40/814-843 [email protected] http://www.mibesis.si
