Applet can't find class definition - NoClassDefFoundError
From: Phil Powell (soazine_at_erols.com)
Date: 02/26/04
- Next message: K Burke: "Building master SQL script using ANT (Sybase T-SQL/VSS)"
- Previous message: Andrew Thompson: "Re: I/O problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 26 Feb 2004 07:02:14 -0800
Upon attempting to run my chatroom at
http://www.myjavaserver.com/~ppowell/chat.jsp, I am
successfully able to enter a nickname, validate and even check within
the Singleton instance
of NicknameBin "nickBin". I can set a cookie, redirect, and then come
back to load the applet.
Then I get the following error in my Java console:
Java(TM) Plug-in: Version 1.4.2_03
Using JRE version 1.4.2_03 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\Phil Powell
Proxy Configuration: No proxy
java.lang.NoClassDefFoundError: ppowell/NicknameBin
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Here is the line in the Applet ChatClient that produces the error:
Line in ChatClient.class (applet): ChatClient.populateNickArray():
[CODE]
import ppowell.*;
public class ChatClient extends JApplet {
/**
* Populate the JTextfield tf3 with all nicknames
* @return String[] array of nicknames
* @see NicknameBin
*/
public String[] populateNickArray() {
String[] myNickArray = null;
// ********** THIS IS THE LINE THAT THROWS ERROR ************
Vector nickBin = NicknameBin.getNicknameBin(); // REFER TO OR CREATE
SINGLE INSTANCE
for (int i = 0; i < nickBin.size(); i++)
myNickArray = (String)nickBin.elementAt(i);
return myNickArray;
}
}
[/CODE]
Here is the skeleton of class NicknameBin. It is in the package
"ppowell" along with
the servlet and everything else except for the JSP scripts and the
Applet.
Class NicknameBin in same package (ppowell) as servlet and everything
else:
[CODE]
/**
* @version JSDK 1.4
* @author Phil Powell
*/
package ppowell;
import java.util.Vector;
/**
* Bin to store nicknames for chat. Singleton Design Pattern.
*
*/
public class NicknameBin extends Vector {
// DO STUFF
}
[/CODE]
Bottom line is that my Applet fails to call the class NicknameBin for
some reason I cannot
ascertain while getting a NoClassDefFoundError: ppowell/NicknameBin.
Also note that there are no JAR files associated with any of this
because the hosting
provider, www.myjavaserver.com does not allow for me to store any in
/WEB-INF/lib that can
be used (hey, it's free and I have no $), so the classes are all
separate and are in my
home directory.
I am not looking for code critique inasmuch as I am honestly looking
for feedback to the
problem regarding why my applet can't instantiate a NicknameBin class
when it imports the
entire ppowell package and yet throws a "malformed"
NoClassDefFoundError at the same time.
I need more Java guidance after all.
Thanx
Phil
- Next message: K Burke: "Building master SQL script using ANT (Sybase T-SQL/VSS)"
- Previous message: Andrew Thompson: "Re: I/O problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]