Hi all,
I'm currently trying to get the in the subject mentioned software running.
I got the following configuration:
<ha-jdbc xmlns="urn:ha-jdbc:cluster:2.1"> <cluster> <database id="db1" location="org.apache.derby.jdbc.ClientDriver"> <property name="serverName">192.168.15.10</property> <property name="portNumber">1527</property> <property name="databaseName">activemq</property> </database> <database id="db2" location="org.apache.derby.jdbc.ClientDriver"> <property name="serverName">192.168.15.11</property> <property name="portNumber">1527</property> <property name="databaseName">activemq</property> </database> </cluster> </ha-jdbc>
As well as these definition in the activemq.xml:
<persistenceAdapter> <jdbcPersistenceAdapter dataDirectory="${activemq.data}/derby" dataSource="#derby-ds"></jdbcPersistenceAdapter> </persistenceAdapter>
and this:
<bean id="derby-ds" class="net.sf.hajdbc.sql.DataSource"> <property name="config" value="file:///opt/apache-activemq-5.8.0/conf/ha-jdbc-derbycluster.xml"/> <property name="factory" value="org.apache.naming.factory.BeanFactory"/> <property name="closeMethod" value="stop"/> <property name="cluster" value="derbycluster"/> </bean>
But activemq fails with the following:
2013-09-17 12:33:37,984 | INFO | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1@75e79c77: startup date [Tue Sep 17 12:33:37 CEST 2013]; root of context hierarchy | org.apache .activemq.xbean.XBeanBrokerFactory$1 | main 2013-09-17 12:33:41,451 | ERROR | Failed to load: class path resource [activemq.xml], reason: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in cl ass path resource [activemq.xml]: Cannot create inner bean '(inner bean)' of type [org.apache.activemq.store.jdbc.JDBCPersistenceAdapter] while setting bean property 'persistenceAdapter' ; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#3' defined in class path resource [activemq.xml]: Cannot resolv e reference to bean 'derby-ds' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'derby -ds' defined in class path resource [activemq.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert proper ty value of type 'java.lang.String' to required type 'net.sf.hajdbc.DatabaseClusterFactory' for property 'factory'; nested exception is java.lang.IllegalStateException: Cannot convert va lue of type [java.lang.String] to required type [net.sf.hajdbc.DatabaseClusterFactory] for property 'factory': no matching editors or conversion strategy found | org.apache.activemq.xbea n.XBeanBrokerFactory | main org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class path resource [activemq.xml]: Can not create inner bean '(inner bean)' of type [org.apache.activemq.store.jdbc.JDBCPersistenceAdapter] while setting bean property 'persistenceAdapter'; nested exception is org.springframe work.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#3' defined in class path resource [activemq.xml]: Cannot resolve reference to bean 'derby-ds' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'derby-ds' defined in class path resource [ activemq.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' t o required type 'net.sf.hajdbc.DatabaseClusterFactory' for property 'factory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to req uired type [net.sf.hajdbc.DatabaseClusterFactory] for property 'factory': no matching editors or conversion strategy found at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:282) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:126) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1360) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:605) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:925) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:472) at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64) at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52) at org.apache.activemq.xbean.XBeanBrokerFactory$1.<init>(XBeanBrokerFactory.java:101) at org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:101) at org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:65) at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71) at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54) at org.apache.activemq.console.command.StartCommand.startBroker(StartCommand.java:125) at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:84) at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57) at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:150) at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57) at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.apache.activemq.console.Main.runTaskClass(Main.java:262) at org.apache.activemq.console.Main.main(Main.java:115) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#3' defined in class path resource [activemq.xml]: Cannot resolve reference to bean 'derby-ds' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'derby-ds' define d in class path resource [activemq.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'net.sf.hajdbc.DatabaseClusterFactory' for property 'factory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [net.sf.hajdbc.DatabaseClusterFactory] for property 'factory': no matching editors or conversion strategy found at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:329) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1360) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:271) ... 31 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'derby-ds' defined in class path resource [activemq.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'net.sf.hajdbc.DatabaseCluste rFactory' for property 'factory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [net.sf.hajdbc.DatabaseClusterFact ory] for property 'factory': no matching editors or conversion strategy found at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:323) ... 37 more Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'net.sf.hajdbc.DatabaseClusterFactory' for property 'factory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [net.sf.hajdbc.DatabaseClusterFactory] for p roperty 'factory': no matching editors or conversion strategy found at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:485) at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:516) at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:510) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1406) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1365) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) ... 43 more Caused by: java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [net.sf.hajdbc.DatabaseClusterFactory] for property 'factory': no matching ed itors or conversion strategy found at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:247) at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:470) ... 49 more
Any advice is appreciated!
It looks like you're tried to apply the sample Tomcat DataSource configuration to a Spring bean config.
A DataSource is something that should be defined by your container/server, not by Spring. Absent this, I suggest using the following bean config:
<bean id="derby-ds" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="net.sf.hajdbc.sql.Driver"/> <property name="url" value="jdbc:ha-jdbc:derbycluster"/> <property name="username" value="..."/> <property name="password" value="..."/> </bean>
Log in to post a comment.
Hi all,
I'm currently trying to get the in the subject mentioned software running.
I got the following configuration:
As well as these definition in the activemq.xml:
and this:
But activemq fails with the following:
Any advice is appreciated!
It looks like you're tried to apply the sample Tomcat DataSource configuration to a Spring bean config.
A DataSource is something that should be defined by your container/server, not by Spring. Absent this, I suggest using the following bean config: