免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5054 | 回复: 7
打印 上一主题 下一主题

"Unable to compile class for JSP"错误! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-05-10 15:11 |只看该作者 |倒序浏览
代码片断为:

  1. Class.forName("org.gjt.mm.mysql.Driver").newInstance();
  2. String url =jdbc:mysql://localhost/sampdb?user=aini3001&password=aini3001&useUnicode=true&characterEncoding=GB2312;               
  3. Connection conn= DriverManager.getConnection(url);                                                
  4. Statement stmt=conn.createStatement();
复制代码


错误提示为:

HTTP 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: Unable to compile class for JSP

An error occurred at line: 4 in the jsp file: /test.jsp

Generated servlet error:
    [javac] Compiling 1 source file

/usr/local/jakarta-tomcat-4.1.31/work/Standalone/localhost/_/test_jsp.java:48: ';' expected



An error occurred at line: 4 in the jsp file: /test.jsp

Generated servlet error:
String url =jdbc:mysql://localhost/sampdb?user=aini3001&password=aini3001&useUnicode=true&characterEncoding=GB2312;
                ^
1 error
......

不知什么原因,如何解决?

论坛徽章:
0
2 [报告]
发表于 2005-05-10 21:06 |只看该作者

"Unable to compile class for JSP"错误!

把jdk\bin的目录加到环境变量的path里

论坛徽章:
0
3 [报告]
发表于 2005-05-10 22:17 |只看该作者

"Unable to compile class for JSP"错误!

[quote]原帖由 "eudemon"]把jdk\bin的目录加到环境变量的path里[/quote 发表:


跟环境变量没关系吧。

看看楼主的代码

  1. String url =jdbc:mysql://localhost/sampdb?user=aini3001&password=aini3001&useUnicode=true&characterEncoding=GB2312;
复制代码

字符串变量不用引号?

论坛徽章:
0
4 [报告]
发表于 2005-05-11 09:22 |只看该作者

"Unable to compile class for JSP"错误!

环境变量设置没问题:
JAVA_HOME=/usr/java/j2sdk1.4.2_08
CLASSPATH=$JAVA_HOME/libJAVA_HOME/jre/libJAVA_HOME:/usr/local/work:/root/mysql-connector-java-3.1.7:/usr/local/jakarta-tomcat-4.1.31/common/lib/servlet.jar
TOMCAT_HOME=/usr/local/jakarta-tomcat-4.1.31
CATALINA_BASE=$TOMCAT_HOME
CATALINA_HOME=$TOMCAT_HOME
PATH=$JAVA_HOME/binJAVA_HOME/jre/binPATHHOME/bin
BASH_ENV=$HOME/.bashrc
USERNAME="root"

export USERNAME BASH_ENV JAVA_HOME CLASSPATH CATALINA_BASE CATALINA_HOME PATH

字符串变量用引号出现下列错误:

HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Access denied for user: 'root@soft' (Using password: YES)
        at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:49

论坛徽章:
0
5 [报告]
发表于 2005-05-11 14:41 |只看该作者

"Unable to compile class for JSP"错误!

现在的错误是mysql数据库的问题,你没给root用户访问数据库的权限,跟程序没关系了

论坛徽章:
0
6 [报告]
发表于 2005-05-11 21:53 |只看该作者

"Unable to compile class for JSP"错误!

root用户是超级用户,有问题吗?

论坛徽章:
0
7 [报告]
发表于 2005-05-11 22:13 |只看该作者

"Unable to compile class for JSP"错误!

跟root用户是不是超级用户没关系。
http://dev.mysql.com/doc/mysql/en/privilege-system.html

论坛徽章:
0
8 [报告]
发表于 2005-05-12 09:56 |只看该作者

"Unable to compile class for JSP"错误!

不明白!
root用户具有访问数据库的权限!
又新建了其它用户,还是不行。新建过程如下:
#./mysql -u root -p mysql
>;GRANT ALL ON *.* TO newuser@localhost IDENTIFIED BY 'newuserpassword' WITH GRANT OPTION;
>;GRANT ALL ON *.* TO newuser@'%' IDENTIFIED BY 'newuserpassword' WITH GRANT OPTION;

请指教!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP