Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

JSP Internal Servlet Error Class can not be found problem

16 views
Skip to first unread message

wK

unread,
Jun 1, 2001, 9:45:07 AM6/1/01
to
Hi,

I am having a little problem getting my JSP scripts to import any classes.
I am using Windows 2000, apache tomcat 3.22 and JDK 1.3.0_02.
I have tomcat running fine with JSP scripts working.

I have set up a classpath as follows in the environment section of win2000.

CLASSPATH=.;c:\com\jspsmart\upload

I have made sure that this is set by typing set at the command prompt.

I have also checked that the folders and classes exist.

The script I am trying to run is as follows:

----------------------------------------------------------------------------
---------------------------------------------------------

<%@ page language="java" import="com.jspsmart.upload.*"%>
<jsp:useBean id="mySmartUpload" scope="page"
class="com.jspsmart.upload.SmartUpload" />

<HTML>
<BODY BGCOLOR="white">

<H1>jspSmartUpload : Sample 2</H1>
<HR>

<%
// Variables
int count=0;

// Initialization
mySmartUpload.initialize(pageContext);

// Upload
mySmartUpload.upload();

// Select each file
for (int i=0;i<mySmartUpload.getFiles().getCount();i++){

// Retreive the current file
com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(i);

// Save it only if this file exists
if (!myFile.isMissing()) {

// Save the files with its original names in a virtual path of the web
server
myFile.saveAs("/upload/" + myFile.getFileName());
// myFile.saveAs("/upload/" + myFile.getFileName(),
mySmartUpload.SAVE_VIRTUAL);

// sample with a physical path
// myFile.saveAs("c:\\temp\\" + myFile.getFileName(),
mySmartUpload.SAVE_PHYSICAL);

// Display the properties of the current file
out.println("FieldName = " + myFile.getFieldName() + "<BR>");
out.println("Size = " + myFile.getSize() + "<BR>");
out.println("FileName = " + myFile.getFileName() + "<BR>");
out.println("FileExt = " + myFile.getFileExt() + "<BR>");
out.println("FilePathName = " + myFile.getFilePathName() + "<BR>");
out.println("ContentType = " + myFile.getContentType() + "<BR>");
out.println("ContentDisp = " + myFile.getContentDisp() + "<BR>");
out.println("TypeMIME = " + myFile.getTypeMIME() + "<BR>");
out.println("SubTypeMIME = " + myFile.getSubTypeMIME() + "<BR>");

count ++;

}

}

// Display the number of files which could be uploaded
out.println("<BR>" + mySmartUpload.getFiles().getCount() + " files could be
uploaded.<BR>");

// Display the number of files uploaded
out.println(count + " file(s) uploaded.");


%>
</BODY>
</HTML>

However, when I attempt to run this I get the following error:
----------------------------------------------------------------------------
---------------------------------------------------------
Error: 500
Location: /jspsmartupload/jsp/sample2.jsp
Internal Servlet Error:


org.apache.jasper.JasperException: Unable to compile class for
JSPC:\tomcat\work\localhost_8080\_0002fjspsmartupload_0002fjsp_0002fsample_0
0032_0002ejspsample2_jsp_0.java:15: Package com.jspsmart.upload not found in
import.
import com.jspsmart.upload.*;
^
1 error

at org.apache.jasper.compiler.Compiler.compile(Compiler.java:254)
at org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:462)
at
org.apache.jasper.servlet.JasperLoader12.loadJSP(JasperLoader12.java:146)
at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:433)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspSe
rvlet.java:152)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:164)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:484)


----------------------------------------------------------------------------
---------------------------------------------------------
Now I am speculating that the error lies within the CLASSPATH but am unsure.
Can anyone help?

Robert Klemme

unread,
Jun 1, 2001, 11:07:16 AM6/1/01
to

wK schrieb:


>
> Hi,
>
> I am having a little problem getting my JSP scripts to import any classes.
> I am using Windows 2000, apache tomcat 3.22 and JDK 1.3.0_02.
> I have tomcat running fine with JSP scripts working.
>
> I have set up a classpath as follows in the environment section of win2000.
>
> CLASSPATH=.;c:\com\jspsmart\upload
>
> I have made sure that this is set by typing set at the command prompt.
>
> I have also checked that the folders and classes exist.

> [...]


> However, when I attempt to run this I get the following error:
> ----------------------------------------------------------------------------
> ---------------------------------------------------------
> Error: 500
> Location: /jspsmartupload/jsp/sample2.jsp
> Internal Servlet Error:
>
> org.apache.jasper.JasperException: Unable to compile class for
> JSPC:\tomcat\work\localhost_8080\_0002fjspsmartupload_0002fjsp_0002fsample_0
> 0032_0002ejspsample2_jsp_0.java:15: Package com.jspsmart.upload not found in
> import.
> import com.jspsmart.upload.*;
> ^
> 1 error

by the way: do not put "." in the classpath since this makes error
tracking very difficult: the directory "." points to is not fixed. if
you happen to execute the vm in another directory your applicatiom might
not run any more.

tomcat ignores the classpath settings. you have to put the jar or
classes into the web application (WEB-INF/classes or WEB-INF/lib).

and btw: why do you use JSP if you keep calling out.print() all the
time?

robert


--
Robert Klemme
Software Engineer
-------------------------------------------------------------
myview technologies GmbH & Co. KG
Riemekestraße 160 ~ D-33106 Paderborn ~ Germany
E-Mail: mailto:robert...@myview.de
Telefon: +49/5251/69090-321 ~ Fax: +49/5251/69090-399
-------------------------------------------------------------

0 new messages