aspose file tools
The moose likes JSP and the fly likes Getting InstantiationException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Groovy Fundamentals video training course this week in the Groovy forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Getting InstantiationException " Watch "Getting InstantiationException " New topic

Getting InstantiationException

Lakshmi Geetha

Joined: Mar 06, 2001
Posts: 16
i have written a simple bean and am trying to use it in a jsp page.
i am getting the following exception.
please help in finding out the problem.
500 Servlet Exception
java.lang.InstantiationException: `allbeans.MyBean' has no public zero-arg
at _test._myjsp__jsp._jspService(/test/MyJSP.jsp:14)
at com.caucho.jsp.JavaPage.service(
at com.caucho.jsp.Page.subservice(
at com.caucho.server.http.FilterChainPage.doFilter(
at com.caucho.server.http.Invocation.service(
at com.caucho.server.http.CacheInvocation.service(
at com.caucho.server.http.ServletServer.serviceTop(
at com.caucho.server.http.HttpRequest.handleRequest(
at com.caucho.server.http.HttpRequest.handleConnection(

Resin 2.0.5 (built Fri Jan 11 08:29:05 PST 2002)

In my jsp page
<jsp:useBean id="myBean" class="allbeans.MyBean" scope="request" />
my bean class
package allbeans;
public class MyBean implements Serializable
public MyBean()
_name = "geetha";
public String getName()
return _name;
public void setName(String name)
_name = name;
private String _name;

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16759

Well obviously it DOES have a zero-argument public constructor.
1. Does the source filename EXACTLY (including upper/lower case) match the class name? This SHOULDN'T cause that exception (there's a different exception reserved for that, but maybe it didn't catch it).
2. Have you placed the class in WEB-INF/classes/allbeans/MyBean.class?
3. If so, recompile, move the class file to that location, and restart the server.

Customer surveys are for companies who didn't pay proper attention to begin with.
It is sorta covered in the JavaRanch Style Guide.
subject: Getting InstantiationException