[ https://issues.apache.org/jira/browse/GERONIMO-4711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12724430#action_12724430 ]
Hendy Irawan commented on GERONIMO-4711: ---------------------------------------- I've diagnosed the issue and after crawling through Karaf, Gshell, and Geronimo Blueprint sources, I've decided that the problem in that Gshell's namespace handler for Blueprint doesn't provide means to do what I'm trying to do, namely creating a CommandAction using factory. However, factory creation is supported by Blueprint. So I'm "blaming" this on Gshell's inadequate support for XML-based configuration at the moment hehe. For now, in order to workaround the problem, I have to create the bean structure manually and export it as OSGi service using Blueprint, i.e. not using GShell namespace at all. I'll make sure to discuss this with GShell guys in order to support factory pattern inside Blueprint XML, as I think this is essential feature. I'm attaching my current (working) Blueprint XML below, for future reference. In addition, I'm also adding XML Schema locations here so IDE support for XML editing is enabled. I find it hard to find documentation on XML syntax for both Blueprint and GShell, and unfortunately all samples I've found never mentioned the XSD location considering it is very useful to remove guesswork. IMHO, A reference to XSD in SVN is still better than no XSD at all. <?xml version="1.0" encoding="UTF-8"?> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://svn.apache.org/repos/asf/geronimo/sandbox/blueprint/blueprint-core/src/main/resources/org/apache/geronimo/blueprint/blueprint.xsd http://felix.apache.org/karaf/xmlns/gshell/v1.0.0 http://svn.apache.org/repos/asf/felix/trunk/karaf/gshell/gshell-core/src/main/resources/org/apache/felix/karaf/gshell/core/karaf-gshell.xsd"> <command-bundle xmlns="http://felix.apache.org/karaf/xmlns/gshell/v1.0.0"> <command name="ou/hello"> <action class="com.openubiquity.caterpillar.HelloAction"> <property name="bundleContext" ref="blueprintBundleContext"/> </action> </command> <command name="ou/iam"> <action class="com.openubiquity.caterpillar.IamAction"> <property name="bundleContext" ref="blueprintBundleContext"/> </action> </command> <command name="ou/show"> <action factory-bean="qi4jApp" factory-method="createShowState"> <property name="bundleContext" ref="blueprintBundleContext"/> <property name="project" ref="theProject" /> </action> </command> <command name="ou/save"> <action class="com.openubiquity.caterpillar.SaveState"> <property name="bundleContext" ref="blueprintBundleContext"/> <property name="project" ref="theProject" /> </action> </command> </command-bundle> <bean id="helloCreator" class="com.openubiquity.caterpillar.HelloCreator"> <property name="bundleContext" ref="blueprintBundleContext"/> </bean> <bean id="hello2Action" factory-ref="helloCreator" factory-method="createHello" /> <bean id="hello2Command" class="org.apache.geronimo.gshell.wisdom.command.StatelessCommand"> <property name="beanContainer"> <bean class="org.apache.felix.karaf.gshell.core.BeanContainerWrapper"> <argument ref="blueprintContainer" /> </bean> </property> <property name="action" ref="hello2Action" /> <property name="location"> <bean class="org.apache.geronimo.gshell.wisdom.registry.CommandLocationImpl"> <argument value="ou/hello2" /> </bean> </property> </bean> <service id="hello2CommandSvc" ref="hello2Command"> <interfaces> <value>org.apache.geronimo.gshell.command.Command</value> </interfaces> </service> <bean id="show2Command" class="org.apache.geronimo.gshell.wisdom.command.StatelessCommand"> <property name="beanContainer"> <bean class="org.apache.felix.karaf.gshell.core.BeanContainerWrapper"> <argument ref="blueprintContainer" /> </bean> </property> <property name="action"> <bean factory-ref="qi4jApp" factory-method="createShowState"> <property name="bundleContext" ref="blueprintBundleContext"/> <property name="project" ref="theProject" /> </bean> </property> <property name="location"> <bean class="org.apache.geronimo.gshell.wisdom.registry.CommandLocationImpl"> <argument value="ou/show2" /> </bean> </property> </bean> <service id="show2CommandSvc" ref="show2Command"> <interfaces> <value>org.apache.geronimo.gshell.command.Command</value> </interfaces> </service> <bean id="qi4jApp" class="com.openubiquity.caterpillar.Qi4jApp" /> <bean id="theProject" class="com.openubiquity.caterpillar.SpringProject"> <property name="name" value="Caterpillar" /> <property name="contextFiles"> <list> <value>bundle-context-osgi.xml</value> <value>bundle-context.xml</value> </list> </property> </bean> </blueprint> I vote to close this bug. Thank you. > Geronimo Blueprint throws > org.osgi.service.blueprint.container.ComponentDefinitionException: Cound not > create component instance > -------------------------------------------------------------------------------------------------------------------------------- > > Key: GERONIMO-4711 > URL: https://issues.apache.org/jira/browse/GERONIMO-4711 > Project: Geronimo > Issue Type: Bug > Security Level: public(Regular issues) > Environment: Ubuntu 9.04, Sun JDK 6u10, Felix 1.8.0, Karaf SNAPSHOT, > Blueprint SNAPSHOT > Reporter: Hendy Irawan > Attachments: caterpillar-blueprint-bug-sampler.tar.bz2, > caterpillar-blueprint-stacktrace.txt > > > Component should be Geronimo Blueprint, but I can't find it in the list. > Relevant context of my Blueprint XML is as below. Do I write the XML > correctly? > <?xml version="1.0" encoding="UTF-8"?> > <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"> > <command-bundle xmlns="http://felix.apache.org/karaf/xmlns/gshell/v1.0.0"> > <command name="ou/show"> > <action factory-bean="qi4jApp" factory-method="createShowState"> > <property name="bundleContext" ref="blueprintBundleContext"/> > <property name="project" ref="theProject" /> > </action> > </command> > </command-bundle> > <bean id="qi4jApp" class="com.openubiquity.caterpillar.Qi4jApp"> > </bean> > > <bean id="theProject" > class="com.openubiquity.caterpillar.SpringProject"> > <property name="name" value="Caterpillar" /> > <property name="contextFiles"> > <list> > <value>bundle-context-osgi.xml</value> > <value>bundle-context.xml</value> > </list> > </property> > </bean> > > </blueprint> > BTW, what is the URL of Blueprint XSD ? -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.