"Unable to load class" message under Tomcat
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   takis_millas
Posted On:   Thursday, September 20, 2001 03:27 AM

I created a very simple jsp page and put it in examples/jsp directory. This jsp page includes the following line of code .


I also put the JspCalendar.class, which I edited it so IS NOT in any package, in the web-infclasses directory.


When I run my jsp page I get a message java.lang.ClassNotFoundException: Unable to load class jsp.JspCalendar.


Why does it search for the class in a package "jsp" as the message indicates ?


I just want to run a jsp page that uses a class, NOT A SERVLET, that is NOT in a package.


Thanks.

Re: "Unable to load class" message under Tomcat

Posted By:   AlessandroA_Garbagnati  
Posted On:   Friday, January 18, 2002 06:52 AM

Takis,

I think that the reason is because in Tomcat 3.x, once the page is located in a subdirectory of the context's root (in your case the directory is called jsp), the servlet that is generated fomr the jsp source (remember that jsp is a servlet), the classloader probably consider it part of a package, whose name is the directory name.

At this point since you haven't imported the class, and since you're no more in the same package, your class isn't found and the compiler gives you the standard error that says that your class can't be found in the current package.


Try importing the class:

<%@ page import="JspCalendar"%>

About | Sitemap | Contact