[Logo] Terracotta Discussion Forums
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Messages posted by: civilu  XML
Profile for civilu -> Messages posted by civilu [1]
Author Message
Hello,

I'm trying to use Quartz 1.8.0 with Apache Felix, but I have run into a problem with Quartz configured to use a database to store the jobs.

I'm using Derby 10.5.3 and the relevant section in quartz.properties is

Code:
 org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
 org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
 org.quartz.jobStore.useProperties = false
 org.quartz.jobStore.dataSource = myDS
 org.quartz.jobStore.tablePrefix = QRTZ_
 org.quartz.jobStore.isClustered = false
 
 #============================================================================
 # Configure Datasources  
 #============================================================================
 
 org.quartz.dataSource.myDS.driver = org.apache.derby.jdbc.EmbeddedDriver
 org.quartz.dataSource.myDS.URL = jdbc:derby://localhost:50000/quartz
 org.quartz.dataSource.myDS.user = quartz
 org.quartz.dataSource.myDS.password = quartz
 


When I do new StdSchedulerFactory() I get the following:

Code:
 org.quartz.SchedulerConfigException: Failure occured during job recovery. [See nested exception: org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'myDS': org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'org.apache.derby.jdbc.EmbeddedDriver' [See nested exception: org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'org.apache.derby.jdbc.EmbeddedDriver']]
 	at org.quartz.impl.jdbcjobstore.JobStoreSupport.initialize(JobStoreSupport.java:607)
 	at org.quartz.impl.jdbcjobstore.JobStoreTX.initialize(JobStoreTX.java:56)
 	at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1260)
 	at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1451)
 	at com.axway.sandbox.quartz.reportingscheduler.impl.PlatformSchedulerImpl.__start(PlatformSchedulerImpl.java:51)
 	at com.axway.sandbox.quartz.reportingscheduler.impl.PlatformSchedulerImpl.start(PlatformSchedulerImpl.java)
 	at com.axway.sandbox.quartz.reportingscheduler.impl.PlatformSchedulerImpl.__validate(PlatformSchedulerImpl.java:87)
 	at com.axway.sandbox.quartz.reportingscheduler.impl.PlatformSchedulerImpl.validate(PlatformSchedulerImpl.java)
 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 	at java.lang.reflect.Method.invoke(Method.java:597)
 	at org.apache.felix.ipojo.util.Callback.call(Callback.java:231)
 	at org.apache.felix.ipojo.util.Callback.call(Callback.java:191)
 	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallback.call(LifecycleCallback.java:86)
 	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__stateChanged(LifecycleCallbackHandler.java:162)
 	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.stateChanged(LifecycleCallbackHandler.java)
 	at org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:440)
 	at org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:321)
 	at org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:155)
 	at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:298)
 	at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:235)
 	at org.apache.felix.ipojo.IPojoFactory.updated(IPojoFactory.java:603)
 	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceFactoryUpdate.run(ConfigurationManager.java:1273)
 	at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:88)
 Caused by: org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'myDS': org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'org.apache.derby.jdbc.EmbeddedDriver' [See nested exception: org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'org.apache.derby.jdbc.EmbeddedDriver']
 	at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:690)
 	at org.quartz.impl.jdbcjobstore.JobStoreTX.getNonManagedTXConnection(JobStoreTX.java:69)
 	at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3760)
 	at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3725)
 	at org.quartz.impl.jdbcjobstore.JobStoreSupport.cleanVolatileTriggerAndJobs(JobStoreSupport.java:747)
 	at org.quartz.impl.jdbcjobstore.JobStoreSupport.initialize(JobStoreSupport.java:605)
 	... 24 more
 Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'org.apache.derby.jdbc.EmbeddedDriver'
 	at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1136)
 	at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
 	at org.quartz.utils.PoolingConnectionProvider.getConnection(PoolingConnectionProvider.java:194)
 	at org.quartz.utils.DBConnectionManager.getConnection(DBConnectionManager.java:109)
 	at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:687)
 	... 29 more
 Caused by: java.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver
 	at org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:618)
 	at org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.java:59)
 	at org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1446)
 	at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
 	at org.apache.felix.framework.searchpolicy.ModuleImpl.getClassByDelegation(ModuleImpl.java:481)
 	at org.apache.felix.framework.searchpolicy.R4Wire.getClass(R4Wire.java:108)
 	at org.apache.felix.framework.searchpolicy.ModuleImpl.searchImports(ModuleImpl.java:1184)
 	at org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:557)
 	at org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.java:59)
 	at org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1446)
 	at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
 	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
 	at java.lang.Class.forName0(Native Method)
 	at java.lang.Class.forName(Class.java:169)
 	at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1130)
 


From that, it's pretty clear to me that the driver class is invisible to Quartz. However, if I do Class.forName("org.apache.derby.jdbc.EmbeddedDriver"), there's no CNFE, so the driver seems to be in the classpath.

In my bundle, Bundle-Classpath references the derby jar and I have org.apache.derby.jdbc in Private-Packages.

Right now I'm not sure if this is a Quartz or an OSGI problem, but I figured there are better chances of finding some sort of help here.

Could this be a classloader issue?

Any pointers are appreciated.

Thanks,
Alex
 
Profile for civilu -> Messages posted by civilu [1]
Go to:   
Powered by JForum 2.1.7 © JForum Team