This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes cannot compile JSP class file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "cannot compile JSP class file " Watch "cannot compile JSP class file " New topic
Author

cannot compile JSP class file

Rafi Fareen
Ranch Hand

Joined: Aug 28, 2009
Posts: 75
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
Marshal

Joined: Mar 22, 2005
Posts: 41132
    
  45
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).


Ping & DNS - my free Android networking tools app
Rafi Fareen
Ranch Hand

Joined: Aug 28, 2009
Posts: 75
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cannot compile JSP class file
 
Similar Threads
When JSP page is compiled?
Class cannot be resolved to a Type
The import cannot be resolved
Tomcat + NetBeans deploying, need help.
JSP error using tomcat