1 Reply Latest reply on Mar 29, 2005 10:07 AM by raja05

    ClassNotFoundException when trying to load JDBC driver in a

    jwach366

      I am running Eclipse 3.0.1 with MyEclipse 3.8.4 on a Pentium 4 machine running Windows XP Pro. I have MySQL 4.1 and JBoss 4. I've created a Web Project in Eclipse and want to connect to MySQL from within a method in a class that is called by a servlet. I've had a look at chapter 8 of the Getting Started with JBoss 4.0 Guide and get the impression that I have a lot to do to get to the point where I'll know how to get my program to tell JBoss where to find MySQL's JDBC driver. Is there a "quick" way to do this? I know that Class.forName("com.mysql.jdbc.Driver") coded in a simple java program being run under Eclipse works fine but in a Web application deployed and then run under JBoss 4 within Eclipse, I get a ClassNotFoundException and its getMessage() method returns "No ClassLoaders found for: com.mysql.jdbc.Driver".
      I found this on the Internet:

      Context jndiContext = new InitialContext();
      DataSouce ds =
      jndiContext.lookup("java:/ConnectionPool");
      Connection con =
      ds.getConnection();

      It came with this explanation: "When using an EJB container, deployment descriptors outside of the application specify the JDBC Driver Class and DB URL for the connection pool you use called ConnectionPoolName. This way the container can be configured and a different database selected independently from your source code."

      How do I find that connection pool name? What/Where is the deployment descriptor in which the JDBC Driver Class and DB URL are specified?

      Getting Started's chapter 8 gives me the impression that I'd need to mess with configuration issues everytime I create an application that needs to get to MySQL. That can't be right can it?

      Am I more confused than I need to be?

      THANK YOU in advance-