You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "lakshmi.prashant" <la...@sap.com> on 2013/08/31 17:20:19 UTC

Missing datasource exception while referring to OSGI datasource for clustering quartz with camel-quartz

Hi,

I am trying to set up quartz in clustered mode to work with camel quartz in
my camel route.

(i.e) we have deployed the bundle with the camel route having camel quartz
endpoint, in all the cluster nodes. But I would like to have my camel route
triggered only in one of the nodes in the cluster at the scheduled time & I
am hoping that if the camel quartz refers to quartz in clustered mode, then
the trigger will reach the camel route in only one node.

The datasources are available as OSGI services in the cluster. But I need to
configure the data source by its name (JNDI name) in the quartz properties
of the QuartzComponent & I am getting a missing datsasource exception. Pls.
find attached the spring xml with the camel route   beans.xml
<http://camel.465427.n5.nabble.com/file/n5738400/beans.xml>  

Any suggestions to make this work are welcome. Kindly help.

Thanks,
Lakshmi


Code snippet used for clustering:
<bean id="quartz" class="org.apache.camel.component.quartz.QuartzComponent">
<property name="properties">
<props>
  <prop
key="dataSource">osgi:service/javax.sql.DataSource/(dataSourceName=default)</prop> 
  <prop key="org.quartz.jobStore.dataSource">
osgi:service/javax.sql.DataSource/(dataSourceName=default)</&lt;/prop>
    …
</props>
</property>
</bean>



Exception trace: org.quartz.JobPersistenceException: Failed to obtain DB
connection from data source 'default': java.sql.SQLException: There is no
DataSource named
'osgi:service/javax.sql.DataSource/(dataSourceName=default)'[See nested
exception: java.sql.SQLException: There is no DataSource named 'default']
       at
org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:715)
       at
org.quartz.impl.jdbcjobstore.JobStoreTX.getNonManagedTXConnection(JobStoreTX.java:69)
       at
org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3785)
       at
org.quartz.impl.jdbcjobstore.JobStoreTX.executeInLock(JobStoreTX.java:90)
       at
org.quartz.impl.jdbcjobstore.JobStoreSupport.executeWithoutLock(JobStoreSupport.java:3693)
       at
org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1561)
       at
org.quartz.core.QuartzScheduler.getTrigger(QuartzScheduler.java:1448)
       at org.quartz.impl.StdScheduler.getTrigger(StdScheduler.java:551)
Caused by: java.sql.SQLException: There is no DataSource named
'osgi:service/javax.sql.DataSource/(dataSourceName=default)'
       at
org.quartz.utils.DBConnectionManager.getConnection(DBConnectionManager.java:105)
       at
org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:712)


org.quartz.JobPersistenceException: Failed to obtain DB connection from data
source 'jdbc/DefaultDB': java.sql.SQLException: There is no DataSource named
'jdbc/DefaultDB' [See nested exception: java.sql.SQLException: There is no
DataSource named 'jdbc/DefaultDB']





--
View this message in context: http://camel.465427.n5.nabble.com/Missing-datasource-exception-while-referring-to-OSGI-datasource-for-clustering-quartz-with-camel-quaz-tp5738400.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Missing datasource exception while referring to OSGI datasource for clustering quartz with camel-quartz

Posted by "steve.ardis" <sc...@gmail.com>.
I'm not completely out of the woods getting this setup, but I'm past the
hurdle of the datasource lookup.  Here was my solution (note, replace "xyz"
as needed, and notice that I have "isClustered" set to "false" - this may
not be what you want):



This is inside of ServiceMix/Fuse.  Also, it is part of a Blueprint
configuration file, but don't think this should make a difference.  I
haven't tried this configuration inside of a quartz.properties file, but see
no reason it shouldn't work that way.

Hope it helps - 
Steve Ardis




--
View this message in context: http://camel.465427.n5.nabble.com/Missing-datasource-exception-while-referring-to-OSGI-datasource-for-clustering-quartz-with-camel-quaz-tp5738400p5741631.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Missing datasource exception while referring to OSGI datasource for clustering quartz with camel-quartz

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

As its Quartz which does the DataSource lookup then wonder how it does
the lookup?
Though I assume spring users with quartz may have defined their data
sources as spring <bean>.
So maybe you can find some information how to tell quartz to lookup in
spring etc. Then spring-dm in OSGi ought to work with it.

There is also a new camel-quartz2 component in Camel 2.12. Maybe
quartz2 would work better with OSGi ?

On Sun, Sep 1, 2013 at 1:03 PM, lakshmi.prashant
<la...@sap.com> wrote:
> Hi,
>
>  I have already referred to the datasource (OSGI service) in the beans.xml:
>
>  <reference id="dataSource" interface="javax.sql.DataSource"
> filter="(dataSourceName=default)" />
>
> a) And I had already tried referring to the datasource using the reference
> id, in quartz properties:
>
>   <bean id="quartz"
> class="org.apache.camel.component.quartz.QuartzComponent">
>         <property name="properties"><props>
>                      <prop
> key="org.quartz.jobStore.dataSource">*dataSource*</prop>....
>           </props></properties>
>  </bean>
>
> b) Also, I had earlier tried to refer the datasource by the osgi service
> name..
>
>    <bean id="quartz"
> class="org.apache.camel.component.quartz.QuartzComponent">
>         <property name="properties"><props>
>                      <prop
> key="org.quartz.jobStore.dataSource">*default*</prop>....
>           </props></properties>
>  </bean>
>
>
> None of the 3 approached had worked.
>
> Exception trace while referring to bean reference id.
>
>
> Failed to obtain DB connection from data source 'dataSource':
> java.sql.SQLException: There is no DataSource named 'dataSource'
> org.quartz.JobPersistenceException: Failed to obtain DB connection from data
> source 'dataSource': java.sql.SQLException: There is no DataSource named
> 'dataSource' [See nested exception: java.sql.SQLException: There is no
> DataSource named 'dataSource']
>
> Thanks,
> Lakshmi
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Missing-datasource-exception-while-referring-to-OSGI-datasource-for-clustering-quartz-with-camel-quaz-tp5738400p5738423.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Missing datasource exception while referring to OSGI datasource for clustering quartz with camel-quartz

Posted by "lakshmi.prashant" <la...@sap.com>.
Hi,

 I have already referred to the datasource (OSGI service) in the beans.xml:

 <reference id="dataSource" interface="javax.sql.DataSource"
filter="(dataSourceName=default)" />

a) And I had already tried referring to the datasource using the reference
id, in quartz properties:

  <bean id="quartz"
class="org.apache.camel.component.quartz.QuartzComponent">    
	<property name="properties"><props>
                     <prop
key="org.quartz.jobStore.dataSource">*dataSource*</prop>....
          </props></properties>
 </bean>

b) Also, I had earlier tried to refer the datasource by the osgi service
name..

   <bean id="quartz"
class="org.apache.camel.component.quartz.QuartzComponent">    
	<property name="properties"><props>
                     <prop
key="org.quartz.jobStore.dataSource">*default*</prop>....
          </props></properties>
 </bean>


None of the 3 approached had worked.

Exception trace while referring to bean reference id.


Failed to obtain DB connection from data source 'dataSource':
java.sql.SQLException: There is no DataSource named 'dataSource'
org.quartz.JobPersistenceException: Failed to obtain DB connection from data
source 'dataSource': java.sql.SQLException: There is no DataSource named
'dataSource' [See nested exception: java.sql.SQLException: There is no
DataSource named 'dataSource']

Thanks,
Lakshmi



--
View this message in context: http://camel.465427.n5.nabble.com/Missing-datasource-exception-while-referring-to-OSGI-datasource-for-clustering-quartz-with-camel-quaz-tp5738400p5738423.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Missing datasource exception while referring to OSGI datasource for clustering quartz with camel-quartz

Posted by Claus Ibsen <cl...@gmail.com>.
You should likely reference the service in your xml file

Then from Quartz point of view its just a regular bean id you refer
to, and not all the osgi filter syntax which it does not understand.

See the spring-dm docs about service registry references
And possible at Karaf / ServiceMix docs as they are OSGi based.



On Sat, Aug 31, 2013 at 5:20 PM, lakshmi.prashant
<la...@sap.com> wrote:
> Hi,
>
> I am trying to set up quartz in clustered mode to work with camel quartz in
> my camel route.
>
> (i.e) we have deployed the bundle with the camel route having camel quartz
> endpoint, in all the cluster nodes. But I would like to have my camel route
> triggered only in one of the nodes in the cluster at the scheduled time & I
> am hoping that if the camel quartz refers to quartz in clustered mode, then
> the trigger will reach the camel route in only one node.
>
> The datasources are available as OSGI services in the cluster. But I need to
> configure the data source by its name (JNDI name) in the quartz properties
> of the QuartzComponent & I am getting a missing datsasource exception. Pls.
> find attached the spring xml with the camel route   beans.xml
> <http://camel.465427.n5.nabble.com/file/n5738400/beans.xml>
>
> Any suggestions to make this work are welcome. Kindly help.
>
> Thanks,
> Lakshmi
>
>
> Code snippet used for clustering:
> <bean id="quartz" class="org.apache.camel.component.quartz.QuartzComponent">
> <property name="properties">
> <props>
>   <prop
> key="dataSource">osgi:service/javax.sql.DataSource/(dataSourceName=default)</prop>
>   <prop key="org.quartz.jobStore.dataSource">
> osgi:service/javax.sql.DataSource/(dataSourceName=default)</&lt;/prop>
>     …
> </props>
> </property>
> </bean>
>
>
>
> Exception trace: org.quartz.JobPersistenceException: Failed to obtain DB
> connection from data source 'default': java.sql.SQLException: There is no
> DataSource named
> 'osgi:service/javax.sql.DataSource/(dataSourceName=default)'[See nested
> exception: java.sql.SQLException: There is no DataSource named 'default']
>        at
> org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:715)
>        at
> org.quartz.impl.jdbcjobstore.JobStoreTX.getNonManagedTXConnection(JobStoreTX.java:69)
>        at
> org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3785)
>        at
> org.quartz.impl.jdbcjobstore.JobStoreTX.executeInLock(JobStoreTX.java:90)
>        at
> org.quartz.impl.jdbcjobstore.JobStoreSupport.executeWithoutLock(JobStoreSupport.java:3693)
>        at
> org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1561)
>        at
> org.quartz.core.QuartzScheduler.getTrigger(QuartzScheduler.java:1448)
>        at org.quartz.impl.StdScheduler.getTrigger(StdScheduler.java:551)
> Caused by: java.sql.SQLException: There is no DataSource named
> 'osgi:service/javax.sql.DataSource/(dataSourceName=default)'
>        at
> org.quartz.utils.DBConnectionManager.getConnection(DBConnectionManager.java:105)
>        at
> org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:712)
>
>
> org.quartz.JobPersistenceException: Failed to obtain DB connection from data
> source 'jdbc/DefaultDB': java.sql.SQLException: There is no DataSource named
> 'jdbc/DefaultDB' [See nested exception: java.sql.SQLException: There is no
> DataSource named 'jdbc/DefaultDB']
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Missing-datasource-exception-while-referring-to-OSGI-datasource-for-clustering-quartz-with-camel-quaz-tp5738400.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen