title: java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver when using glassfish
body: <p>I'm attempting to connect a Java web application to a ms access database. I get a java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver when running any page of the application that takes data from the database over the GlassFish server.</p>
  
  <p>Within the same application I have a 'test app' that successfully takes all data from the database and prints to the console. I'm trying to run the same method from the underlying database class to retrieve the data from a .jsp.</p>
  
  <p>I've checked that the JDK has the necessary class.</p>
  
  <p><strong>I'm using</strong></p>
  
  <p>Netbeans 8.0.2 (64 bit)</p>
  
  <p>JDK 7.0.0_67 (64 bit)</p>
  
  <p>MS Access 2010 (64 bit)</p>
  
  <p>GlassFish server 4.1</p>
  
  <p>Upgrading to JDK 8 is not an option, this app is for a University project that has to run on the Unis computers which use JDK 7.</p>
  
  <p><strong>Exception</strong></p>
  
  <pre><code>Warning:   StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
  java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver
      at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1783)
      at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1633)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:259)
      at plymoutheventsaccess.DatabaseConnector.createConnection(DatabaseConnector.java:42)
      at org.apache.jsp.eventList_jsp._jspService(eventList_jsp.java:62)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:411)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:473)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:377)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:415)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282)
      at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
      at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
      at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
      at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
      at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
      at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
      at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
      at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>Any help much appreciated.</p>
  
  <p>Tony</p>