title: Could not load the resource factory class java.lang.ClassNotFoundException: com.jolbox.bonecp.BoneCPDataSource
body: <p>I want to do connection pooling using BoneCP. But i got a log of Could not load the resource factory class.
  I got a this error log on tomcat startup</p>
  
  <pre><code>SEVERE: Exception processing Global JNDI Resources
  javax.naming.NamingException: Could not load resource factory class [Root exception is java.lang.ClassNotFoundException: com.jolbox.bonecp.BoneCPDataSource]
      at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:81)
      at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
      at org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:113)
      at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71)
      at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:137)
      at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:109)
      at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:81)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
      at org.apache.catalina.core.StandardServer.start(StandardServer.java:747)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
      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.catalina.startup.Bootstrap.start(Bootstrap.java:289)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
  Caused by: java.lang.ClassNotFoundException: com.jolbox.bonecp.BoneCPDataSource
      at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
      at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:79)
      ... 17 more
  </code></pre>
  
  <p>I have added the resource to server.xml like this.</p>
  
  <pre><code>&lt;GlobalNamingResources&gt;
      &lt;!-- Editable user database that can also be used by
           UserDatabaseRealm to authenticate users
      --&gt;
      &lt;Resource name="UserDatabase" auth="Container"
                type="org.apache.catalina.UserDatabase"
                description="User database that can be updated and saved"
                factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
                pathname="conf/tomcat-users.xml" /&gt;
  
          &lt;Resource type='javax.sql.DataSource'
                name='demodb'
             factory='com.jolbox.bonecp.BoneCPDataSource'
     driverClassName='oracle.jdbc.driver.OracleDriver'
             jdbcUrl='jdbc:oracle:thin:@localhost:1521:XE'
            username='system'
            password='system'
          idleMaxAge='240'
       idleConnectionTestPeriod='60'
      partitionCount='3'
    acquireIncrement='5'
     maxConnectionsPerPartition='10'
     minConnectionsPerPartition='5'
            statementsCacheSize='50'
           releaseHelperThreads='5'
           /&gt;
    &lt;/GlobalNamingResources&gt;
  </code></pre>
  
  <p>can anyone tell me what the problem is ?</p>