Uploaded image for project: 'Commons DBCP'
  1. Commons DBCP
  2. DBCP-469

getter/setter for connectionInitSqls have different types

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Duplicate
    • 2.1, 2.1.1, 2.2.0
    • None
    • None
    • karaf 3.0.6, datasource configured via blueprint.

    Description

      Using blueprint to setup BasicManagedDatasource fails because getter/setter for connectionInitSqls have different types.

      csi-ds-derby-embedded (281)
      ---------------------------
      Status: Failure
      Blueprint
      23.08.16 13:22
      Exception:
      Error setting property: PropertyDescriptor <name: connectionInitSqls, getter: class org.apache.commons.dbcp2.BasicDataSource.getConnectionInitSqls(), setter: [class org.apache.commons.dbcp2.BasicDataSource.setConnectionInitSqls(interface java.util.Collection)]
      org.osgi.service.blueprint.container.ComponentDefinitionException: Error setting property: PropertyDescriptor <name: connectionInitSqls, getter: class org.apache.commons.dbcp2.BasicDataSource.getConnectionInitSqls(), setter: [class org.apache.commons.dbcp2.BasicDataSource.setConnectionInitSqls(interface java.util.Collection)]
              at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:939)
              at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:905)
              at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:886)
              at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:820)
              at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)
              at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)
              at java.util.concurrent.FutureTask.run(FutureTask.java:262)
              at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)
              at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:247)
              at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)
              at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:682)
              at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:377)
              at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:269)
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
              at java.util.concurrent.FutureTask.run(FutureTask.java:262)
              at org.apache.aries.blueprint.container.ExecutorServiceWrapper.run(ExecutorServiceWrapper.java:106)
              at org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
              at java.util.concurrent.FutureTask.run(FutureTask.java:262)
              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
              at java.lang.Thread.run(Thread.java:744)
      Caused by: org.osgi.service.blueprint.container.ComponentDefinitionException: At least one Setter method has to match the type of the Getter method for property connectionInitSqls
              at org.apache.aries.blueprint.utils.ReflectionUtils$MethodPropertyDescriptor.findMethodByClass(ReflectionUtils.java:708)
              at org.apache.aries.blueprint.utils.ReflectionUtils$MethodPropertyDescriptor.findSetter(ReflectionUtils.java:687)
              at org.apache.aries.blueprint.utils.ReflectionUtils$MethodPropertyDescriptor.internalSet(ReflectionUtils.java:627)
              at org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.set(ReflectionUtils.java:380)
              at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:937)
              ... 23 more
      

      blueprint fragment used:

      	<bean id="dataSource" class="org.apache.commons.dbcp2.managed.BasicManagedDataSource">
      		<property name="transactionManager" ref="jtaTransactionManager" />
      		<property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver" />
      		<property name="url" value="jdbc:derby:${db.location}/csids;create=true" />
      		<property name="maxTotal" value="${db.connectionPoolMaxActive}" />
      		<property name="initialSize" value="${db.connectionPoolMaxIdle}"/>
      		<property name="maxIdle" value="${db.connectionPoolMaxIdle}" />
      		<property name="connectionInitSqls">
      			<list>
      				<value>set isolation READ COMMITTED</value>
      			</list>
      
      		</property>
      	</bean>
      

      Attachments

        Issue Links

          Activity

            People

              kinow Bruno P. Kinoshita
              jkleemann Jens Kleemann
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: