de Server找不到com.mysql.jdbc.Driver

时间:2015-06-27 16:34:56

标签: mysql jsp jdbc file-permissions

我有一个已经工作了很长时间的网络应用程序..当我尝试登录时突然收到此消息:

  

javax.servlet.ServletException:java.lang.ClassNotFoundException:com.mysql.jdbc.Driver

正如我之前说的那样,它已经工作了3年多了......但是为我做主机的人却无法做任何事......我的WEB-INF文件夹上有我的驱动程序......所有文件夹都可以权限导致此问题?我把它们设为0744 ......任何想法?

这是WEB-INF文件夹的屏幕截图:

enter image description here

我设法登录到Web应用程序,但是登录jsp文件无法正常工作,因为连接没有发生...这里是代码:

<%@ page contentType="text/html; charset=utf-8" language="java"              import="java.sql.*" errorPage="" %>
<%@ page language="java" session="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Accesando a Vecinet</title>

</head>

<body>
<%

Connection conn = null;
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn =    DriverManager.getConnection("jdbc:mysql://localhost/etoolsco_VecinetSM?user=etoolsco&password=xxxx");

ResultSet rsdoLogin = null;
PreparedStatement psdoLogin=null;

String uname=request.getParameter("j_username");
String upass=request.getParameter("j_password");
String message="User login successfully ";
%>


<% try
{
String sqlOption="SELECT * FROM logins where"
                +" usuario=? and clave=?";

psdoLogin=conn.prepareStatement(sqlOption);
psdoLogin.setString(1,uname);
psdoLogin.setString(2,upass);

rsdoLogin=psdoLogin.executeQuery();

if(rsdoLogin.next())
{
  session.setAttribute("usuario",rsdoLogin.getString("usuario"));
  session.setAttribute("clave",rsdoLogin.getString("clave"));
  session.setAttribute("nombre",rsdoLogin.getString("nombre"));
  session.setAttribute("apellido",rsdoLogin.getString("apellido"));
  session.setAttribute("role",rsdoLogin.getString("role"));
  session.setMaxInactiveInterval(7200);

  response.sendRedirect("Vecinetspace.jsp?error="+message);


}
else
{
  response.sendRedirect("error.jsp?error=");
}
}
catch(Exception e)
{
    e.printStackTrace();
}

try{
     if(psdoLogin!=null){
         psdoLogin.close();
     }
     if(rsdoLogin!=null){
         rsdoLogin.close();
     }

     if(conn!=null){
      conn.close();
     }
}
catch(Exception e)
{
    e.printStackTrace();
}

%>
</body>
</html>

这是与正在运行的应用程序相同的login.jsp代码:

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ page language="java" import="java.sql.*" errorPage="" %>
<%@ page language="java" session="true" %>
<html>
<head><title>Login to CRD</title>

</head>

<body>

<%

Connection conn = null;
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://localhost/etoolsco_labsmb?user=etoolsco&password=xxx");

ResultSet rsdoLogin = null;
PreparedStatement psdoLogin=null;

String uname=request.getParameter("j_username");
String upass=request.getParameter("j_password");
String message="User login successfully ";
%>


<% try
{
String sqlOption="SELECT * FROM logins where"
                +" usuario=? and clave=?";

psdoLogin=conn.prepareStatement(sqlOption);
psdoLogin.setString(1,uname);
psdoLogin.setString(2,upass);

rsdoLogin=psdoLogin.executeQuery();

 if(rsdoLogin.next())
 {
  session.setAttribute("usuario",rsdoLogin.getString("usuario"));
  session.setAttribute("clave",rsdoLogin.getString("clave"));
  session.setAttribute("nombre",rsdoLogin.getString("nombre"));
  session.setAttribute("apellido",rsdoLogin.getString("apellido"));
  session.setAttribute("role",rsdoLogin.getString("role"));
  session.setMaxInactiveInterval(600);

  response.sendRedirect("BMRspace.jsp?error="+message);


}
else
{
  response.sendRedirect("error.jsp?error=");
}
}
catch(Exception e)
{
    e.printStackTrace();
}

try{
     if(psdoLogin!=null){
         psdoLogin.close();
     }
     if(rsdoLogin!=null){
         rsdoLogin.close();
     }

     if(conn!=null){
      conn.close();
     }
}
catch(Exception e)
{
    e.printStackTrace();
}

%>
</body>
</html>

0 个答案:

没有答案