"Unable to load class" message under Tomcat 3.

Alessandro A. Garbagnati

Additional info
I created a very simple jsp page and put it in examples/jsp directory. This jsp page includes the following line of code:
<jsp:useBean id='clock' scope='page' class='JspCalendar' />.

I also put the JspCalendar.class, which I edited and it is not part of any package, in the WEB-INF/classes 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 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 from the jsp source is considered 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 can't be 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"%>

Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact