Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cannot compile JSP class file

 
Rafi Fareen
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my jsp code:


my plain java code:


after running jsp i get the following exception:

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: 6 in the jsp file: /RandomVI.jsp
test.randomNumber cannot be resolved to a type
3: <HEAD><H2> Random Numbers </H2></HEAD>
4: <BODY>
5: <UL>
6: <IL><%= test.randomNumber.randomNo() %></IL>
7: </UL>
8: </BODY>
9: </HTML>


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.20 logs.

Apache Tomcat/6.0.20


classpath: C:\www\tomcat\webapps\Fareen
the package: C:\www\tomcat\webapps\Fareen\test *randomNumber.class*

even though i have kept the java class file in the same directory as jsp file, but it still cannot resolve. i have also used
<%@ page import = "test.*" %> but still not resolved ......

all other jsp and servlet is running properly.

any idea,



 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the package: C:\www\tomcat\webapps\Fareen\test *randomNumber.class*

Class files go into the WEB-INF/classes directory (or rather, WEB-INF/classes/test in this case).
 
Rafi Fareen
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:
the package: C:\www\tomcat\webapps\Fareen\test *randomNumber.class*

Class files go into the WEB-INF/classes directory (or rather, WEB-INF/classes/test in this case).


awesome :p i though (web-inf/classes) is only used for servlet not jsp.
that was useful, thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic