当前位置: 技术问答>java相关
Bean编译后的class该放哪儿?数据库连接问题,急!解决给分
来源: 互联网 发布时间:2015-05-29
本文导语: 我做了一个连接Acess数据库的Bean为DBconn,和数据库连接时,解决了其它问题后出现了找不到类DBconn的异常,请问写的Bean和编译后的Class该放哪里?我将JSP文件放在了webappsROOT目录下。用的是Apache Tomcat服务器。异常如...
我做了一个连接Acess数据库的Bean为DBconn,和数据库连接时,解决了其它问题后出现了找不到类DBconn的异常,请问写的Bean和编译后的Class该放哪里?我将JSP文件放在了webappsROOT目录下。用的是Apache Tomcat服务器。异常如下:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 9 in the jsp file: /cj.jsp
Generated servlet error:
D:Apache Tomcat 4.0worklocalhost_cj$jsp.java:65: 找不到类 org.apache.jsp.DBconn。
DBconn DBconn1 = null;
^
An error occurred at line: 9 in the jsp file: /cj.jsp
Generated servlet error:
D:Apache Tomcat 4.0worklocalhost_cj$jsp.java:68: 找不到类 org.apache.jsp.DBconn。
DBconn1= (DBconn)
^
An error occurred at line: 9 in the jsp file: /cj.jsp
Generated servlet error:
D:Apache Tomcat 4.0worklocalhost_cj$jsp.java:73: 找不到类 org.apache.jsp.DBconn。
DBconn1 = (DBconn) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "DBconn");
^
3 个错误
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:284)
at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:546)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:177)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:189)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
at java.lang.Thread.run(Thread.java:484)
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 9 in the jsp file: /cj.jsp
Generated servlet error:
D:Apache Tomcat 4.0worklocalhost_cj$jsp.java:65: 找不到类 org.apache.jsp.DBconn。
DBconn DBconn1 = null;
^
An error occurred at line: 9 in the jsp file: /cj.jsp
Generated servlet error:
D:Apache Tomcat 4.0worklocalhost_cj$jsp.java:68: 找不到类 org.apache.jsp.DBconn。
DBconn1= (DBconn)
^
An error occurred at line: 9 in the jsp file: /cj.jsp
Generated servlet error:
D:Apache Tomcat 4.0worklocalhost_cj$jsp.java:73: 找不到类 org.apache.jsp.DBconn。
DBconn1 = (DBconn) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "DBconn");
^
3 个错误
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:284)
at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:546)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:177)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:189)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
at java.lang.Thread.run(Thread.java:484)
|
放在webappsROOTWEB-INFclasses下.
try
try
|
放在 tomcatwebappsexamplesWEB-INFclasses 目录下面,如果有package name;再classes下建 name文件夹,将你的class文件放入即可。
|
放在webappsROOTWEB-INFclassesjspbeans下吧
|
bean文件夹放在webappsROOTWEB-INFclasses
工程文件放在webappsROOT下任意目录
要注意要把
mm.mysql.jdbc-1.2c.tarmm.mysql.jdbc-1.2cmysql_comp.jar;
mm.mysql.jdbc-1.2c.tarmm.mysql.jdbc-1.2cmysql_uncomp.jar;
放到lib下,重起tomcat
工程文件放在webappsROOT下任意目录
要注意要把
mm.mysql.jdbc-1.2c.tarmm.mysql.jdbc-1.2cmysql_comp.jar;
mm.mysql.jdbc-1.2c.tarmm.mysql.jdbc-1.2cmysql_uncomp.jar;
放到lib下,重起tomcat
|
放在webappsROOTWEB-INFclasses下.