title: Hibernate with JNDI: Cannot create JDBC driver of class '' for connect URL 'null'
body: <p>I tried to use Hibernate for working with MySQL through JNDI but can't (from catalina.out):</p>
  
  <pre><code>INFO: Deploying web application archive mystamps.war
  Cannot create JDBC driver of class '' for connect URL 'null'
  java.lang.NullPointerException
      at sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:507)
      at sun.jdbc.odbc.JdbcOdbcDriver.knownURL(JdbcOdbcDriver.java:476)
      at sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(JdbcOdbcDriver.java:307)
  </code></pre>
  
  <p>(I reduce full stack trace because it's useless: no cause or any other exceptions.)</p>
  
  <p>spring-servlet.xml:</p>
  
  <pre><code>    &lt;jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/mystamps" /&gt;
  
      &lt;bean id="sessionFactory"
          class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"&gt;
          &lt;property name="dataSource" ref="dataSource" /&gt;
          &lt;property name="packagesToScan" value="ru.mystamps.web.dao" /&gt;
          &lt;property name="hibernateProperties"&gt;
              &lt;props&gt;
                  &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
                  &lt;prop key="hibernate.format_sql"&gt;true&lt;/prop&gt;
                  &lt;prop key="hibernate.use_sql_comments"&gt;true&lt;/prop&gt;
                  &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.MySQL5InnoDBDialect&lt;/prop&gt;
                  &lt;prop key="hibernate.hbm2ddl.auto"&gt;validate&lt;/prop&gt;
                  &lt;prop key="hibernate.connection.charSet"&gt;UTF-8&lt;/prop&gt;
              &lt;/props&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  </code></pre>
  
  <p>/etc/tomcat6/server.xml:</p>
  
  <pre><code>&lt;Host name="my-stamps" appBase="webapps"
      unpackWARs="false" xmlValidation="false"
      xmlNamespaceAware="false"&gt;
  &lt;/Host&gt;
  </code></pre>
  
  <p>/etc/tomcat6/Catalina/my-stamps/mystamps.xml:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;Context path="" docBase="mystamps" allowLinking="true" reloadable="true"&gt;
      &lt;Resource name="jdbc/mystamps" auth="Containter"
          type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000"
          username="root" password="password" driverClassName="com.mysql.jdbc.Driver"
          url="jdbc:mysql://localhost:3306/mystamps" /&gt;
  &lt;/Context&gt;
  </code></pre>
  
  <p>I use following versions: Spring MVC 3.0.5, Hibernate 3.6.2.Final, MySQL 5.1.52 , mysql-connector-java 5.1.15 (located at /usr/share/tomcat6/lib) and Tomcat 6.0.30</p>
  
  <p>I use google and try to fix it by myself, but without luck :(</p>
  
  <p>Can you help me -- what's I doing wrong?</p>
  
  <p>TIA</p>