当前位置: 技术问答>java相关
[初学者问题]在Tomcat上调用JavaBean出错,但在Resin上是没问题的,请指点!
来源: 互联网 发布时间:2017-03-19
本文导语: 出再以下错误: org.apache.jasper.JasperException: Unable to compile class for JSP An error occurred at line: 11 in the jsp file: /counter.jsp Generated servlet error: [javac] Compiling 1 source file C:Tomcat4workStandalonelocalhost_counter_jsp.j...
出再以下错误:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 11 in the jsp file: /counter.jsp
Generated servlet error:
[javac] Compiling 1 source file
C:Tomcat4workStandalonelocalhost_counter_jsp.java:51: cannot resolve symbol
symbol : class Counter
location: class org.apache.jsp.counter_jsp
Counter counter = null;
^
An error occurred at line: 11 in the jsp file: /counter.jsp
Generated servlet error:
C:Tomcat4workStandalonelocalhost_counter_jsp.java:53: cannot resolve symbol
symbol : class Counter
location: class org.apache.jsp.counter_jsp
counter = (Counter) pageContext.getAttribute("counter", PageContext.REQUEST_SCOPE);
^
An error occurred at line: 11 in the jsp file: /counter.jsp
Generated servlet error:
C:Tomcat4workStandalonelocalhost_counter_jsp.java:56: cannot resolve symbol
symbol : class Counter
location: class org.apache.jsp.counter_jsp
counter = (Counter) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "Counter");
^
3 errors
是不是class文件放错地方了,正确的应放在那?或要修改server.xml吗?
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 11 in the jsp file: /counter.jsp
Generated servlet error:
[javac] Compiling 1 source file
C:Tomcat4workStandalonelocalhost_counter_jsp.java:51: cannot resolve symbol
symbol : class Counter
location: class org.apache.jsp.counter_jsp
Counter counter = null;
^
An error occurred at line: 11 in the jsp file: /counter.jsp
Generated servlet error:
C:Tomcat4workStandalonelocalhost_counter_jsp.java:53: cannot resolve symbol
symbol : class Counter
location: class org.apache.jsp.counter_jsp
counter = (Counter) pageContext.getAttribute("counter", PageContext.REQUEST_SCOPE);
^
An error occurred at line: 11 in the jsp file: /counter.jsp
Generated servlet error:
C:Tomcat4workStandalonelocalhost_counter_jsp.java:56: cannot resolve symbol
symbol : class Counter
location: class org.apache.jsp.counter_jsp
counter = (Counter) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "Counter");
^
3 errors
是不是class文件放错地方了,正确的应放在那?或要修改server.xml吗?
|
jsp 文件应放在 C:Tomcat 4.1webappsROOT下,
如果你class里有 package test;
class文件放在 C:Tomcat 4.1webappsROOTWEB-INFclassestest 里。
如果你class里有 package test;
class文件放在 C:Tomcat 4.1webappsROOTWEB-INFclassestest 里。
|
tomcat:
tomcat/classes下
或tomcat/webapps/ROOT/WEB-INF下
weblogic:
如是5.1
weblogic/classes下
或
weblogic/myserver/serverclass下
tomcat/classes下
或tomcat/webapps/ROOT/WEB-INF下
weblogic:
如是5.1
weblogic/classes下
或
weblogic/myserver/serverclass下
|
tomcat4.1.12以下(含)是不能自动编译.java文件的,jsp要调用的javabean必须有对应的.class文件;而resin它可以在请求时自动编译!
但建议你将.java(javabean)放在项目根目录下的WEB-INF/classes下面!
但建议你将.java(javabean)放在项目根目录下的WEB-INF/classes下面!