473,500 Members | 1,717 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error for java.lang.InstantiationException in using CachedRowSet

30 New Member
I'm new to JSP, and am trying this sample code for instantiating a bean for use in a disconnected ResultSet, i placed the rowset.jar under WEB-INF/lib directory but i get the following error:

javax.servlet.ServletException: interface javax.sql.rowset.CachedRowSet : java.lang.InstantiationException: javax.sql.rowset.CachedRowSet

and

root cause

java.lang.InstantiationException: interface javax.sql.rowset.CachedRowSet : java.lang.InstantiationException: javax.sql.rowset.CachedRowSet


Why won't it instantiate?

Code:
<%@ page import="sun.jdbc.rowset.CachedRowSet" %>


<HTML>
<HEAD>
<jsp:useBean id="Contacts" class="sun.jdbc.rowset.CachedRowSet" scope="session">
<%
Class.forName("org.gjt.mm.mysql.Driver").newInstan ce();
// initialize our CachedRowSet bean
Contacts.setUsername("webuser");
Contacts.setPassword("pwd");
Contacts.setUrl("jdbc:mysql://localhost:3306/person");
// some drivers require this
Contacts.setTableName("contacts");
Contacts.setCommand("SELECT name, telephone from contacts");
Contacts.execute();
Contacts.first();
%>
</jsp:useBean>


thanks in advance.........

Regards,

V. Prasath
Jul 31 '07 #1
1 3881
madhoriya22
252 Contributor
I'm new to JSP, and am trying this sample code for instantiating a bean for use in a disconnected ResultSet, i placed the rowset.jar under WEB-INF/lib directory but i get the following error:

javax.servlet.ServletException: interface javax.sql.rowset.CachedRowSet : java.lang.InstantiationException: javax.sql.rowset.CachedRowSet

and

root cause

java.lang.InstantiationException: interface javax.sql.rowset.CachedRowSet : java.lang.InstantiationException: javax.sql.rowset.CachedRowSet


Why won't it instantiate?

Code:
<%@ page import="sun.jdbc.rowset.CachedRowSet" %>


<HTML>
<HEAD>
<jsp:useBean id="Contacts" class="sun.jdbc.rowset.CachedRowSet" scope="session">
<%
Class.forName("org.gjt.mm.mysql.Driver").newInstan ce();
// initialize our CachedRowSet bean
Contacts.setUsername("webuser");
Contacts.setPassword("pwd");
Contacts.setUrl("jdbc:mysql://localhost:3306/person");
// some drivers require this
Contacts.setTableName("contacts");
Contacts.setCommand("SELECT name, telephone from contacts");
Contacts.execute();
Contacts.first();
%>
</jsp:useBean>


thanks in advance.........

Regards,

V. Prasath
Hi,
This exception is thrown when u r trying to create a instance of a class using new operator, but it not a class instead it is interface or abstract class.
I think u hav done the same mistake.......CachedRowSet is a interface..and u trying to create instance of that...check it again.
thanks and regards,
madoriya
Jul 31 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2259
by: Jeremy | last post by:
Hi, can anybody tell me where/how to get Sun's implementation of CachedRowSet?? I've found (old-ish) articles saying it's available as rowset.jar from the Early Access part of the developer...
2
13504
by: Tim Murray | last post by:
First of all, I don't know much about Java, even its naming and version numbering nomenclature, and second, if there is a better group to ask this in, please let me know. System is Mac with...
15
28785
by: Bjorn Jensen | last post by:
Hi! An beginner question: Pleas help me with this (-: Error (the arrow points on the s in sqrt) ===== tal.java:6: cannot find symbol symbol : method sqrt(int) location: class tal...
1
4358
by: kommaraju | last post by:
iam a starter to db2 & jdbc.i have a servlet program which connects to ibm db2 using jdbc.when i run this using apache tomcat 4.1.34 , it is showing a error message of HTTP STATUS 500 my jdbc...
0
1559
by: tejpatil | last post by:
Hi All, This was installed recently on my desktop which has fedora core 6. This used to work perfectly. I used to update linux with daily updates, after few updates this started giving issues. I...
1
1465
by: prasath03 | last post by:
Dear all, I need a sample coding about CachedRowSet using in jsp without bean class. That code displays 10 records per page from the database when i click the Previous and Next button or link. ...
2
2050
by: prasath03 | last post by:
Hi All, I tried the following code to run in jsp using Tomcat 4, the following code took from web. Code: <%@ page import="sun.jdbc.rowset.CachedRowSet" %> <HTML> <HEAD> <jsp:useBean...
11
5360
by: honguin | last post by:
Hi, With the following code, I have created a web request to a url which I am making a HTML POST with the html page request.htm, even though it makes a HTML POST, the StreamReader produces a XML...
2
2949
by: inetjack | last post by:
Hi, This is a little test application, generating and compiling code at runtime. The loadClassLoader() method of the Factory Object suppose to unload all class previously loaded. It does not...
0
7021
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7207
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7242
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6914
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5503
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4928
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4619
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3112
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
686
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.