13 Replies Latest reply on Jan 29, 2013 2:46 AM by Edward Isakov

    Create IbatisComponent when migrating project to Fuse ESB Enterprise 7.1

    Edward Isakov Newbie

      Error occurs when migrating a project from apache-servicemix-4.3.1-fuse-01-15 to Fuse-ESB-Enterprise-7.1.0.fuse-047.

      I use to work with a data base bundle, which provides connections pull (db-bso).

       

      Spring decription: (src/main/resources/META-INF/beans.xml)

       

       

       

      request1.xml, request2.xml, request3.xml placed in src/main/resources/META-INF.

       

      When i used apache-servicemix-4.3.1-fuse-01-15 it was all right.

      When i use Fuse-ESB-Enterprise-7.1.0.fuse-047 error occurs:

       

       

      16:51:28,247 | ERROR | SpringOsgiExtenderThread-8 | ContextLoaderListener            |

       

      org.springframework.osgi.extender.internal.support.DefaultOsgiBundleApplicationContextListener   50 | 113 - org.springframework.osgi.extender - 1.2.1 |

       

      Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=ru.alfastrah.interplat7.db-bso, config=osgibundle:/META-INF/spring/*.xml))

      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IbatisACBSO' defined in URL

       

      bundle://250.12:0/META-INF/spring/beans.xml: Invocation of init method failed; nested exception is java.lang.NullPointerException

           at

       

      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1422)[105:org.springframe

       

      work.beans:3.0.7.RELEASE]

           at

       

      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:518)[105:org.springframewor

       

      k.beans:3.0.7.RELEASE]

           at

       

      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)[105:org.springframework.

       

      beans:3.0.7.RELEASE]

           at

       

      org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)[105:org.springframework.beans:3.0.7.RELEASE]

           at

       

      org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)[105:org.springframework.beans:3.0.

       

      7.RELEASE]

           at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)[105:org.springframework.beans:3.0.7.RELEASE]

           at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)[105:org.springframework.beans:3.0.7.RELEASE]

           at

       

      org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)[105:org.springframework.be

       

      ans:3.0.7.RELEASE]

           at

       

      org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)[104:org.springframework.c

       

      ontext:3.0.7.RELEASE]

           at

       

      org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)[114:o

       

      rg.springframework.osgi.core:1.2.1]

           at

       

      org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)[114:org.sp

       

      ringframework.osgi.core:1.2.1]

           at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[114:org.springframework.osgi.core:1.2.1]

           at

       

      org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)[

       

      114:org.springframework.osgi.core:1.2.1]

           at

       

      org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicatio

       

      nContextExecutor.java:132)[113:org.springframework.osgi.extender:1.2.1]

           at java.lang.Thread.run(Thread.java:662)[:1.6.0_26]

      Caused by: java.lang.NullPointerException

           at

       

      org.apache.camel.component.ibatis.IBatisComponent.createSqlMapClient(IBatisComponent.java:84)[251:org.apache.camel.camel-ibatis:2.10.0.fuse-71-047]

           at org.apache.camel.component.ibatis.IBatisComponent.getSqlMapClient(IBatisComponent.java:100)[251:org.apache.camel.camel-ibatis:2.10.0.fuse-71-047]

           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_26]

           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_26]

           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_26]

           at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_26]

           at

       

      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1546)[105:org.spr

       

      ingframework.beans:3.0.7.RELEASE]

           at

       

      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1487)[105:org.springfr

       

      amework.beans:3.0.7.RELEASE]

           at

       

      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1419)[105:org.springframe

       

      work.beans:3.0.7.RELEASE]

           ... 14 more

        • 1. Re: Create IbatisComponent when migrating project to Fuse ESB Enterprise 7.1
          Claus Ibsen Master

          Hi

           

          You should not use that init-method, as Camel components initializes themselves automatic when Camel startup.

           

          I suggest to remove that init-method from your  with the Camel iBatis component.

          • 2. Re: Create IbatisComponent when migrating project to Fuse ESB Enterprise 7.1
            Edward Isakov Newbie

            Thank you for reply. I removed init-method from the bean declaration. Pull of connection starts (db-bso). But when I call stored procedure from another bundle, error occurs:

             

            09:16:19,878 | DEBUG | qtp6953343-438 - /PolicyService | DefaultErrorHandler              | org.apache.camel.util.CamelLogger  170 | 147 - org.apache.camel.camel-core - 2.10.0.fuse-71-047 | Failed delivery for (MessageId: ID-1-1814-3100-1358956419738-1-2 on ExchangeId: ID-1-1814-3100-1358956419738-1-1). On delivery attempt: 0 caught: java.io.FileNotFoundException: Cannot find resource in classpath for URI: SqlMapConfig.xml

             

             

            beans.xml (spring) of that bundle

             

                 <osgi:reference id="importedIbatisACBSO" interface="org.apache.camel.component.ibatis.IBatisComponent"

                      bean-name="IbatisACBSO" cardinality="1..1" />

             

            route where error occurs:

             

                       from("direct:getbso")

                       .process(....)

                       .to("log:...")

                       .to("importedIbatisACBSO:GET_FROM_BSO?statementType=Update")

                             ...

                             ;

            • 3. Re: Create IbatisComponent when migrating project to Fuse ESB Enterprise 7.1
              Claus Ibsen Master

              So you define ibatis in one bundle.

              And use it in another bundle?

              • 5. Re: Create IbatisComponent when migrating project to Fuse ESB Enterprise 7.1
                Claus Ibsen Master

                Ah yeah then you need to do the trick with forcing the component to start, by using the init-method="getSqlMapClient"

                • 7. Re: Create IbatisComponent when migrating project to Fuse ESB Enterprise 7.1
                  Edward Isakov Newbie

                  The bundle db-bso (from my first post)

                   

                  Edited by: isakoves on Jan 25, 2013 5:36 AM

                  • 8. Re: Create IbatisComponent when migrating project to Fuse ESB Enterprise 7.1
                    Freeman(Yue) Fang Master

                    Hi,

                     

                    Refer resources between bundles in OSGi container is tricky, it's same like package/class reference.

                     

                    So you can put SqlMapConfig.xml in a unique package of your db-bso bundle, something like x.y.z.forSqlMapConfig, then export package x.y.z.forSqlMapConfig, and in other bundle which need use SqlMapConfig.xml, you import  package x.y.z.forSqlMapConfig , this way can make resources available across bundles.

                     

                    Freeman

                    • 9. Re: Create IbatisComponent when migrating project to Fuse ESB Enterprise 7.1
                      Claus Ibsen Master

                      The default location where the Camel iBatis component look for the sql map client file is

                         private static final String DEFAULT_CONFIG_URI = "classpath:SqlMapConfig.xml";
                      

                       

                      Which means it looks in the root of the classpath. Have you put the .xml file there? If not you need to specify the location. Something alike:

                       

                      <bean id="IbatisACBSO" class="org.apache.camel.component.ibatis.IBatisComponent" init-method="getSqlMapClient">
                         <property name="sqlMapConfig" value="classpath:META-INF/SqlMapConfig.xml"></property>
                      <bean>
                      

                       

                      • 11. Re: Create IbatisComponent when migrating project to Fuse ESB Enterprise 7.1
                        Edward Isakov Newbie

                        Similar error occurs:

                         

                        13:24:59,635 | DEBUG | SpringOsgiExtenderThread-6 | OsgiBundleXmlApplicationContext  | org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext  379 | 104 - org.springframework.context - 3.0.7.RELEASE | Post refresh error

                        org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IbatisACBSO' defined in URL bundle://277.4:0/META-INF/spring/beans.xml: Invocation of init method failed; nested exception is java.lang.NullPointerException

                             at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1422)[105:org.springframework.beans:3.0.7.RELEASE]

                             at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:518)[105:org.springframework.beans:3.0.7.RELEASE]

                             at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)[105:org.springframework.beans:3.0.7.RELEASE]

                             at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)[105:org.springframework.beans:3.0.7.RELEASE]

                             at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)[105:org.springframework.beans:3.0.7.RELEASE]

                             at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)[105:org.springframework.beans:3.0.7.RELEASE]

                             at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)[105:org.springframework.beans:3.0.7.RELEASE]

                             at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)[105:org.springframework.beans:3.0.7.RELEASE]

                             at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)[104:org.springframework.context:3.0.7.RELEASE]

                             at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)[114:org.springframework.osgi.core:1.2.1]

                             at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)[114:org.springframework.osgi.core:1.2.1]

                             at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[114:org.springframework.osgi.core:1.2.1]

                             at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)[114:org.springframework.osgi.core:1.2.1]

                             at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)[113:org.springframework.osgi.extender:1.2.1]

                             at java.lang.Thread.run(Thread.java:662)[:1.6.0_26]

                        Caused by: java.lang.NullPointerException

                             at org.apache.camel.component.ibatis.IBatisComponent.createSqlMapClient(IBatisComponent.java:84)[251:org.apache.camel.camel-ibatis:2.10.0.fuse-71-047]

                             at org.apache.camel.component.ibatis.IBatisComponent.getSqlMapClient(IBatisComponent.java:100)[251:org.apache.camel.camel-ibatis:2.10.0.fuse-71-047]

                             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                             at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_26]

                             at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1546)[105:org.springframework.beans:3.0.7.RELEASE]

                             at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1487)[105:org.springframework.beans:3.0.7.RELEASE]

                             at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1419)[105:org.springframework.beans:3.0.7.RELEASE]

                        • 12. Re: Create IbatisComponent when migrating project to Fuse ESB Enterprise 7.1
                          Claus Ibsen Master

                          Ah

                           

                            InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(getCamelContext().getClassResolver(), sqlMapConfig);
                          

                           

                          What you do is not possible. Beacuse that code line above is on the Camel ibatis component and it requires a CamelContext to work. And there is no CamelContext in your bundle.

                           

                          What you did before was essentially a bit wrong, but possible in the older release. As back then the IBatis component could invoke getSqlMapClient method within a CamelContext at all.

                           

                          I guess Blueprint has a short coming here. As you want to define common Camel components in one bundle. And refer to it from other bundles. But a Camel component is tied to a CamelContext, and not re-useable among other CamelContxext's.

                           

                          Though in your case to work around the NPE you would need set the sqlMapClient property, which is a com.ibatis.sqlmap.client.SqlMapClient type.

                           

                          And to do that in XML is possible a bit more tricky.

                           

                          Edited by: davsclaus on Jan 25, 2013 2:17 PM

                          • 13. Re: Create IbatisComponent when migrating project to Fuse ESB Enterprise 7.1
                            Edward Isakov Newbie

                            Thank you! I created IBatisComponent using FactoryBean (http://blog.springsource.org/2011/08/10/beyond-the-factorybean/) without SqlMapConfig transactionManager

                            , but it's not working.

                            If I use transactionManager, error occurs when bundle db-bso starting:

                             

                            SqlMapConfig.xml

                             

                                  

                             

                            Error:

                             

                            10:54:44,113 | ERROR | SpringOsgiExtenderThread-10 | ContextLoaderListener            | org.springframework.osgi.extender.internal.support.DefaultOsgiBundleApplicationContextListener   50 | 113 - org.springframework.osgi.extender - 1.2.1 | Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=ru.alfastrah.interplat7.db-bso, config=osgibundle:/META-INF/spring/*.xml))

                            org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IbatisACBSO' defined in URL bundle://295.2:0/META-INF/spring/beans.xml: Cannot resolve reference to bean 'mCreateSqlMapClient' while setting bean property 'sqlMapClient'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mCreateSqlMapClient': FactoryBean threw exception on object creation; nested exception is java.lang.RuntimeException: Error occurred.  Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/transactionManager/dataSource/end()'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There was an error configuring JndiDataSourceTransactionPool. Cause: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial

                                 at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1327)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1085)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:516)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)[104:org.springframework.context:3.0.7.RELEASE]

                                 at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)[114:org.springframework.osgi.core:1.2.1]

                                 at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)[114:org.springframework.osgi.core:1.2.1]

                                 at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[114:org.springframework.osgi.core:1.2.1]

                                 at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)[114:org.springframework.osgi.core:1.2.1]

                                 at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)[113:org.springframework.osgi.extender:1.2.1]

                                 at java.lang.Thread.run(Thread.java:662)[:1.6.0_26]

                            Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mCreateSqlMapClient': FactoryBean threw exception on object creation; nested exception is java.lang.RuntimeException: Error occurred.  Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/transactionManager/dataSource/end()'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There was an error configuring JndiDataSourceTransactionPool. Cause: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial

                                 at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:109)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1440)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:247)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)[105:org.springframework.beans:3.0.7.RELEASE]

                                 ... 17 more

                            Caused by: java.lang.RuntimeException: Error occurred.  Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/transactionManager/dataSource/end()'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There was an error configuring JndiDataSourceTransactionPool. Cause: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial

                                 at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:49)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 at com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientBuilder.java:63)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 at ru.alfastrah.interplat4.db.bso.createsqlmapclient.CreateSqlMapClient.createSqlMapClient(CreateSqlMapClient.java:56)[295:ru.alfastrah.interplat7.db-bso:1.0.7.SNAPSHOT]

                                 at ru.alfastrah.interplat4.db.bso.createsqlmapclient.CreateSqlMapClient.getObject(CreateSqlMapClient.java:71)[295:ru.alfastrah.interplat7.db-bso:1.0.7.SNAPSHOT]

                                 at ru.alfastrah.interplat4.db.bso.createsqlmapclient.CreateSqlMapClient.getObject(CreateSqlMapClient.java:13)[295:ru.alfastrah.interplat7.db-bso:1.0.7.SNAPSHOT]

                                 at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)[105:org.springframework.beans:3.0.7.RELEASE]

                                 ... 22 more

                            Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/transactionManager/dataSource/end()'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There was an error configuring JndiDataSourceTransactionPool. Cause: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial

                                 at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:53)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:46)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 ... 27 more

                            Caused by: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/transactionManager/dataSource/end()'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There was an error configuring JndiDataSourceTransactionPool. Cause: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial

                                 at com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:123)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:105)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:102)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:102)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:72)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:51)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 ... 28 more

                            Caused by: com.ibatis.sqlmap.client.SqlMapException: There was an error configuring JndiDataSourceTransactionPool. Cause: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial

                                 at com.ibatis.sqlmap.engine.datasource.JndiDataSourceFactory.initialize(JndiDataSourceFactory.java:60)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser$9.process(SqlMapConfigParser.java:220)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 at com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:121)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 ... 33 more

                            Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial

                                 at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)[:1.6.0_26]

                                 at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)[:1.6.0_26]

                                 at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)[:1.6.0_26]

                                 at javax.naming.InitialContext.lookup(InitialContext.java:392)[:1.6.0_26]

                                 at com.ibatis.sqlmap.engine.datasource.JndiDataSourceFactory.initialize(JndiDataSourceFactory.java:48)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 ... 35 more

                             

                            I tried to add jndi.properties file on the classpath, that contains

                            java.naming.factory.initial = org.apache.camel.util.jndi.CamelInitialContextFactory

                             

                            In that case error occurs

                             

                            11:23:37,837 | ERROR | SpringOsgiExtenderThread-12 | ContextLoaderListener            | org.springframework.osgi.extender.internal.support.DefaultOsgiBundleApplicationContextListener   50 | 113 - org.springframework.osgi.extender - 1.2.1 | Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=ru.alfastrah.interplat7.db-bso, config=osgibundle:/META-INF/spring/*.xml))

                            org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IbatisACBSO' defined in URL bundle://295.3:0/META-INF/spring/beans.xml: Cannot resolve reference to bean 'mCreateSqlMapClient' while setting bean property 'sqlMapClient'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mCreateSqlMapClient': FactoryBean threw exception on object creation; nested exception is java.lang.RuntimeException: Error occurred.  Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/transactionManager/dataSource/end()'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There was an error configuring JndiDataSourceTransactionPool. Cause: javax.naming.NamingException: scheme osgi not recognized

                                 at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1327)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1085)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:516)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)[104:org.springframework.context:3.0.7.RELEASE]

                                 at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)[114:org.springframework.osgi.core:1.2.1]

                                 at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)[114:org.springframework.osgi.core:1.2.1]

                                 at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[114:org.springframework.osgi.core:1.2.1]

                                 at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)[114:org.springframework.osgi.core:1.2.1]

                                 at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)[113:org.springframework.osgi.extender:1.2.1]

                                 at java.lang.Thread.run(Thread.java:662)[:1.6.0_26]

                            Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mCreateSqlMapClient': FactoryBean threw exception on object creation; nested exception is java.lang.RuntimeException: Error occurred.  Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/transactionManager/dataSource/end()'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There was an error configuring JndiDataSourceTransactionPool. Cause: javax.naming.NamingException: scheme osgi not recognized

                                 at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:109)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1440)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:247)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)[105:org.springframework.beans:3.0.7.RELEASE]

                                 at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)[105:org.springframework.beans:3.0.7.RELEASE]

                                 ... 17 more

                            Caused by: java.lang.RuntimeException: Error occurred.  Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/transactionManager/dataSource/end()'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There was an error configuring JndiDataSourceTransactionPool. Cause: javax.naming.NamingException: scheme osgi not recognized

                                 at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:49)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 at com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientBuilder.java:63)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 at ru.alfastrah.interplat4.db.bso.createsqlmapclient.CreateSqlMapClient.createSqlMapClient(CreateSqlMapClient.java:56)[295:ru.alfastrah.interplat7.db-bso:1.0.7.SNAPSHOT]

                                 at ru.alfastrah.interplat4.db.bso.createsqlmapclient.CreateSqlMapClient.getObject(CreateSqlMapClient.java:71)[295:ru.alfastrah.interplat7.db-bso:1.0.7.SNAPSHOT]

                                 at ru.alfastrah.interplat4.db.bso.createsqlmapclient.CreateSqlMapClient.getObject(CreateSqlMapClient.java:13)[295:ru.alfastrah.interplat7.db-bso:1.0.7.SNAPSHOT]

                                 at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)[105:org.springframework.beans:3.0.7.RELEASE]

                                 ... 22 more

                            Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/transactionManager/dataSource/end()'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There was an error configuring JndiDataSourceTransactionPool. Cause: javax.naming.NamingException: scheme osgi not recognized

                                 at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:53)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:46)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 ... 27 more

                            Caused by: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/transactionManager/dataSource/end()'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There was an error configuring JndiDataSourceTransactionPool. Cause: javax.naming.NamingException: scheme osgi not recognized

                                 at com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:123)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:105)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:102)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:102)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:72)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:51)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 ... 28 more

                            Caused by: com.ibatis.sqlmap.client.SqlMapException: There was an error configuring JndiDataSourceTransactionPool. Cause: javax.naming.NamingException: scheme osgi not recognized

                                 at com.ibatis.sqlmap.engine.datasource.JndiDataSourceFactory.initialize(JndiDataSourceFactory.java:60)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser$9.process(SqlMapConfigParser.java:220)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 at com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:121)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 ... 33 more

                            Caused by: javax.naming.NamingException: scheme osgi not recognized

                                 at org.apache.camel.util.jndi.JndiContext.lookup(JndiContext.java:218)[147:org.apache.camel.camel-core:2.10.0.fuse-71-047]

                                 at javax.naming.InitialContext.lookup(InitialContext.java:392)[:1.6.0_26]

                                 at com.ibatis.sqlmap.engine.datasource.JndiDataSourceFactory.initialize(JndiDataSourceFactory.java:48)[252:org.apache.servicemix.bundles.ibatis-sqlmap:2.3.4.726_4]

                                 ... 35 more