Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

javax.servlet.ServletException & java.lang.NoClassDefFoundError

843836Feb 13 2004 — edited Feb 16 2004
I am getting this javax.servlet.ServletException & java.lang.NoClassDefFoundError
exceptions while running jsp in .netbeans.

Iwas able to compile and run jsp pgms , but i am getting this error when i use jsp:useBean.I think the java class created is not in the proper path..netbeans is using tomcat server.The ide put the jsp's in the proper path. but it is not putting the java class i created with setter and getter methods.I also set the classpath. but din't work

I t is eating up my time!Pl. suggest me a solution!

Directory structure is :source file
c:/windows/.netbeans/3.5/samples/jsp

I guess the ide is putting all the class files(jsp) in
C:\WINDOWS\.netbeans\3.5\tomcat406_base\work\Tomcat-Internal\localhost\C_3A_5CWINDOWS_5C.netbeans_5C3.5_5Csampledir\JSP

so i copied the userData.class from source dir to the above directory.
and i also did the
set CLASSPATH= C:\WINDOWS\.netbeans\3.5\tomcat406_base\work\Tomcat-Internal\localhost\C_3A_5CWINDOWS_5C.netbeans_5C3.5_5Csampledir\JSP

in dos prompt

pl. find the code below.

Html:
<HTML>
<HEAD>
<TITLE>getData</TITLE>
</HEAD>
<BODY>
<form method = post action="saveData.jsp">
What's your Name : <input type=text name =username size=10>
<br>
What's Age : <input type=text name=age size=10>
<br>
What's ur email id : <input type=text name=email size=10>
<input type=submit>
</FORM>
</BODY>
</HTML>

SaveData.jsp
-----------------
<jsp:useBean id="user" class="JSP.userData" scope="session"/>
<jsp:setProperty name="user" property="*"/>

<html>
<head><title>using bean</title></head>
<body>
--Continue
Thank u

</body>
</html>

userData.java
-------------------
/*
* userData.java
*
* Created on February 12, 2004, 1:06 PM
*/

package JSP;

/**
*
* @author amano
*/
public class userData {

String userName;
int age;
String email;
/** Creates a new instance of userData */
public userData()
{
}

public void setUsername(String str)
{
userName=str;
}
public void setAge(int str)
{
age=str;
}

public void setEmail(String str)
{
email=str;
}

public String getUsername()
{
return userName;
}
public int getAge()
{
return age;
}
public String getEmail()
{
return email;
}


}




Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 15 2004
Added on Feb 13 2004
8 comments
486 views