楼主
在用户登陆后,再连接其它模块的时候出现以下错误提示,到底问题出在哪?
Apache Tomcat/5.5.23 - Error reportHTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from
fulfilling this request.
exception
org.apache.jasper.JasperException: kjgl/sqlBean (wrong name: sqlBean)
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:476)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:371)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
javax.servlet.ServletException: kjgl/sqlBean (wrong name: sqlBean)
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
org.apache.jsp.getteacher_jsp._jspService(getteacher_jsp.java:121)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
java.lang.NoClassDefFoundError: kjgl/sqlBean (wrong name: sqlBean)
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:620)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1847)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:873)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1326)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1205)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
kjgl.teacher.getAll(teacher.java:56)
org.apache.jsp.getteacher_jsp._jspService(getteacher_jsp.java:78)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache
Tomcat/5.5.23 logs.
Apache Tomcat/5.5.23
----------------解决方案--------------------------------------------------------
下面是sqlBean.java的代码
import java.io.*;
import java.sql.*;
public class sqlBean{///
public Connection conn=null;
public ResultSet rs=null;
private String DatabaseDriver="oracle.jdbc.driver.OracleDriver";
//DataSource 数据源名称DSN
private String DatabaseConnStr="jdbc:oracle:thin:@localhost:1521:MYORACLE,'system',manager";
//定义方法
/*setXxx用于设置属性值;getXxx用于得到属性值*/
public void setDatabaseDriver(String Driver){
this.DatabaseDriver=Driver;
}
public String getDatabaseDriver(){
return (this.DatabaseDriver);
}
public void setDatabaseConnStr(String ConnStr){
this.DatabaseConnStr=ConnStr;
}
public String getDatabaseConnStr(){
return (this.DatabaseConnStr);
}
public sqlBean(){/////构造函数
try{
Class.forName(DatabaseDriver);
}
catch(java.lang.ClassNotFoundException e){
System.err.println("加载驱动器有错误:"+e.getMessage( ));
System.out.print("执行插入有错误:"+e.getMessage());//输出到客户端
}
}
public int executeInsert(String sql){
int num=0;
try{
conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:MYORACLE","system","manager");
Statement stmt=conn.createStatement( );
num=stmt.executeUpdate(sql);
}
catch(SQLException ex){
System.err.println("执行插入有错误:"+ex.getMessage() );
System.out.print("执行插入有错误:"+ex.getMessage());//输出到客户端
}
CloseDataBase();
return num;
}
// display data
public ResultSet executeQuery(String sql){
rs=null;
try{
conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:MYORACLE","system","manager");
Statement stmt=conn.createStatement( );
rs=stmt.executeQuery(sql);
}
catch(SQLException ex){
System.err.println("执行查询有错误:"+ex.getMessage() );
System.out.print("执行查询有错误:"+ex.getMessage()); //输出到客户端
}
return rs;
}
// delete data
public int executeDelete(String sql){
int num=0;
try{
conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:MYORACLE","system","manager");
Statement stmt=conn.createStatement( );
num=stmt.executeUpdate(sql);
}
catch(SQLException ex){
System.err.println("执行删除有错误:"+ex.getMessage() );
System.out.print("执行删除有错误:"+ex.getMessage()); //输出到客户端
}
CloseDataBase();
return num;
}
//////////////////
public void CloseDataBase(){
try{
conn.close();
}
catch(Exception end){
System.err.println("执行关闭Connection对象有错误:"+end.getMessage( ) );
System.out.print("执行执行关闭Connection对象有错误:有错误:"+end.getMessage()); //输出到客户端
}
}
}
我想不出来为什么,在EditPlus里面编译带有servlet的文件,能编译成功.到底问题出在哪?
----------------解决方案--------------------------------------------------------
你用EditPlus作开发?
建议你用eclipse,调试以下有什么问题就很明显的可以查看到
也利于你的提高
----------------解决方案--------------------------------------------------------
哦,谢谢指导
----------------解决方案--------------------------------------------------------
java.lang.NoClassDefFoundError: kjgl/sqlBean (wrong name: sqlBean)
是不是bean路径搞错了说没有定义
----------------解决方案--------------------------------------------------------
C:\Tomcat\webapps\xsxt\WEB-INF\classes\xsxt 是sqlBean.class的存放位置,
C:\Tomcat\webapps\xsxt\ 是.jsp文件的存放位置,
仍然搞不清楚问题 因为有其它事要办还没下eclipse 试过
----------------解决方案--------------------------------------------------------
bean必须要有包名.否则找不到
----------------解决方案--------------------------------------------------------