You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by jinaLu <ji...@yahoo.com> on 2013/03/15 08:04:36 UTC
oracle.jms.AQjmsFactory and javax.sql.DataSource
How to specify javax.sql.DataSource for oracle.jms.AQjmsFactory?
I'm using blueprint.
Thanks in advance
--
View this message in context: http://camel.465427.n5.nabble.com/oracle-jms-AQjmsFactory-and-javax-sql-DataSource-tp5729223.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: oracle.jms.AQjmsFactory and javax.sql.DataSource
Posted by jinaLu <ji...@yahoo.com>.
If I don't use datasource and specify like this:
<bean id="connectionFactoryOracleAQQueue" class="oracle.jms.AQjmsFactory"
factory-method="getQueueConnectionFactory">
<constructor-arg index="0">
<value>jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.10)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=mydb)))</value>
</constructor-arg>
<constructor-arg index="1" type="java.util.Properties">
<value></value>
</constructor-arg>
</bean>
<bean id="oracleQueueCredentials"
class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
<property name="targetConnectionFactory">
<ref bean="connectionFactoryOracleAQQueue" />
</property>
<property name="username">
<value>db</value>
</property>
<property name="password">
<value>password</value>
</property>
</bean>
<bean id="oracleQueue" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory" ref="oracleQueueCredentials" />
</bean>
Then it works, but I have a restriction, that I have to use datasource. Any
ideas?
--
View this message in context: http://camel.465427.n5.nabble.com/oracle-jms-AQjmsFactory-and-javax-sql-DataSource-tp5729223p5729471.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: oracle.jms.AQjmsFactory and javax.sql.DataSource
Posted by Willem jiang <wi...@gmail.com>.
Hi,
Did you have any Spring configuration which works?
It looks like a configuration issue instead of camel issue.
--
Willem Jiang
Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem
On Tuesday, March 19, 2013 at 10:23 PM, jinaLu wrote:
> I tried like this. In fuseEsb etc xml file I have config:
>
> <bean id="oracle-AQ" class="org.apache.commons.dbcp.BasicDataSource"
> destroy-method="close">
> <property name="driverClassName" value="oracle.jdbc.OracleDriver"/>
> <property name="url"
> value="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.10)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=mydb)))"/>
> <property name="username" value="db"/>
> <property name="password" value="password"/>
> <property name="validationQuery" value="SELECT 1 FROM DUAL"/>
> </bean>
> <bean id="jdbc-oracle-AQ"
> class="lt.etic.smx.tools.cfgmgr.impl.jdbc.JdbcConnectionProbe">
> <constructor-arg index="0" value="31000"/>
> <property name="dataSource" ref="oracle-AQ"/>
> <property name="probeQuery" value="SELECT 2 FROM DUAL"/>
> </bean>
>
> In my blueprint xml I have:
> <blueprint:reference id="DBC" interface="javax.sql.DataSource"
> filter="(name=oracle-AQ)"/>
> <blueprint:bean id="connectionFactoryOracleAQQueue"
> class="oracle.jms.AQjmsFactory"
> factory-method="getQueueConnectionFactory">
> <blueprint:argument ref="DBC" />
> </blueprint:bean>
>
> <blueprint:bean id="oracleQueue"
> class="org.apache.camel.component.jms.JmsComponent">
> <blueprint:property name="connectionFactory"
> ref="connectionFactoryOracleAQQueue" />
> </blueprint:bean>
> My ruoteBuilder has:
> from("direct:test")
> .to("oracleQueue:queue:AQ_Q")
>
> But unfortunately I'm getting "Caused by: java.lang.ClassCastException:
> org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper cannot
> be cast to oracle.jdbc.internal.OracleConnection".
>
> Any ideas?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/oracle-jms-AQjmsFactory-and-javax-sql-DataSource-tp5729223p5729423.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).
Re: oracle.jms.AQjmsFactory and javax.sql.DataSource
Posted by Christian Müller <ch...@gmail.com>.
In BasicDataSource you can configure whether you will get the underlying
connection or a proxy ( accessToUnderlyingConnectionAllowed) . Getting the
proxy is the default configuration. May this solves your issue.
Best,
Christian
Sent from a mobile device
Am 19.03.2013 15:25 schrieb "jinaLu" <ji...@yahoo.com>:
> I tried like this. In fuseEsb etc xml file I have config:
>
> <bean id="oracle-AQ" class="org.apache.commons.dbcp.BasicDataSource"
> destroy-method="close">
> <property name="driverClassName" value="oracle.jdbc.OracleDriver"/>
> <property name="url"
> value="jdbc:oracle:thin:@
> (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.10)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=mydb)))"/>
> <property name="username" value="db"/>
> <property name="password" value="password"/>
> <property name="validationQuery" value="SELECT 1 FROM DUAL"/>
> </bean>
> <bean id="jdbc-oracle-AQ"
> class="lt.etic.smx.tools.cfgmgr.impl.jdbc.JdbcConnectionProbe">
> <constructor-arg index="0" value="31000"/>
> <property name="dataSource" ref="oracle-AQ"/>
> <property name="probeQuery" value="SELECT 2 FROM DUAL"/>
> </bean>
>
> In my blueprint xml I have:
> <blueprint:reference id="DBC" interface="javax.sql.DataSource"
> filter="(name=oracle-AQ)"/>
> <blueprint:bean id="connectionFactoryOracleAQQueue"
> class="oracle.jms.AQjmsFactory"
> factory-method="getQueueConnectionFactory">
> <blueprint:argument ref="DBC" />
> </blueprint:bean>
>
> <blueprint:bean id="oracleQueue"
> class="org.apache.camel.component.jms.JmsComponent">
> <blueprint:property name="connectionFactory"
> ref="connectionFactoryOracleAQQueue" />
> </blueprint:bean>
> My ruoteBuilder has:
> from("direct:test")
> .to("oracleQueue:queue:AQ_Q")
>
> But unfortunately I'm getting "Caused by: java.lang.ClassCastException:
> org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper cannot
> be cast to oracle.jdbc.internal.OracleConnection".
>
> Any ideas?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/oracle-jms-AQjmsFactory-and-javax-sql-DataSource-tp5729223p5729423.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Re: oracle.jms.AQjmsFactory and javax.sql.DataSource
Posted by jinaLu <ji...@yahoo.com>.
I tried like this. In fuseEsb etc xml file I have config:
<bean id="oracle-AQ" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.OracleDriver"/>
<property name="url"
value="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.10)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=mydb)))"/>
<property name="username" value="db"/>
<property name="password" value="password"/>
<property name="validationQuery" value="SELECT 1 FROM DUAL"/>
</bean>
<bean id="jdbc-oracle-AQ"
class="lt.etic.smx.tools.cfgmgr.impl.jdbc.JdbcConnectionProbe">
<constructor-arg index="0" value="31000"/>
<property name="dataSource" ref="oracle-AQ"/>
<property name="probeQuery" value="SELECT 2 FROM DUAL"/>
</bean>
In my blueprint xml I have:
<blueprint:reference id="DBC" interface="javax.sql.DataSource"
filter="(name=oracle-AQ)"/>
<blueprint:bean id="connectionFactoryOracleAQQueue"
class="oracle.jms.AQjmsFactory"
factory-method="getQueueConnectionFactory">
<blueprint:argument ref="DBC" />
</blueprint:bean>
<blueprint:bean id="oracleQueue"
class="org.apache.camel.component.jms.JmsComponent">
<blueprint:property name="connectionFactory"
ref="connectionFactoryOracleAQQueue" />
</blueprint:bean>
My ruoteBuilder has:
from("direct:test")
.to("oracleQueue:queue:AQ_Q")
But unfortunately I'm getting "Caused by: java.lang.ClassCastException:
org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper cannot
be cast to oracle.jdbc.internal.OracleConnection".
Any ideas?
--
View this message in context: http://camel.465427.n5.nabble.com/oracle-jms-AQjmsFactory-and-javax-sql-DataSource-tp5729223p5729423.html
Sent from the Camel - Users mailing list archive at Nabble.com.