<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "Quartz in an OSGI environment"]]></title>
		<link>http://forums.terracotta.org/forums/posts/list/17.page</link>
		<description><![CDATA[Latest messages posted in the topic "Quartz in an OSGI environment"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>Quartz in an OSGI environment</title>
				<description><![CDATA[ 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

<span class="genmed"><b>Code:</b></span><br>
		<div>
		<pre bbCodeId="pre-code" style="overflow: auto; width: 95%; max-height: 350px; height:expression(this.scrollHeight > 350 ? '350px' : 'auto');">
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
</pre>
		</div>

When I do new StdSchedulerFactory() I get the following:

<span class="genmed"><b>Code:</b></span><br>
		<div>
		<pre bbCodeId="pre-code" style="overflow: auto; width: 95%; max-height: 350px; height:expression(this.scrollHeight > 350 ? '350px' : 'auto');">
org.quartz.SchedulerConfigException: Failure occured during job recovery. &#91;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' &#91;See nested exception: org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'org.apache.derby.jdbc.EmbeddedDriver'&#93;&#93;
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.initialize&#40;JobStoreSupport.java:607&#41;
	at org.quartz.impl.jdbcjobstore.JobStoreTX.initialize&#40;JobStoreTX.java:56&#41;
	at org.quartz.impl.StdSchedulerFactory.instantiate&#40;StdSchedulerFactory.java:1260&#41;
	at org.quartz.impl.StdSchedulerFactory.getScheduler&#40;StdSchedulerFactory.java:1451&#41;
	at com.axway.sandbox.quartz.reportingscheduler.impl.PlatformSchedulerImpl.__start&#40;PlatformSchedulerImpl.java:51&#41;
	at com.axway.sandbox.quartz.reportingscheduler.impl.PlatformSchedulerImpl.start&#40;PlatformSchedulerImpl.java&#41;
	at com.axway.sandbox.quartz.reportingscheduler.impl.PlatformSchedulerImpl.__validate&#40;PlatformSchedulerImpl.java:87&#41;
	at com.axway.sandbox.quartz.reportingscheduler.impl.PlatformSchedulerImpl.validate&#40;PlatformSchedulerImpl.java&#41;
	at sun.reflect.NativeMethodAccessorImpl.invoke0&#40;Native Method&#41;
	at sun.reflect.NativeMethodAccessorImpl.invoke&#40;NativeMethodAccessorImpl.java:39&#41;
	at sun.reflect.DelegatingMethodAccessorImpl.invoke&#40;DelegatingMethodAccessorImpl.java:25&#41;
	at java.lang.reflect.Method.invoke&#40;Method.java:597&#41;
	at org.apache.felix.ipojo.util.Callback.call&#40;Callback.java:231&#41;
	at org.apache.felix.ipojo.util.Callback.call&#40;Callback.java:191&#41;
	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallback.call&#40;LifecycleCallback.java:86&#41;
	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__stateChanged&#40;LifecycleCallbackHandler.java:162&#41;
	at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.stateChanged&#40;LifecycleCallbackHandler.java&#41;
	at org.apache.felix.ipojo.InstanceManager.setState&#40;InstanceManager.java:440&#41;
	at org.apache.felix.ipojo.InstanceManager.start&#40;InstanceManager.java:321&#41;
	at org.apache.felix.ipojo.ComponentFactory.createInstance&#40;ComponentFactory.java:155&#41;
	at org.apache.felix.ipojo.IPojoFactory.createComponentInstance&#40;IPojoFactory.java:298&#41;
	at org.apache.felix.ipojo.IPojoFactory.createComponentInstance&#40;IPojoFactory.java:235&#41;
	at org.apache.felix.ipojo.IPojoFactory.updated&#40;IPojoFactory.java:603&#41;
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceFactoryUpdate.run&#40;ConfigurationManager.java:1273&#41;
	at org.apache.felix.cm.impl.UpdateThread.run&#40;UpdateThread.java:88&#41;
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' &#91;See nested exception: org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'org.apache.derby.jdbc.EmbeddedDriver'&#93;
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection&#40;JobStoreSupport.java:690&#41;
	at org.quartz.impl.jdbcjobstore.JobStoreTX.getNonManagedTXConnection&#40;JobStoreTX.java:69&#41;
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock&#40;JobStoreSupport.java:3760&#41;
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock&#40;JobStoreSupport.java:3725&#41;
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.cleanVolatileTriggerAndJobs&#40;JobStoreSupport.java:747&#41;
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.initialize&#40;JobStoreSupport.java:605&#41;
	... 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&#40;BasicDataSource.java:1136&#41;
	at org.apache.commons.dbcp.BasicDataSource.getConnection&#40;BasicDataSource.java:880&#41;
	at org.quartz.utils.PoolingConnectionProvider.getConnection&#40;PoolingConnectionProvider.java:194&#41;
	at org.quartz.utils.DBConnectionManager.getConnection&#40;DBConnectionManager.java:109&#41;
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection&#40;JobStoreSupport.java:687&#41;
	... 29 more
Caused by: java.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver
	at org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDelegation&#40;ModuleImpl.java:618&#41;
	at org.apache.felix.framework.searchpolicy.ModuleImpl.access$100&#40;ModuleImpl.java:59&#41;
	at org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadClass&#40;ModuleImpl.java:1446&#41;
	at java.lang.ClassLoader.loadClass&#40;ClassLoader.java:252&#41;
	at org.apache.felix.framework.searchpolicy.ModuleImpl.getClassByDelegation&#40;ModuleImpl.java:481&#41;
	at org.apache.felix.framework.searchpolicy.R4Wire.getClass&#40;R4Wire.java:108&#41;
	at org.apache.felix.framework.searchpolicy.ModuleImpl.searchImports&#40;ModuleImpl.java:1184&#41;
	at org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDelegation&#40;ModuleImpl.java:557&#41;
	at org.apache.felix.framework.searchpolicy.ModuleImpl.access$100&#40;ModuleImpl.java:59&#41;
	at org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadClass&#40;ModuleImpl.java:1446&#41;
	at java.lang.ClassLoader.loadClass&#40;ClassLoader.java:252&#41;
	at java.lang.ClassLoader.loadClassInternal&#40;ClassLoader.java:320&#41;
	at java.lang.Class.forName0&#40;Native Method&#41;
	at java.lang.Class.forName&#40;Class.java:169&#41;
	at org.apache.commons.dbcp.BasicDataSource.createDataSource&#40;BasicDataSource.java:1130&#41;
</pre>
		</div>

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]]></description>
				<guid isPermaLink="true">http://forums.terracotta.org/forums/posts/list/3754.page#20574</guid>
				<link>http://forums.terracotta.org/forums/posts/list/3754.page#20574</link>
				<pubDate><![CDATA[Mon, 31 May 2010 06:11:03]]> GMT</pubDate>
				<author><![CDATA[ civilu]]></author>
			</item>
			<item>
				<title>Quartz in an OSGI environment</title>
				<description><![CDATA[ This is an old thread and no update from a long time.Please let us know if you are still facing same issue.
Thanks]]></description>
				<guid isPermaLink="true">http://forums.terracotta.org/forums/posts/list/3754.page#28759</guid>
				<link>http://forums.terracotta.org/forums/posts/list/3754.page#28759</link>
				<pubDate><![CDATA[Wed, 20 Jul 2011 23:27:56]]> GMT</pubDate>
				<author><![CDATA[ gyan10]]></author>
			</item>
	</channel>
</rss>