You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ychawla <pr...@yahoo.com> on 2011/07/28 21:18:10 UTC
Exception when configuring data source in imported file
Hello All,
I am using Camel 2.6.0 and have my routes set up using the Spring DSL in a
camel-context.xml file. I am looking to connect to a database using
Hibernate with a pretty standard configuration:
<bean id="dataSourceSQL"
class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="jdbcUrl">
jdbc:mysql://xxx.xxx.xxx.xxx:3306/schema_name
</property>
... (more properties below, omitted for brevity)
</bean>
The bean above is in a descriptor file called 'dao.xml' and imported as
such:
<import resource="dao.xml"/>
When I start my application, I get the following error:
Caused by: java.lang.IllegalArgumentException: Cannot convert value of type
[org.apache.camel.core.xml.CamelPropertyPlaceholderDefinition] to required
type [java.util.Properties] for property 'properties': PropertyEditor
[org.springframework.beans.propertyeditors.PropertiesEditor] returned
inappropriate value
at
org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:227)
at
org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:447)
However, if I move this bean into camel-context.xml, everything works fine.
Does anyone have any ideas on what's going on here?
Thanks,
Yogesh
--
View this message in context: http://camel.465427.n5.nabble.com/Exception-when-configuring-data-source-in-imported-file-tp4643831p4643831.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Exception when configuring data source in imported file
Posted by ychawla <pr...@yahoo.com>.
Hi Claus,
I tried with Spring 2.5.x and 3.0.x. I did read the Spring documentation
here:
http://static.springsource.org/spring/docs/2.5.x/reference/beans.html
and they had some alternate syntax as well:
<bean id="dataSourceSQL"
class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="com.mysql.jdbc.Driver">
<property name="jdbcUrl"
value="jdbc:mysql://xxx.xxx.xxx.xxx:3306/schema_name">
... (more properties below, omitted for brevity)
</bean>
This did the trick.
Thanks,
Yogesh
--
View this message in context: http://camel.465427.n5.nabble.com/Exception-when-configuring-data-source-in-imported-file-tp4643831p4648120.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Exception when configuring data source in imported file
Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Jul 28, 2011 at 9:18 PM, ychawla <pr...@yahoo.com> wrote:
> Hello All,
> I am using Camel 2.6.0 and have my routes set up using the Spring DSL in a
> camel-context.xml file. I am looking to connect to a database using
> Hibernate with a pretty standard configuration:
>
> <bean id="dataSourceSQL"
> class="com.mchange.v2.c3p0.ComboPooledDataSource"
> destroy-method="close">
> <property name="driverClass">
> <value>com.mysql.jdbc.Driver</value>
> </property>
> <property name="jdbcUrl">
> jdbc:mysql://xxx.xxx.xxx.xxx:3306/schema_name
> </property>
> ... (more properties below, omitted for brevity)
> </bean>
>
> The bean above is in a descriptor file called 'dao.xml' and imported as
> such:
>
> <import resource="dao.xml"/>
>
> When I start my application, I get the following error:
>
>
> Caused by: java.lang.IllegalArgumentException: Cannot convert value of type
> [org.apache.camel.core.xml.CamelPropertyPlaceholderDefinition] to required
> type [java.util.Properties] for property 'properties': PropertyEditor
> [org.springframework.beans.propertyeditors.PropertiesEditor] returned
> inappropriate value
> at
> org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:227)
> at
> org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:447)
>
> However, if I move this bean into camel-context.xml, everything works fine.
>
> Does anyone have any ideas on what's going on here?
>
Its a bit strange indeed. What version of Spring are you using?
I think there is also a xml include (not import). Can you try with that?
> Thanks,
> Yogesh
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Exception-when-configuring-data-source-in-imported-file-tp4643831p4643831.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/