Problems with class not found exception

'Loading JDBC Driver Class - mysql-connector-java-5.0.7-bin.jar' tutorial was cited in a Bitnami in forum post in 2012.

The Loading JDBC Driver Class - mysql-connector-java-5.0.7-bin.jar tutorial was cited in a Bitnami in forum post in 2012.

Subject: Problems with class not found exception
Date: Jun 3, 2012
Author: AndyEdwards
Source: http://answers.bitnami.org/questions/5132
   /problems-with-class-not-found-exception

I've just installed an Amazon EC2 Bitnami instance with Apache2, 
MySQL, PHP and Tomcat (i.e. LAMP + Tomcat). Everything works just 
fine except I cannot for the life of me get a JDBC connection.

Every time I run: Class.forName("com.mysql.jdbc.Driver") ; I get a 
"Class not loaded exception on com.mysql.jdbc.Driver.

I've boiled the problem down to some simple code:

 /**
 * MySQL loadDriver.java
 * Copyright (c) 2007 by Dr. Herong Yang. All rights reserved.
 */

import java.sql.Connection;
import java.sql.Connection.*;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.*;
import java.util.Properties;
import java.net.*;

public class MySqlLoadDriver {
  public static void main(String [] args) {
    Connection con = null;
    try {

        // Load the MySQL JDBC driver
        Class.forName("com.mysql.jdbc.Driver") ;
        System.out.println("MySQL JDBC driver loaded ok.");

        } catch (Exception e) {
        System.err.println("Exception: "+e.getMessage());
    }
  }
}

My CLASSPATH shows: .:/opt/bitnami/java/mytest:/opt/bitnami/java
/mytest/mysql-connector-java-5.1.12-bin.jar:/opt/bitnami
/apache-tomcat/lib

with my test area (/opt/bitnami/java/mytest) and /opt/bitnami
/apache-tomcat/lib have the file: -rwxrwxrwx 1 root root 732695 
2010-02-18 05:16 mysql-connector-java-5.1.12-bin.jar

I was hoping the bitnami EC2 instance would come with all this 
configured.

Can anyone shed some light on why I always get an exception when 
trying to load the class?

Table of Contents

 About This Book

 Reference Citations in 2017

 Reference Citations in 2016

 Reference Citations in 2015

 Reference Citations in 2014

 Reference Citations in 2013

Reference Citations in 2012

 bikin website dalam bahasa cina dengan php

 72 sekunde kao 72 godine

 nsIConverterOutputStream handling GB2312 characters

 AbstractMethodError while calling PreparedStatement.setBinaryStream()

 how to invoke web service without generating a client

 Sample program to test SSL Connection with certicates

 How to know KeyManager given a keystore

 once again: classpath and ojdbc14.jar

 12c... webtier up, Oracle managment server down

Problems with class not found exception

 Spring Projects > Roo > Issue with Chinese characters

 Monkey Programming/Unsigned Shift Right

 Unable to get issuer certificate

 How to convert keystore (from native android project) to .p12 to use with AIR project?

 Installing JDBC drivers ojdbc14.jar

 Quickly view the threads of your blocked Ruby application with JStack

 android verify signature of file with .der public key

 Unable to install updates KB2770917 and KB2779768

 Reference Citations in 2011

 Reference Citations in 2010

 Reference Citations in 2009

 Reference Citations in 2008

 Reference Citations in 2007

 Reference Citations in 2006

 Reference Citations in 2005

 Reference Citations in 2004

 Reference Citations in 2003

 PDF Printing Version