title: ActiveMQ 5.8: Cannot load JDBC driver class 'oracle.jdbc.driver.OracleDriver'
body: <p>I am trying to setup ActiveMQ persitenceAdapter to an Oracle 11g (11.2) database.
  When starting ActiveMQ through the Tanuki wrapper I am getting the Cannot load JDBC driver class 'oracle.jdbc.driver.OracleDriver' exception. I am searching the net for hours without finding any relevant answer. My classpath is correct.</p>
  
  <p>I have the feeling that the Tanuki wrapper is not taking my classpath customization into account.</p>
  
  <p>Could you please tell me if you see anything wrong or provide me with a working example</p>
  
  <p>My settings are:<br/>
  <b>activemq.xml</b></p>
  
  <pre><code>&lt;broker xmlns="http://activemq.apache.org/schema/core" brokerName="test1" dataDirectory="/path/to/existing"&gt;
      ...
      &lt;persistenceAdapter&gt;
          &lt;jdbcPersistenceAdapter dataDirectory="/path/to/existing/activemq-data" dataSource="#oracle-ds"/&gt;
      &lt;/persistenceAdapter&gt;
      ...
  &lt;/broker&gt;
  
  &lt;bean id="oracle-ds" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt;
      &lt;property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/&gt;
      &lt;property name="url" value=" jdbc:oracle:thin:@db.domain:1521:DEV01 "/&gt;
      &lt;property name="username" value="username"/&gt;
      &lt;property name="password" value="password"/&gt;
      &lt;property name="poolPreparedStatements" value="true"/&gt;
  &lt;/bean&gt;
  
  &lt;import resource="jetty.xml"/&gt;
  </code></pre>
  
  <p><br>
  <b>wrapper.conf</b></p>
  
  <pre><code>wrapper.java.classpath.1=%ACTIVEMQ_HOME%/bin/wrapper.jar
  wrapper.java.classpath.2=%ACTIVEMQ_HOME%/bin/activemq.jar
  wrapper.java.classpath.3=%ACTIVEMQ_HOME%/lib/*
  wrapper.java.classpath.4=%ACTIVEMQ_HOME%/lib/optional/ojdbc6.jar
  </code></pre>
  
  <p><b>full stack trace</b></p>
  
  <pre>
  2013-09-24 14:07:15,973 | ERROR | Failed to load: class path resource [activemq.xml], reason: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class path resource [activemq.xml]: Invocation of init method failed; nested exception 
  is java.io.IOException: Cannot create JDBC driver of class 'oracle.jdbc.driver.OracleDriver' for connect URL ' jdbc:oracle:thin:@db.domain:1521:DEV01 ' | org.apache.activemq.xbean.XBeanBrokerFactory | WrapperSimpleAppMain
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class path resource [activemq.xml]: Invocation of init method failed; nested exception is java.io.IOException: Cannot create
   JDBC driver of class 'oracle.jdbc.driver.OracleDriver' for connect URL ' jdbc:oracle:thin:@db.domain:1521:DEV01 '
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
          at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
          at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
          at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
          at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
          at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:605)
          at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:925)
          at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:472)
          at org.apache.xbean.spring.context.ResourceXmlApplicationContext.(ResourceXmlApplicationContext.java:64)
          at org.apache.xbean.spring.context.ResourceXmlApplicationContext.(ResourceXmlApplicationContext.java:52)
          at org.apache.activemq.xbean.XBeanBrokerFactory$1.(XBeanBrokerFactory.java:101)
          at org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:101)
          at org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:65)
          at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)
          at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)
          at org.apache.activemq.console.command.StartCommand.startBroker(StartCommand.java:125)
         at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:84)
          at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
          at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:150)
          at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
          at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:601)
          at org.apache.activemq.console.Main.runTaskClass(Main.java:262)
          at org.apache.activemq.console.Main.main(Main.java:115)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:601)
          at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
          at java.lang.Thread.run(Thread.java:722)
  Caused by: java.io.IOException: Cannot create JDBC driver of class 'oracle.jdbc.driver.OracleDriver' for connect URL ' jdbc:oracle:thin:@db.domain:1521:DEV01 '
          at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:45)
          at org.apache.activemq.store.jdbc.TransactionContext.getConnection(TransactionContext.java:68)
          at org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.loadAdapter(JDBCPersistenceAdapter.java:434)
         at org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.createAdapter(JDBCPersistenceAdapter.java:417)
          at org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.getAdapter(JDBCPersistenceAdapter.java:366)
          at org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.init(JDBCPersistenceAdapter.java:288)
          at org.apache.activemq.broker.LockableServiceSupport.preStart(LockableServiceSupport.java:79)
          at org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:54)
          at org.apache.activemq.broker.BrokerService.doStartPersistenceAdapter(BrokerService.java:598)
          at org.apache.activemq.broker.BrokerService.startPersistenceAdapter(BrokerService.java:587)
          at org.apache.activemq.broker.BrokerService.start(BrokerService.java:552)
          at org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:60)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:601)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1581)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1522)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
          ... 34 more
  Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'oracle.jdbc.driver.OracleDriver' for connect URL ' jdbc:oracle:thin:@db.domain:1521:DEV01 '
          at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1452)
          at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
          at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
          at org.apache.activemq.store.jdbc.TransactionContext.getConnection(TransactionContext.java:58)
          ... 51 more
  Caused by: java.sql.SQLException: No suitable driver
          at java.sql.DriverManager.getDriver(DriverManager.java:289)
          at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437)
          ... 54 more
  </pre>