| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1259 人关注过本帖
标题:JSP+JavaBean+servlet 的问题
取消只看楼主 加入收藏
kahineasin
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-7-19
收藏
 问题点数:0 回复次数:3 
JSP+JavaBean+servlet 的问题

楼主
在用户登陆后,再连接其它模块的时候出现以下错误提示,到底问题出在哪?
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

搜索更多相关主题的帖子: servlet JavaBean JSP jasper apache 
2007-07-19 10:29
kahineasin
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-7-19
收藏
得分:0 
回复:(kahineasin)JSP+JavaBean+servlet 的问题

下面是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的文件,能编译成功.到底问题出在哪?


2007-07-19 10:32
kahineasin
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-7-19
收藏
得分:0 
哦,谢谢指导

2007-07-19 10:46
kahineasin
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-7-19
收藏
得分:0 
C:\Tomcat\webapps\xsxt\WEB-INF\classes\xsxt 是sqlBean.class的存放位置,
C:\Tomcat\webapps\xsxt\ 是.jsp文件的存放位置,
仍然搞不清楚问题 因为有其它事要办还没下eclipse 试过

2007-07-19 18:42
快速回复:JSP+JavaBean+servlet 的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018230 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved