Java.lang.NoClassDefFoundError: oracle/jdbc/driver/OracleDriver
When I run java servlet test_ora.java with IE6.0 I get the following error page:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:646)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:483)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:646)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:483)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2349)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:646)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:644)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:644)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:483)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:646)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:469)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:644)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:483)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:376)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:518)
at java.lang.Thread.run(Thread.java:536)
root cause
java.lang.NoClassDefFoundError: oracle/jdbc/driver/OracleDriver
at test_ora.doGet(test_ora.java:21)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:646)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:483)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:646)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:483)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2349)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:646)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:644)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:644)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:483)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:646)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:469)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:644)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:483)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:376)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:518)
at java.lang.Thread.run(Thread.java:536)
Java Web Services Developer Pack/1.0-fcs
I thought it is about JDBC configuration. But when I run JdbcCheckup.java everything works fine. Can anybody help me, please?
test_ora.java looks like this:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class test_ora extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
String str_dok_numer, str_f_inkraft;
int int_dok_wal_id;
Connection conn=null;
Statement s = null;
response.setContentType("text/html;charset=iso-8859-2");
PrintWriter out = response.getWriter();
try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
conn = DriverManager.getConnection(
"jdbc:oracle:thin:@192.168.15.2:1521:DB2","janusz","kimono");
s = conn.createStatement();
} catch (SQLException e) {
out.println("Blad polaczenia z baza danych: " + e.getMessage());
try {
ResultSet r =s.executeQuery("select dok_numer, f_inkraft, dok_wal_id from gndlf_umowy_inkraft");
out.println("DOK_NUMER\tF_INKRAFT\tDOK_WAL_ID");
while(r.next()){
out.println (r.getString (1) +"\t" + r.getString (2) + "\t" +r.getString (3));
conn.close();
} catch (Exception e) {
out.println("Wystapil problem z wyslaniem SQL do bazy danych: " + e.getMessage());
finally {
try { conn.close(); }
catch(SQLException e) {}
and here is code for JdbcCheckup.java (I get it from Internet and made some modifications):
* This sample can be used to check the JDBC installation.
* Just run it and provide the connect information. It will select
* "Hello World" from the database.
// You need to import the java.sql package to use JDBC
import java.sql.*;
// We import java.io to be able to read from the command line
import java.io.*;
class JdbcCheckup {
public static void main(String args[])
throws SQLException, IOException
// Load the Oracle JDBC driver
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
// Prompt the user for connect information
System.out.println("Please enter information to test connection to the database");
String user;
String password;
String database;
user = readEntry("user: ");
int slash_index = user.indexOf('/');
if (slash_index != -1)
password = user.substring(slash_index + 1);
user = user.substring(0, slash_index);
else
password = readEntry("password: ");
database = readEntry("database(a TNSNAME entry): ");
System.out.print("Connecting to the database...");
System.out.flush();
System.out.println("Connecting...");
//Connection conn = DriverManager.getConnection("jdbc:oracle:oci8:@" + database, user, password);
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@192.168.15.2:1521:" + database, user, password);
System.out.println("connected!!!");
// Create a statement
Statement stmt = conn.createStatement();
// Do the SQL "Hello World" thing
ResultSet rset = stmt.executeQuery("select 'Hello World' from dual");
while (rset.next())
System.out.println(rset.getString(1));
// close the result set, the statement and connect
rset.close();
stmt.close();
conn.close();
System.out.println("Your JDBC installation is correct.");
// Utility function to read a line from standard input
static String readEntry(String prompt)
try
StringBuffer buffer = new StringBuffer();
System.out.print(prompt);
System.out.flush();
int c = System.in.read();
while (c != '\n' && c != -1)
buffer.append((char)c);
c = System.in.read();
return buffer.toString().trim();
catch(IOException e) {
return "";
I use Java Web Service Developer Pack 1.0 on Win98 SE, database Oracle 8.1.7 is installed on dedicated IBM server (AIX 4.x).
I put these lines in autoexec.bat:
set PATH=C:\Perl\bin\;"C:\j2sdk1.4.0\bin";%PATH%
set CLASSPATH=.;C:\j2sdk1.4.0\lib\tools.jar;C:\j2sdk1.4.0\lib\classes12.zip;C:\j2sdk1.4.0\lib\classes111.zip;%CLASSPATH%
set CLASSPATH=C:\jwsdp_1_0\common\lib\servlet.jar;C:\jwsdp_1_0\common\lib\jasper-compiler.jar;C:\jwsdp_1_0\common\lib\jasper-runtime.jar;%CLASSPATH%
set JAVA_HOME=C:\j2sdk1.4.0
I have the same problem. I created a JSP page that uses a class to retrieve database information. I added a main method to the class so I would be able to test it. When I test the class using the main method the method returns all the information from the database. When I try it using Tomcat, I get the following error: java.lang.NoClassDefFoundError: oracle/jdbc/driver/OracleDriver
Does anyone have an idea of what is going on?
My CLASSPATH configuration is the same.
Similar Messages
-
hi,
I try a simple connect to a DB 9.2.0.1
through JDBC
$javac -d /home/oracle/jdbc Applet1.java
OK
but ...
oracle@pluto:/home/oracle/jdbc$ appletviewer -J-Djava.security.policy=mypolic>
java.lang.NoClassDefFoundError: oracle/jdbc/driver/OracleDriver
at mypackage.Applet1.connectToDB(Applet1.java:55)
at mypackage.Applet1.access$000(Applet1.java:17)
at mypackage.Applet1$1.actionPerformed(Applet1.java:41)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1
64)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstr
ctButton.java:1817)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonMode
.java:419)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:25
private void connectToDB(ActionEvent e) {
try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver())
con = DriverManager.getConnection ("jdbc:oracle:thin:@pluto:1521:DB
9IDEV","system","manger");
empValues.setText("Connected to the Database. Fetching Values from
TOTO Tables.\n");
fetchValues();
} catch (SQLException ex) {
System.out.println("Connection Error = " + ex.toString());
I tried with:
CLASSPATH=/tools/oracle/9.2.0/jdbc/lib/classes12.jar
and ( loaded from otn for JDK 1.4 and 9.2.0.1)
CLASSPATH=/tools/oracle/9.2.0/jdbc/lib/ojdbc14.jar
What I have to put in the CLASSPATH, please ???Please don't cross post.
http://forum.java.sun.com/thread.jsp?thread=541572&forum=57&message=2625798
http://forum.java.sun.com/thread.jsp?thread=541573&forum=48&message=2625800
http://forum.java.sun.com/thread.jsp?thread=541574&forum=31&message=2625802 -
Hi,
I am writing an application and am trying to open a connection to Oracle database that is on a server. I am using the following test code to check if it connects to the database.
import java.sql.*;
class dbAccess {
public static void main (String args []) throws SQLException
String DBurl = "jdbc:oracle:thin:@local:1522:DBORA";
String user = "test";
String pwd = "test123";
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection(DBurl, user, pwd);
}On running the above program I keep on getting the following error:
Error : java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
java.lang.NullPointerException
If I open the connection using JDeveloper wizard I can see the DB. But if running the above program in the JDev, JCreator or commandline keep on getting the error. Any help is appreciated. ThanksHow do I set the path for the Oracle Driver. ThanksI dunno. You're supposed to know where that class is (what jar it lives in). You set it up in JDeveloper in the first place, so you must have known where it is. After you know that, it's up to you to figure out how JCreator projects are set up to include jars in a project (just like JDeveloper projects do). For the command-line way, you set the classpath on the command-line arguments:
java -cp (your classpath here, which must include the jars it needs) ... -
Hello All,
I am writing this simple program which connects to Oracle DB ( 10.2 ). The Java version I have is 1.5.0_13 . I do have oracle client installed. When I run the below code ...I get error
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at OraThin.main(OraThin.java:13)The code I have is :
import java.io.*;
import java.sql.*;
public class OraThin {
public static void main(String[] args) {
try {
System.out.println(System.getProperty ("java.class.path") );
Connection con=null;
Class.forName("oracle.jdbc.driver.OracleDriver");
con=DriverManager.getConnection(
"jdbc:oracle:thin:@hostname:15282:ServiceName",
"scott",
"tiger");
Statement s=con.createStatement();
s.execute("SELECT SYSDATE FROM DUAL");
s.close();
con.close();
} catch(Exception e){e.printStackTrace();}
} Please suggest as to what am I missing, I am not that well versed with Java.
Thanks in advance,
SamHello Paul,
Thanks for you suggestion. Based on it , I did add the exact jar file in the PATH environmental variable in XP.
Path=C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar;C:\oraclexe\a
pp\oracle\product\10.2.0\server\bin;C:\oracle\product\10.2.0\client_1\bin;C:\Ora
cle\product\10.1.0\Client_1\bin;C:\Oracle\product\10.1.0\Client_1\jre\1.4.2\bin\
client;C:\j2sdk1.4.2_06\bin;Even after adding the specific jar file *("C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar")* ..I am getting the exact same error. moreover, to verify this I also tried to import import oracle.jdbc.driver.*.....and now my code would not even complie and I get error *(c:\Program Files\Java\jdk1.5.0_13\bin\OraThin.java:3: package oracle.jdbc.driver*
does not exist ) . I also rebooted my machine just to make sure ...that didnt work either. Also, I changed these jar to be first in the PATH varibale ..to avoid conflict with any later .jar's classes. The code is :
import java.io.*;
import java.sql.*;
import oracle.jdbc.driver.*;
public class OraThin {
public static void main(String[] args) {
try {
System.out.println(System.getProperty ("java.class.path") );
Connection con=null;
Class.forName("oracle.jdbc.driver.OracleDriver");
con=DriverManager.getConnection(
"jdbc:oracle:thin:@hostname:15282:ServiceName",
"scott",
"tiger");
Statement s=con.createStatement();
s.execute("SELECT SYSDATE FROM DUAL");
s.close();
con.close();
} catch(Exception e){e.printStackTrace();}
}What am I missing here!! ?
Thanks again,
Sam -
Hi!!!
I�m trying to execute a example program included in http://archive.coreservlets.com/, the file is FruitTest.java....this compile very well...but....when i tried to execute it i have the following error:
Error loading driver: java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
Could somebody tell me what i have to add to my classpath?...and how to know if i have to download something and in what link is it?......
Thanks in advance...
MaryHi mary,
Please try following code, but before that please include classes12.zip in ur classpath. This file contains the oracle thin driver.
Connection connection = null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:@dbUrl"
connection = DriverManager.getConnection(url, "dbName", "password");
}catch (Exception e){
e.printStackTrace();
good luck ...san :-) -
I am using JBuilder5 which comes with jdk1.3. I have installed oracle 8.1.7 Enterprise version.
I am using Win NT 4.0.
I have set the PATH variable as E:\oracle\ora81\lib; and
CLASSPATH as : E:\oracle\ora81\jdbc\lib\classes12.zip;E:\oracle\ora81\jdbc\lib\nls_charset12.zip;
My JDBC code is
package sample2;
import java.sql.*;
public class Two {
Connection con;
Statement st;
public Two() {
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("jdbc:oracle:oci8:@First","scott","tiger");
st = con.createStatement();
ResultSet rs = st.executeQuery("Select * from Book");
while(rs.next())
System.out.print(rs.getInt("ID")+"\t");
System.out.print(rs.getString("title")+"\t");
System.out.print(rs.getString("author")+"\t");
System.out.print(rs.getString("subject")+"\t");
System.out.println(rs.getInt("copies")+"\t");
st.close();
con.close();
catch(Exception ex)
System.out.println("Exception : " + ex.toString());
public static void main(String[] args) {
Two two1 = new Two();
I am getting this exception:
Exception : java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
I can understand that the classpath for the driver is the problem here.
Also, I tried to run this file without JBuilder as a independent file on a notepad. Even then this exception is thrown.
I have set the PATH to E:\oracle\ora81\bin and also to E:\oracle\ora81\lib.
I ran "echo %classpath%" from my command prompt and this is what i am getting.
E:\JBuilder5\jdk1.3\lib\tools.jar;E:\JBuilder5\jdk1.3\dt.jar;E:\oracle\ora81\jdbc\lib\classes12.zip;E:
\oracle\ora81\jdbc\lib\nls_charset12.zip;
I searched solution for this probldem in Sun JDC Forum itself. Many of them suggested to unzip classes12.zip and create jar file and add it in the classpath. Alos, some have suggested to copy the classes12.zip in home directory and then include this path in the classpath. I tried those solutions also. But, nothing seem to work.
Somebody help me fix this problem.
Thanks in advance.Jbuilder5 uses a different means of loading dependent classes. Use menu : Tools -->Configure Libraries - Click New and setup a new named library that points to classes12.zip .
Then include this in u'r required Libraries of your project using menu Project --> Project Properties - required Libraries tab.
I don't thnk Jbuilder5 even refers to CLASSPATH set in Windows NT environement. Path may need to be set to include oracle/ora81/bin directory though.
Hope this helps. -
Java.lang.NoClassDefFoundError: oracle/jdbc/OracleDriver
I am trying to connect from a servlet running in Tomcat on my desktop to an instance of Personal Oracle9i running on my desktop. I am gettiung NoClassDefFoundError. The code compiles.
I know it is a path issue but I am at a loss to figure out where. Tomcat does not find the driver however it is in my machines path.
Running following:
j2sdk1.4.1_02
Personal Oracle 9.2
Tomcat 4.1.29
Windows XP
I have added the location of Classes12.zip to the class path: .;c:\Sun\AppServer\lib\j2ee.jar;c:\Sun\AppServer\lib\j2ee-svc.jar;d:\oracle\ora92\jdbc\lib\classes12.zip;
The "root cause" of error is:
java.lang.NoClassDefFoundError: oracle/jdbc/OracleDriver
at OOP.OracleConnectionDemo.doPost(OracleConnectionDemo.java:34)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
The code is as follows:
import java.sql.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import oracle.jdbc.OracleDriver;
//import oracle.jdbc.driver.*; //did not work either
public class OracleConnectionDemo extends HttpServlet {
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException{
Connection con = null;
// Load the Oracle JDBC driver
try{
//two versions did not work
//DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver);
DriverManager.registerDriver(new OracleDriver());
con = DriverManager.getConnection
("jdbc:oracle:thin:@micron.1521:MCAP","scott","scott");
catch (SQLException e){
catch (Exception e){
finally{
try{
if (con != null)
con.close();
catch(SQLException ignored){
}//finally
}What you should be realizing is that Tomcat doesn't give a hoot about your system CLASSPATH. It totally ignores it. You really shouldn't even have one, because IDEs and app servers don't even take it into account. Get rid of it.
You're making lots of mistakes here:
(1) The Tomcat docs explicitly state that it won't look inside ZIP files. Change it to a JAR file.
(2) You're using JDK 1.4.1 and classes12.zip? You realize, of course, that there's an ojdbc14.jar available for download from Oracle. Go get it.
(3) Put the JDBC JAR in the WEB-INF/lib directory of your Web app. If you don't have one, you're not deploying your Web app properly.
(4) You've got Java code with empty catch blocks? That's one of the most foolish things a person can do. If an exception's thrown you'll never know it. For goodness sake, at least print the stack trace.
(5) Why do you have those Oracle imports? That ties your code to Oracle. The design of the java.sql package lets you use interfaces. Why don't you write JDBC the way it was meant to be written?
(6) Why aren't you setting up a JNDI data source?
% -
I am evaluating the sun RI of javax.sql package . I downloaded the jdbc_rowset_tiger-1_0_1-mrel-jwsdp.zip package and installed in my machine.
I tried the JdbcRowSet implmenation and it worked pretty smooth. I wanted to try the disconnected Rowset implementation. I tried CachedRowSet Implementation with thin driver. I get the following error message.
Exception in thread "main" java.lang.AbstractMethodError: oracle.jdbc.driver.OracleDatabaseMetaData.locatorsUpdateCopy()Z
at com.sun.rowset.CachedRowSetImpl.execute(Unknown Source)
at com.sun.rowset.CachedRowSetImpl.execute(Unknown Source)
at CachedRowSetSampl.main(CachedRowSetSampl.java:79)
I am using thin driver with Oracle8i db.
Appreciate any early responsesI had the same problem initially.
I fixed it by downloading an updated ojdbc14.jar (1).
It may be because I downloaded the ocrs12.jar from there a bit earlier and the versions of ojdbc14.jar and ocrs12.jar need to match (that is, come from the Oracle10g suite of jars).
Here is the class I used:
import java.sql.*;
import javax.sql.*;
import com.sun.rowset.WebRowSetImpl;
import com.sun.rowset.providers.RIXMLProvider;
public class test {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
WebRowSetImpl wrs = new WebRowSetImpl();
wrs.setCommand("select table_name from user_tables");
wrs.setUsername("scott");
wrs.setPassword("tiger");
wrs.setUrl("jdbc:oracle:thin:@paramount.com:1521:ORCL");
wrs.execute();
wrs.writeXml(System.out);
} catch (Exception e) {
System.out.println("Exception:"+e);
Dale(1) http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc101020.html (Oracle Database 10g JDBC Drivers) -
I have the following configuration:
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
on a Suse 10.1 Linux.
The javaversion is Java.Version = 1.4.2_11
The classpath does look like:
Eisele@brezn:~/FH-Weihenstephan/Winter_Semester_200809/Uebungen> echo $CLASSPATH
/derby.jar:/derbytools.jar:/derbynet.jar:/derbyclient.jar:/derbyTesting.jar:/local/derby/tools/java/jakarta-oro-2.0.8.jar:/derbyLocale_de_DE.jar:/derbyLocale_es.jar:/derbyLocale_fr.jar:/derbyLocale_it.jar:/derbyLocale_ja_JP.jar:/derbyLocale_ko_KR.jar:/derbyLocale_pt_BR.jar:/derbyLocale_zh_CN.jar:/derbyLocale_zh_TW.jar:/oracle/oracle/product/10.2.0/db_1/jdbc/lib/classes12.jar:/oracle/oracle/product/10.2.0/db_1/jdbc/lib/classes12.zip:/oracle/oracle/product/10.2.0/db_1/jlib/orai18n.jar:/oracle/oracle/product/10.2.0/db_1/jdbc/lib/ojdbc14.jar:/home/Eisele/Oracle/ojdbc14.jar:/home/Eisele/FH-Weihenstephan/Winter_Semester_200809/Uebungen
Eisele@brezn:~/FH-Weihenstephan/Winter_Semester_200809/Uebungen>
The Program JDBCVersion.java which I copied out of the Oracle-Documentation looks like:
import java.sql.*;
import oracle.jdbc.*;
import oracle.jdbc.pool.OracleDataSource;
class JDBCVersion
public static void main (String args[]) throws SQLException
System.out.println("Java.Version = " + System.getProperty("java.version")) ;
OracleDataSource ods = new OracleDataSource();
ods.setURL("jdbc:oracle:thin:scott/tiger@host:port:service");
Connection conn = ods.getConnection();
// Create Oracle DatabaseMetaData object
DatabaseMetaData meta = conn.getMetaData();
// gets driver info:
System.out.println("JDBC driver version is " + meta.getDriverVersion());
I get the following error
Eisele@brezn:~/FH-Weihenstephan/Winter_Semester_200809/Uebungen> javac JDBCVersion.java
Eisele@brezn:~/FH-Weihenstephan/Winter_Semester_200809/Uebungen> java -cp ~/FH-Weihenstephan/Winter_Semester_200809/Uebungen/ JDBCVersion
Java.Version = 1.4.2_11
Exception in thread "main" java.lang.NoClassDefFoundError: oracle/jdbc/pool/OracleDataSource
at JDBCVersion.main(JDBCVersion.java:10)
Eisele@brezn:~/FH-Weihenstephan/Winter_Semester_200809/Uebungen>
Can anyone help me out here and tell me, what I did wrong ?
Thanks in advance !
RüdigerTwo thoughts.
The first is that 10.2.0.1 is unpatched. Why? It has been two years since its release and no one has applied 10.2.0.2, 10.2.0.3 or 10.2.0.4.
The second is that your question is not a database question but a Java question is you are more likely to get an answer that will help you if you post in a group where it is on-topic. -
My compile works just fine: javac mail_create.java
but when I try to run I get OracleDriver error. Not sure how to fix this. Using RedHat Linux 7.3
[ora9ias@tautog classes]$ java mail_create
Error: java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriveroracle.j
dbc.driver.OracleDriver
[ora9ias@tautog classes]$ pwd
/home/oracle/9iAS/j2ee/home/default-web-app/WEB-INF/classes
[ora9ias@tautog classes]$
Some of my code...
import java.io.*;
import java.util.*;
import java.text.*;
import java.sql.*;
public class mail_create {
public static void main(String[] arguments) {
StringTokenizer st1;
int cnt1, cnt2, cnt3, cnt4, ival, newal;
String commabv, commemail, comabbrv, commca, commail;
String comcod []=new String [99];
String comvar []=new String [800];
String curabr []=new String [800];
String comail []=new String [800];
try {
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
.....http://search.java.sun.com/search/java/index.jsp?qt=%2Boracledriver+%2Bclassnotfoundexception&nh=10&qp=&rf=1&since=&country=&language=&charset=&variant=&col=javaforums
-
Hello.
I'm trying to detect if a row is the last one of a ResultSet (from a
executeQuery):
ResultSet results = sql.executeQuery();
if (results.isLast())
out.println("EMPTY");
But I get this error message:
Error 500
Servlet internal error:
java.lang.AbstractMethodError: oracle.jdbc.driver.OracleResultSet.isLast()Z
at estructura_10._jspService(mycode_10.java:93)
at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
What am I doing wrong?
Thank you very much.What do you want to do with a RS instead at least 1 next() ?
Only 1 next() - then you know, if it is empty.
If it's not empty, I assume you will do any retrieval, so you will have needed at least this first next(), don't you?
Even if you would like to skip the first row (though you have retrieved it), it would not be too much costs.
If you don't want to retrieve but only count your rows, do a query "SELECT COUNT(*) FROM table WHERE <your condition ...>".
However, to get the count you would have to do one - only one - next() call. -
I am using oracle 10.2.0.1.0. I can able to connect the database using sqlplus. I am executing some ant task. While running the ant script I am getting the following exception.
[java] INFO: Locale id is:1
[java] Oct 16, 2006 7:20:24 PM com.cramer.globalisation.resourcebundleloader.DataBaseMgr getLocaleI
d
[java] INFO: Using the default locale ID :1
[java] Oct 16, 2006 7:20:24 PM com.cramer.globalisation.resourcebundleloader.ResourceBundleReader l
oadPropertyFile
[java] INFO: .\html\homepages\thersholdhomepage\config\bundle\thersholdhomepage.properties is Crame
r resource bundle file
[java] java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.setSavepoint(Ljava/lang/Stri
ng;)Ljava/sql/Savepoint;
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:180)
[java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:710)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:178)
[java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:84)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[java] at org.apache.tools.ant.Task.perform(Task.java:364)
[java] at org.apache.tools.ant.Target.execute(Target.java:341)
[java] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[java] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
[java] at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.ja
va:37)
[java] at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
[java] at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
[java] at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:107)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[java] at org.apache.tools.ant.Task.perform(Task.java:364)
[java] at org.apache.tools.ant.Target.execute(Target.java:341)
[java] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[java] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
[java] at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
[java] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
[java] at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
[java] at org.apache.tools.ant.Main.runBuild(Main.java:668)
[java] at org.apache.tools.ant.Main.startAnt(Main.java:187)
[java] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
[java] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
[java] Caused by: java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.setSavepoint(Ljav
a/lang/String;)Ljava/sql/Savepoint;
[java] at com.cramer.globalisation.resourcebundleloader.DataBaseMgr.insertBundleRow(DataBaseMgr
.java:118)
[java] at com.cramer.globalisation.resourcebundleloader.ResourceBundleLoader.loadPropertyFiles(
ResourceBundleLoader.java:77)
[java] at com.cramer.globalisation.resourcebundleloader.ResourceBundleLoader.main(ResourceBundl
eLoader.java:47)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:324)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:202)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:134)
[java] ... 24 more
[java] --- Nested Exception ---
[java] java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.setSavepoint(Ljava/lang/Stri
ng;)Ljava/sql/Savepoint;
[java] at com.cramer.globalisation.resourcebundleloader.DataBaseMgr.insertBundleRow(DataBaseMgr
.java:118)
Can anyone help me in this issue?.....few of my colligue are using the same database, and
they are not getting these kind of error. Only my
system and 2 more system is giving these problem.
All of us are using the same version of oracle
only.I said driver not database.
>
Only I am and 2 more friends are getting the "
java.lang.AbstractMethodError:
oracle.jdbc.driver.T4CConnection.setSavepoint(Ljava/la
ng/String")
"And are you running the same exact code as everyone else?
Additionally you might want to check your class path to verify that only what is required is in that.
You haven't put anything in the ext directory have you? -
Hi,
I am using WSAD 4.0.3. While I am running application I am getting this error.
[10/5/02 13:26:17:984 GMT+08:00] 7a483a9b ExceptionUtil X CNTR0020E: Non-application exception occurred while processing method lodge on bean BeanId(CePAC#CePACEJB.jar#CfsControllerBean, f0b300abe8): java.lang.AbstractMethodError: oracle/jdbc/driver/OracleResultSet.getBlob
I have set the classpath i.e classes111.zip. This function is to insert record to a database having blob field.
Waiting for a quick response.java.lang.AbstractMethodErrorIn jdbc that often occurs because you are using a newer version of JDBC (the jvm) and an older driver. It occurs because you called a method which exists in the newer JDBC but does not exist in the older driver.
getBlob() was introduced in java 1.2, so it was not in JDBC 1.0. -
Hi Techies,
I am trying to write the jdbc code which is independent to database. I am trying to access the clob datatype for oracle n mysql.
But I am getting the following xception
javax.servlet.ServletException: oracle.jdbc.driver.OracleResultSetImpl.getClob(Ljava/lang/String;)Ljava/sql/Clob;
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:830)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:763)
org.apache.jsp.htmls.jsps.RuleManagement_jsp._jspService(RuleManagement_jsp.java:461)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:105)
javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:336)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:251)
javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
sun.reflect.GeneratedMethodAccessor83.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)Here is my code
if (dataType.equals("CLOB")) {
System.out.println("inside if");
oracle.sql.CLOB expressionClob = (oracle.sql.CLOB) rs
.getClob("EXPRESSION");
System.out.println("inside");
long clobLenLong = expressionClob.length();
int clobLenInt = (new Long(clobLenLong)).intValue();
System.out.println( clobLenInt);
String expression = expressionClob.getSubString(1, clobLenInt);
else {
System.out.println("inside else");
msclob = MYSQLUtil.getBlobString((java.sql.Blob) rs
.getBlob("EXPRESSION"));
}Am i missing something in my code .
thanks,
Krishno ideas
-
My JSP works fine using Sun's JSWDK and Jakarta-Tomcat. I just started using WebSphere Application Server v3.5 and now my JSP blows up at "rs.getBigDecimal"
I'm using WebSphere v3.5, JDBC 2.0(classes102.zip), and JDK 1.2.2
What can I do to fix this?
Thanks,
Brian
nullHello Brian,
I am facing the same problem and with JSP only. So if you have solution pl let me know.
[email protected]
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Brian Stechly ([email protected]):
My JSP works fine using Sun's JSWDK and Jakarta-Tomcat. I just started using WebSphere Application Server v3.5 and now my JSP blows up at "rs.getBigDecimal"
I'm using WebSphere v3.5, JDBC 2.0(classes102.zip), and JDK 1.2.2
What can I do to fix this?
Thanks,
Brian <HR></BLOCKQUOTE>
null
Maybe you are looking for
-
Hi all, I am trying to parse a xml file using a jdom java code.This code works fine if I remove xmlns attribute in the root element.Please tell me how to fix this issue. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Xml <process name="CreateKBEn
-
How to add one second to a date time stamp
What is the proper syntax to add one second to a date/timestamp?
-
Similar to https://social.technet.microsoft.com/Forums/systemcenter/en-US/487234f4-9748-4f49-ab7b-ce523da4c500/publish-cloud-service-fails-from-visual-studio-2013-update-4-published-asset-entry-for-image but since the given answer provides no solutio
-
Journal Voucher with Description---URGENT
When i am loading Journal voucher template through FDQM, I am not able to View Description of each line in HFM. HFM displays same description entered in the first line of the Journal Voucher Template in all the line items of the Journal Voucher. How
-
Hi everyone! This is probably a silly question, but I'm trying to put together an app for the iphone and I've been looking at the 'page control' sample code (http://developer.apple.com/iphone/library/samplecode/PageControl/index.html) from the apple