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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Getting InstantiationException " Watch "Getting InstantiationException " New topic
Author

Getting InstantiationException

Lakshmi Geetha
Greenhorn

Joined: Mar 06, 2001
Posts: 16
hi,
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.
thanks
exception
----------
500 Servlet Exception
java.lang.InstantiationException: `allbeans.MyBean' has no public zero-arg
constructor
at _test._myjsp__jsp._jspService(/test/MyJSP.jsp:14)
at com.caucho.jsp.JavaPage.service(JavaPage.java:74)
at com.caucho.jsp.Page.subservice(Page.java:485)
at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:179)
at com.caucho.server.http.Invocation.service(Invocation.java:288)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:132)
at com.caucho.server.http.ServletServer.serviceTop(ServletServer.java:937)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:213)
at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:158)
at com.caucho.server.TcpConnection.run(TcpConnection.java:140)
at java.lang.Thread.run(Thread.java:484)

--------------------------------------------------------------------------------
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;
import java.io.*;
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: 16140
    
  21

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting InstantiationException