title: java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver when using Maven Dependency
body: <pre><code>        &lt;dependency&gt;
              &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
              &lt;artifactId&gt;tomcat-jdbc&lt;/artifactId&gt;
              &lt;version&gt;7.0.47&lt;/version&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>Above is the maven dependency I'm using.</p>
  
  <pre><code>    PoolProperties p = new PoolProperties();
  
      p.setUrl("jdbc:oracle:thin:@//ip:port:ora11g");
      p.setDriverClassName("oracle.jdbc.OracleDriver");
      p.setUsername("un");
      p.setPassword("pw");
      p.setJmxEnabled(true);
      p.setTestWhileIdle(false);
      p.setTestOnBorrow(true);
      p.setValidationQuery("SELECT 1");
      p.setTestOnReturn(false);
      p.setValidationInterval(30000);
      p.setTimeBetweenEvictionRunsMillis(30000);
      p.setMaxActive(100);
      p.setInitialSize(10);
      p.setMaxWait(10000);
      p.setRemoveAbandonedTimeout(60);
      p.setMinEvictableIdleTimeMillis(30000);
      p.setMinIdle(10);
      p.setLogAbandoned(true);
      p.setRemoveAbandoned(true);
      p.setJdbcInterceptors(
              "org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;"+
                      "org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer");
      DataSource datasource = new DataSource();
      datasource.setPoolProperties(p);
  
      Connection con = null;
      try {
          con = datasource.getConnection();
          Statement st = con.createStatement();
          ResultSet rs = st.executeQuery("select * from user");
          int cnt = 1;
          while (rs.next()) {
              System.out.println((cnt++)+". Host:" +rs.getString("Host")+
                      " User:"+rs.getString("User")+" Password:"+rs.getString("Password"));
          }
          rs.close();
          st.close();
      } finally {
          if (con!=null) try {con.close();}catch (Exception ignore) {}
      }
  </code></pre>
  
  <p>And above is my database querying test code snippet.</p>
  
  <p>When I'm executing the program I'm getting "java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver" exception.</p>
  
  <p>I searched for the issue and read that I have to "make sure oracle jdbc jar is in the classpath". I'm not sure why do I have to set it manually or is it actually required.</p>