I have a problem with running an example .jsp file listed on chapter 7
with the Javabean code listed below.
When I run it on the web browser, I get the following error message:
Error during JSP page processing
java.lang.NoClassDefFoundError: java/util/HashMap
at com.wrox.jspexamples.AlphabetCode.(Compiled Code)
at java.beans.Beans.instantiate(Beans.java:120)
at pagecompile.jsp._forLoop._jspService(Compiled Code)
at
com.sun.server.http.pagecompile.jsp.runtime.HttpJspBase.service(HttpJspBa
se.java:87)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
at
com.sun.server.http.pagecompile.jsp.runtime.JspServlet.runServlet(JspServ
let.java:469)
at
com.sun.server.http.pagecompile.jsp.runtime.JspServlet.processJspPage(Jsp
Servlet.java:259)
at
com.sun.server.http.pagecompile.jsp.runtime.JspServlet.service(JspServlet
.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
at com.sun.server.ServletState.callService(ServletState.java:226)
at
com.sun.server.ServletManager.callServletService(ServletManager.java:936)
at
com.sun.server.ProcessingState.invokeTargetServlet(ProcessingState.java:4
23)
at
com.sun.server.http.HttpProcessingState.execute(HttpProcessingState.java:
79)
at com.sun.server.http.stages.Runner.process(Runner.java:79)
at com.sun.server.ProcessingSupport.process(Compiled Code)
at com.sun.server.Service.process(Service.java:204)
at
com.sun.server.http.HttpServiceHandler.handleRequest(HttpServiceHandler.j
ava:374)
at com.sun.server.http.HttpServiceHandler.handleRequest(Compiled
Code)
at com.sun.server.HandlerThread.run(Compiled Code)
I believe that it's caused by incorrectly set classpath. However, there
was no compile errors as I compiled this .java codes.
So, if anyone can help me out with this, please give me some direction
how I can go about this problem.
I am using Java Web Server 2.0. JDK1.2.2 is installed on C drive and the
classpath is defined as follows:
set
classpath=.;C:\JDK1.2.2\LIB\TOOLS.JAR;C:\JDK1.2.2\LIB;C:\JDK1.2.2\LIB\JDB
C2_0-STDEXT.JAR
SET
CLASSPATH=%classpath%;d:\JWS2.0\classes\;d:\jws2.0\servlets;d:\JWS2.0\lib
;
set classpath=%classpath%;c:\Program Files\JDataConnect\classes\;
package com.wrox.jspexamples;
import java.awt.Color;
import java.util.*;
public class AlphabetCode
{
HashMap map;
char c = 0;
Integer colorNumber;
static int FIRST_LETTER = 0x41;
static int ALPHABET_LENGTH = 26;
float s = 0.9f;
float b = 0.9f;
public AlphabetCode()
{
this.map = new HashMap(ALPHABET_LENGTH);
for(int i = 0; i < ALPHABET_LENGTH; i++)
{
this.c = (char)(FIRST_LETTER + i);
float h = (float)i/ALPHABET_LENGTH;
this.map.put(new Character(c), Color.getHSBColor(h, s, b));
}
}
public void setCharacter(String nextChar)
{
this.c = nextChar.charAt(0);
}
public String getCharacter()
{
return (new Character(this.c).toString());
}
public String getColor()
{
Color rgb = (Color)map.get(new Character(this.c));
StringBuffer htmlColor = new StringBuffer(
colorNumber.toHexString(rgb.getRGB()
&
0x00ffffff));
// toHexString() won't preserve leading zeros, so need to add them
back in
// if they've gone missing...
if (htmlColor.length() != 6) {
htmlColor.insert(0, "\"#00");
} else
htmlColor.insert(0, "\"#");
htmlColor.append("\"");
return htmlColor.toString();
}
}
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html