aspose file tools*
The moose likes JSP and the fly likes Internal Servlet Error ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Internal Servlet Error ?" Watch "Internal Servlet Error ?" New topic
Author

Internal Servlet Error ?

darine darine
Ranch Hand

Joined: Mar 08, 2001
Posts: 43
hi all
i have a very simple jsp that access a javabean.
my jsp file is in the default directory of tomcat "/weapps/examples/jsp/Box.jsp'
and i have the bean in "/examples/web-inf/classes/Box.java"
my full error is :
" org.apache.jasper.JasperException: Unable to compile C:\jakarta-tomcat-3.3.1\work\DEFAULT\examples\jsp\Box_1.java:50: Class jsp.Box not found.
out.print((new Box().result()));
"
my code are :
==============================
Box.java
public class Box
{
public String result()
{
return "hello world";
}

}
===============================
box.jsp
<%=(new Box().result())%>
ersin eser
Ranch Hand

Joined: Feb 22, 2001
Posts: 1072
A Bean needs to be in a package.
reddy kl
Greenhorn

Joined: Apr 04, 2002
Posts: 11
hi,the bean should be in package and the corresponding class file should be under web-inf/classes/packagename/Box.class,not ur Box.java as u did earlier
bye
Dev
Shubhrajit Chatterjee
Ranch Hand

Joined: Aug 23, 2001
Posts: 356
Originally posted by ersin eser:
A Bean needs to be in a package.

I don't think so .... I have often used beans which were not a part of any package and have successfully deployed them in Weblogic 5.1 and WebLogic 6. However the bean class needs to be imported with the jsp directive
<%@ page import="MyBean" %>


Shubhrajit
Shubhrajit Chatterjee
Ranch Hand

Joined: Aug 23, 2001
Posts: 356
Originally posted by Shubhrajit Chatterjee:

I don't think so .... I have often used beans which were not a part of any package and have successfully deployed them in Weblogic 5.1 and WebLogic 6. However the bean class needs to be imported with the jsp directive
<%@ page import="MyBean" %>

This is what I found from Servlet 2.3 specification. It never mentions that one is not allowed to put a bean outside a package

SRV.9.5 Directory Structure
A web application exists as a structured hierarchy of directories. The root of this
hierarchy serves as the document root for files that are part of the application. For
example, for a web application with the context path /catalog in a web container,
the index.html file at the base of the web application hierarchy can be served to
satisfy a request from /catalog/index.html. The rules for matching URLs to
context path are laid out in Chapter SRV.11. Since the context path of an application
determines the URL namespace of the contents of the web application, web
containers must reject web applications defining a context path could cause
potential conflicts in this URL namespace. This may occur, for example, by
attempting to deploy a second web application with the same context path, or two
web applications where one context path is a substring of the other. Since requests
are matched to resources case sensitively, this determination of potential conflict
must be performed case sensitively as well.
1. See the JavaServer Pages specification available from http://
java.sun.com/products/jsp.ഊDirectory Structure 61
A special directory exists within the application hierarchy named �WEB-INF�.
This directory contains all things related to the application that aren�t in the
document root of the application. The WEB-INF node is not part of the public
document tree of the application. No file contained in the WEB-INF directory may
be served directly to a client by the container. However, the contents of the WEB-
INF directory are visible to servlet code using the getResource and
getResourceAsStream method calls on the ServletContext. Hence, if the
Application Developer needs access, from servlet code, to application specific
configuration information that he does not wish to be exposed to the web client, he
may place it under this directory. Since requests are matched to resource
mappings case-sensitively, client requests for �/WEB-INF/foo�, �/WEb-iNf/foo�,
for example, should not result in contents of the web application located under /
WEB-INF being returned, nor any form of directory listing thereof.
The contents of the WEB-INF directory are:
� The /WEB-INF/web.xml deployment descriptor.
� The /WEB-INF/classes/ directory for servlet and utility classes. The classes
in this directory must be available to the application class loader.
� The /WEB-INF/lib/*.jar area for Java ARchive files. These files contain
servlets, beans, and other utility classes useful to the web application. The web
application class loader must be able to load classes from any of these archive
files.
The web application classloader must load classes from the WEB-INF/ classes
directory first, and then from library JARs in the WEB-INF/lib directory.
SRV.9.5.1 Example of Application Directory Structure
The following is a listing of all the files in a sample web application:
/index.html
/howto.jsp
/feedback.jsp
/images/banner.gif
/images/jumping.gif
/WEB-INF/web.xml
/WEB-INF/lib/jspbean.jar
/WEB-INF/classes/com/mycorp/servlets/MyServlet.class
/WEB-INF/classes/com/mycorp/util/MyUtils.class

[ June 03, 2002: Message edited by: Shubhrajit Chatterjee ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Internal Servlet Error ?
 
Similar Threads
Getting Started with Java and OS X
Problem in running JSPs on Tomcat
error using keyword public
Getting Started with Java and OS X
Inheritance, and the mis-use of the 'static' keyword