500 Servlet Exception - Class Not Found

I recently changed web hosting companies, and copied all of my files (servlets, jsp, etc.) into the same file structure that I used with the previous company. I used these files for about three years without problems, but now cannot get my jsp's to recognize my servlets, or at least it appears that way.

My class files are in: /public_html/WEB-INF/classes, and my jsp files are in: /public_html, both of which are where the hosting company (Lunarpages) says to put the respective files. Though I had no problems with my files before, I now get the following error:

500 Servlet Exception

Note: sun.tools.javac.Main has been deprecated.

/reunion/messageBoard.jsp:22: Class _reunion.DBManager not found.

DBManager dbManager = new DBManager();

^

/reunion/messageBoard.jsp:22: Class _reunion.DBManager not found.

DBManager dbManager = new DBManager();

^

The jsp file that is calling the servlet contains the following:

<BODY BACKGROUND="" BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#800080" ALINK="#ff0000">

<%@ page import = "java.io.*, javax.servlet.*, javax.servlet.http.*, java.sql.*, java.util.*, java.util.Date" %>

<%

response.setHeader("Pragma", "No-cache");

response.setDateHeader("Expires", 0);

response.setHeader("Cache-Control", "no-cache");

ResultSet resultSet = null;

Connection connection = null;

DBManager dbManager = new DBManager();

String title = "Welch's Family Reunion";

String homePage = "http://www.cnjdesigns.com/reunion/index.html";

String messagePage = "http://www.cnjdesigns.com/reunion/messageBoard.jsp";

String postPage = "http://www.cnjdesigns.com/reunion/messagePost.jsp";

...

and the servlet has the following code:

import java.sql.*;

public class DBManager {

Connection connection = null;

private String URL = "jdbc:mysql://www.cnjdesigns.com/cnjde2_reunion";

private String username = "xxxxxxx";

private String password = "xxxxxxx";

public DBManager() {

// Load the Driver

try {

Class.forName("com.mysql.jdbc.Driver").newInstance();

} catch (Exception e) {

System.err.println("ERROR: Problems loading the driver" );

e.printStackTrace();

}

}

...

Anyone interested in seeing the actual page I'm trying to make work can go to:http://www.cnjdesigns.com/reunion/messageBoard.jsp

I tried to compile in both JDK 1.4 and 1.5, but that did not solve the problem.

Has anyone else experienced this or know what I'm doing wrong? Any help would be appreciated.

[2682 byte] By [JustHangingOutAndBeingGroovya] at [2007-11-27 0:24:42]
# 1
Not sure here but it looks like the servlet container can find the class _reunion.DBManager. Now not sure if this is a packaging problem. I can see that DBManager hasn't been declared in any package, and in my opinion it should.
mtedonea at 2007-7-11 22:21:50 > top of Java-index,Java Essentials,New To Java...
# 2
I don't understand that either. class _reunion is the jsp (class _reunion.jsp) and DBManager is the servlet (DBManager.class), each in their respective directories identified by the hosting company.
JustHangingOutAndBeingGroovy at 2007-7-11 22:21:50 > top of Java-index,Java Essentials,New To Java...
# 3

I think I understand the problem here.

If your JSP is under the _reunion folder, but your DBManager is not, then you should import your DBManager into your JSP. Since you are saying that DBManager is under another folder, that means another package and the direct access from the JSP to DBManager using:

DBManager manager = new DBManager() wouldn't work, because Tomcat would expect to find DBManager under the same folder.

mtedonea at 2007-7-11 22:21:50 > top of Java-index,Java Essentials,New To Java...
# 4
You aren't importing your DBManager class. And you must import it because it must be in a package. It can't be in the default package (the one with no name) because that's against the rules of servlets.
DrClapa at 2007-7-11 22:21:50 > top of Java-index,Java Essentials,New To Java...