Exception in thread "main" java.sql.SQLRecoverableException: Io exception:
When applying the 6678700 (12.1.1) Upgrade patch i am getting the below error.
Raised Sev 2 SR with Oracle and they requested to change the following following paramter and bounce the DB as well Listener and re-start the patch. Did the same but no luck. Please let us know if anyone faced similar issue and fix for this issue
Edit the sqlnet.ora and set the parameter:
SQLNET.INBOUND_CONNECT_TIME=0
Edit the listener.ora and set the parameter
connect_timeout_ = 0
============================================================================================================================================
adjava oracle.apps.ad.worker.AdJavaWorker "(DESCRIPTION=(LOAD_BALANCE=YES)(FAILOVER=YES)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=ihr45r)(PORT=31101)))(CONN
ECT_DATA=(SID=IHR45R)))" APPS ***** thin 4 /home/apps/ora_hr/IHR45R/apps/apps_st/appl/admin/adUtilMapNew.txt
Copyright (c) 2002 Oracle Corporation
Redwood Shores, California, USA
AD Java
Version 12.0.0
NOTE: You may not use this utility for custom development
unless you have written permission from Oracle Corporation.
Reading product information from file...
Reading language and territory information from file...
Reading language information from applUS.txt ...
Temporarily resetting CLASSPATH to:
"/home/apps/ora_hr/IHR45R/apps/apps_st/appl/ad/12.0.0/java/adjava.zip:/home/apps/ora_hr/IHR45R/apps/tech_st/10.1.3/appsutil/jdk/lib/dt.jar:/home/apps/ora_h
r/IHR45R/apps/tech_st/10.1.3/appsutil/jdk/lib/tools.jar:/home/apps/ora_hr/IHR45R/apps/tech_st/10.1.3/appsutil/jdk/jre/lib/rt.jar:/home/apps/ora_hr/IHR45R/app
s/apps_st/comn/java/lib/appsborg.zip:/home/apps/ora_hr/IHR45R/apps/tech_st/10.1.2/forms/java:/home/apps/ora_hr/IHR45R/apps/tech_st/10.1.2/forms/java/frmall.j
ar:/home/apps/ora_hr/IHR45R/apps/tech_st/10.1.2/jlib/ewt3.jar:/home/apps/ora_hr/IHR45R/apps/tech_st/10.1.2/j2ee/OC4J_BI_Forms/applications/formsapp/formsweb/
WEB-INF/lib/frmsrv.jar:/home/apps/ora_hr/IHR45R/apps/apps_st/comn/java/classes"
Calling /home/apps/ora_hr/IHR45R/apps/tech_st/10.1.3/appsutil/jdk/jre/bin/java ...
Exception in thread "main" java.sql.SQLRecoverableException: Io exception: Broken pipe
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:101)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:199)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:263)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:521)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:418)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:510)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:203)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:510)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at oracle.apps.ad.worker.AdJavaWorker.getAppsConnection(AdJavaWorker.java:1036)
at oracle.apps.ad.worker.AdJavaWorker.main(AdJavaWorker.java:276)
Caused by: java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:103)
at java.net.SocketOutputStream.write(SocketOutputStream.java:147)
at oracle.net.ns.DataPacket.send(DataPacket.java:150)
at oracle.net.ns.NetOutputStream.flush(NetOutputStream.java:180)
at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:169)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:117)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:92)
============================================================================================================================================
Thanks and Regards,
Jagadeesha
Hi ,
Thanks for our prompt response.
After following Oracle Recommendation same error getting no improvement.
Below is the alert log error.
================================================================================================
Fatal NI connect error 12170.
VERSION INFORMATION:
TNS for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
TCP/IP NT Protocol Adapter for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
Oracle Bequeath NT Protocol Adapter for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
Time: 01-NOV-2012 11:02:37
Tracing not turned on.
Tns error struct:
ns main err code: 12535
TNS-12535: TNS:operation timed out
ns secondary err code: 12606
nt main err code: 0
nt secondary err code: 0
nt OS err code: 0
Client address: (ADDRESS=(PROTOCOL=tcp)(HOST=10.16.0.194)(PORT=61100))
WARNING: inbound connection timed out (ORA-3136)
Thu Nov 01 11:02:45 2012
==============================================================================================
Let me know how to check the processes we have 8 CPU and running with distrubed mode with 32 worker with each server 16.
Let me know what i need to check in the /etc/hosts file.
Thanks,
Jagadeesha
Similar Messages
-
Exception in thread "main" java.sql.SQLException: Io exception: Connection
Hello
I created a java program to connect to a oracle database 10g
I got the following error:
Exception in thread "main" java.sql.SQLException: Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=153093632)(ERR=12514)(ERROR_STACK=(ERROR=(CODE=12514)(EMFI=4))))
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:334)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:418)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:521)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:325)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at dbAccess.main(dbAccess.java:10)
here the code
import java.sql.*;
class dbAccess {
public static void main (String args []) throws SQLException
if (args.length<=0) {System.out.println("You need to provide the user and password");System.exit(0);}
DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection
("jdbc:oracle:thin:@dathvader2003:1521:orcl", args[0], args[1]);
// @machineName:port:SID, userid, password
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select BANNER from SYS.V_$VERSION");
while (rset.next())
System.out.println (rset.getString(1)); // Print col 1
stmt.close();
Any helps?
Many thanksThis is the exactly code
import java.io.PrintStream;
import java.sql.*;
import oracle.jdbc.driver.OracleDriver;
class dbAccess
dbAccess()
public static void main(String args[])
throws SQLException
if(args.length <= 0)
System.out.println("You need to provide the user and password");
System.exit(0);
DriverManager.registerDriver(new OracleDriver());
Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@dathvader2003:1521:orcl", args[0], args[1]);
Statement statement = connection.createStatement();
for(ResultSet resultset = statement.executeQuery("select BANNER from SYS.V_$VERSION"); resultset.next(); System.out.println(resultset.getString(1)));
statement.close();
} -
Hi Everyone,
I am Using This Code to read the Mail from server and inserting those into database but i am getting error like
import java.io.*;
import java.util.*;
import javax.mail.*;
import java.sql.*;
public class ReadMail_OLD {
static StringBuffer s= new StringBuffer();
static StringBuffer s1= new StringBuffer();
public static void main(String args[]) throws Exception {
String host = "***.****.co.in";
String user = "***@***.**.**";
String password = "******";
String Message_2000 = new String();
String Message_2001 = new String();
Connection conn;
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection("jdbc:oracle:thin:@1.2.3.5:1050:abcgdb", "abc", "efg");
Statement stm = conn.createStatement();
String strsql = "insert into READ_MAIL_MSG (MESSAGE_ID,SENT_DATE,MAIL_FROM,MAIL_TO,MAIL_SUBJECT,MESSAGE) values (" ;
// Get system properties
Properties properties = System.getProperties();
// Get the default Session object.
Session session = Session.getDefaultInstance(properties);
// Get a Store object that implements the specified protocol.
Store store = session.getStore("pop3");
//Connect to the current host using the specified username and password.
store.connect(host, user, password);
//Create a Folder object corresponding to the given name.
Folder folder = store.getFolder("inbox");
// Open the Folder.
folder.open(Folder.READ_ONLY);
Message[] message = folder.getMessages();
// Display message.
for (int i = 0; i < message.length; i++)
//System.out.println("------------ Message " + (i + 1) + " ------------");
//System.out.println("SentDate : " + message.getSentDate());
//System.out.println("From : " + message[i].getFrom()[0]);
//System.out.println("Subject : " + message[i].getSubject());
//System.out.print("Message : ");
InputStream stream = message[i].getInputStream();
int j = 0;
Message_2000 = "";
Message_2001 = "";
while(stream.available()>0 && j < 500)
// read the byte and convert the integer to character
s.append((char) stream.read());
j = j+1;
Message_2000 = s.toString();
Message_2001 = Message_2000.replace("'"," ");
System.out.println(strsql+"'"+(i + 1)+"','"+message[i].getSentDate()+"','"+message[i].getFrom()[0]+"','***@***.co.in','"+message[i].getSubject()+"','"+s.toString()+"')");
stm.execute(strsql+"'"+(i + 1)+"','"+message[i].getSentDate()+"','"+message[i].getFrom()[0]+"','***@****.co.in','"+message[i].getSubject()+"','"+Message_2001+"')");
folder.close(true);
store.close();
when i execute this some messages get inserted into table but for some messages
Exception in thread "main" java.sql.SQLException: ORA-01704: string literal too long
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:582)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1983)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1141)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2149)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:2032)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2894)
at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:942)
at ReadMail_OLD.main(ReadMail_OLD.java:64)
Edited by: 997089 on May 1, 2013 9:29 PM
Edited by: 997089 on May 1, 2013 9:30 PMHi All,
Thanks for Your Reply .
I got the answer i have made a mistake in loop after every iteration i have not cleared the stringBuffer Varaible so the after one or two iteration it givesthe error.
import java.io.*;
import java.util.*;
import javax.mail.*;
import java.sql.*;
public class ReadMail_OLD {
static StringBuffer s= new StringBuffer();
static StringBuffer s1= new StringBuffer();
public static void main(String args[]) throws Exception {
String host = "***.****.co.in";
String user = "***@***.**.**";
String password = "******";
String Message_2000 = new String();
String Message_2001 = new String();
Connection conn;
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection("jdbc:oracle:thin:@1.2.3.5:1050:abcgdb", "abc", "efg");
Statement stm = conn.createStatement();
String strsql = "insert into READ_MAIL_MSG (MESSAGE_ID,SENT_DATE,MAIL_FROM,MAIL_TO,MAIL_SUBJECT,MESSAGE) values (" ;
// Get system properties
Properties properties = System.getProperties();
// Get the default Session object.
Session session = Session.getDefaultInstance(properties);
// Get a Store object that implements the specified protocol.
Store store = session.getStore("pop3");
//Connect to the current host using the specified username and password.
store.connect(host, user, password);
//Create a Folder object corresponding to the given name.
Folder folder = store.getFolder("inbox");
// Open the Folder.
folder.open(Folder.READ_ONLY);
Message[] message = folder.getMessages();
// Display message.
for (int i = 0; i < message.length; i++)
//System.out.println("------------ Message " + (i + 1) + " ------------");
//System.out.println("SentDate : " + message.getSentDate());
//System.out.println("From : " + message.getFrom()[0]);
//System.out.println("Subject : " + message.getSubject());
//System.out.print("Message : ");
InputStream stream = message.getInputStream();
int j = 0;
Message_2000 = "";
Message_2001 = "";
while(stream.available()>0 && j < 500)
// read the byte and convert the integer to character
s.append((char) stream.read());
j = j+1;
Message_2000 = s.toString();
Message_2001 = Message_2000.replace("'"," ");
System.out.println(strsql+"'"+(i + 1)+"','"message.getSentDate()"','"message.getFrom()[0]"','***@****.co.in','"message.getSubject()"','"s.toString()"')");
stm.execute(strsql+"'"+(i + 1)+"','"message.getSentDate()"','"message.getFrom()[0]"','***@****.co.in','"message.getSubject()"','"Message_2001"')");
s.delete(0, s.length());
folder.close(true);
store.close();
Thanks for Reply
Edited by: 997089 on May 1, 2013 9:28 PM
Edited by: 997089 on May 1, 2013 9:30 PM -
Exception in thread "main" java.sql.SQLException: ORA-00604
Just tried to compile the code "Example 2-1 Determing the JDBC Driver Version" from "2day plus Java Developoer Guide"..
import java.sql.*;
import oracle.jdbc.*;
import oracle.jdbc.pool.OracleDataSource;
public class JDBCVersion
public static void main (String args[]) throws SQLException
OracleDataSource ods = new OracleDataSource();
ods.setURL("jdbc:oracle:thin:hr/hr@localhost:1521/XE");
Connection conn = ods.getConnection();
// Create Oracle DatabaseMetaData object
DatabaseMetaData meta = conn.getMetaData();
// gets driver info:
System.out.println("JDBC driver version is " + meta.getDriverVersion());
So, when I have to execute this programm:
Exception in thread "main" java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1
ORA-12705: Cannot access NLS data files or invalid environment specified
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:283)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:278)
at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOauth(T4CTTIoauthenticate.java:785)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:362)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:297)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:221)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:165)
at oracle.JDBCVersion.main(JDBCVersion.java:12)
Pls, help me w/that. TNX.Hi,
I remember it also doesn't work for me. Try this:
DriverManager.getConnection("jdbc:oracle:thin:@<mc-name>:<port-no>:<sid>", "scott", "tiger");
Kuba -
Exception in thread "main" java.sql.SQLException:
when i run the JdbcTest.java program happen this:
C:\temp>javac JdbcTest.java
C:\temp>java -cp .;C:\oracle\ora81\jdbc\lib\classes111.zip JdbcTest
Exception in thread "main" java.sql.SQLException: Eccezione IO: Connection refus
ed(DESCRIPTION=(TMP=)(VSNNUM=135290880)(ERR=12500)(ERROR_STACK=(ERROR=(CODE=1250
0)(EMFI=4))(ERROR=(CODE=12560)(EMFI=4))(ERROR=(CODE=530)(EMFI=4))(ERROR=(BUF='32
-bit Windows Error: 2: No such file or directory'))))
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
va)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at JdbcTest.main(JdbcTest.java:12)
the sample code is this>
import java.sql.*;
class JdbcTest {
public static void main (String args []) throws SQLException {
// Load Oracle driver
DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
// Connect to the local database
Connection conn =
DriverManager.getConnection ("jdbc:oracle:thin:@pcserver:1521:PIRELLI",
"vetture", "vetture");
// Query the employee names
Statement stmt = conn.createStatement ();
ResultSet rset = stmt.executeQuery ("select a from pippo");
// Print the name out
while (rset.next ())
System.out.println (rset.getString (1));
-------please halp mewhat u say is correct becouse if i use another db-oracle
and for use it i change the host, the port and sid, it works.
DriverManager.getConnection ("jdbc:oracle:thin:@ULISSE:1651:APIS",
"vetture", "vetture");
and in this case the database is on another machine.
if i try with :
DriverManager.getConnection ("jdbc:oracle:thin:@pcserver:1521:PIRELLI",
"vetture", "vetture");
doesn't work, but i can read from the database with another product TOAD, so this meand the DB service is running, I can't undestand.
In any case thanks becouse now i know that the problem is not about classpath or sqlstatement, but is only about configuration and service. -
I know this has been posted repeatedly. However, I have tried all the generic solutions Mine is a little different.
1. I can connect with SQLPLUS to the database. I am on windows XP connecting to Oracle 10g on a Solaris box. So the listener is running.
2. Here is my tnsnames.ora entry which works with SQLPLUS:
I can tnsping this address
SID_NAME =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = IP_NUMBER)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = SID_NAME)
)I am trying to run the following sample code:
* This sample shows how to list all the names from the EMP table
* It uses the JDBC THIN driver. See the same program in the
* oci8 samples directory to see how to use the other drivers.
package basic;
// You need to import the java.sql package to use JDBC
import java.sql.*;
class Employee
public static void main (String args [])
throws SQLException
// Load the Oracle JDBC driver
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
// Connect to the database
// You must put a database name after the @ sign in the connection URL.
// You can use either the fully specified SQL*net syntax or a short cut
// syntax as <host>:<port>:<sid>. The example uses the short cut syntax.
String url = "jdbc:oracle:thin:@IP_NAME:1521:SID_NAME";
String userName = "USERNAME";
String password = "PASSWORD";
if (args.length > 0) url = args[0];
if (args.length > 1) userName = args[1];
if (args.length > 2) password = args[2];
//Connection conn =
// DriverManager.getConnection (url, userName, password);
Connection conn =
DriverManager.getConnection("jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=IP_NUMBER:1521)(PORT=1521)))(CONNECT_DATA=(SID=SID_NAME)(SERVER=DEDICATED)))", "USERNAME", "PASSWORD");
// Create a Statement
Statement stmt = conn.createStatement ();
// Select the ENAME column from the EMP table
ResultSet rset = stmt.executeQuery ("select object_name from user_objects");
// Iterate through the result and print the employee names
while (rset.next ())
System.out.println (rset.getString (1));
}I also used the following IP
Connection conn =
DriverManager.getConnection (url, userName, password);Replace the url with
String url = "jdbc:oracle:thin:@IP_NUMBER:1521:SID_NAME"; -
Exception in thread "main" java.lang.NoClassDefFoundError: HW
I am very new to java. Tried to take the time to learn but got wrapped up in other things. Now I am back to learn and here is what I am getting. I don't know if it has anything to do with java required files being in a different directory or what. I have my java sdk files in C:\Program Files\Java\jre1.6.0_05\ and the source file is in C:\Java
Here is more information.
My Error at runtime:_
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp
My actions in the shell:_
C:\Java>javac HW.java
C:\Java>java HW
Exception in thread "main" java.lang.NoClassDefFoundError: HW
Caused by: java.lang.ClassNotFoundException: HW
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:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
My Source:_
* The HelloWorldApp class implements an application that
* simply prints "Hello World!" to standard output.
class HW {
public static void main(String[] args) {
System.out.println("Hello World!"); // Display the string.
}My Error at runtime:_
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp
Exception in thread "main" java.lang.NoClassDefFoundError: HW
Caused by: java.lang.ClassNotFoundException: HWO_o
That's two different errors.
Try to execute with:
java -cp . HW -
Here is my Java:
package classes.com.mattclark.hw;
import java.lang.*;
public class Hw {
private static Object mainClass = null;
private Short var1 = null;
public Hw(){
var1 = new Short("0");
System.out.println("| Class Name | Minimum Value | Maximum Value |");
System.out.println("----------------------------------------------------------------------------");
System.out.println("| " + rPad(var1.getClass().getName(), 20) +
" |" + lPad(String.valueOf(var1.MIN_VALUE), 24) +
" |" + lPad(String.valueOf(var1.MAX_VALUE), 24) +
" |" );
private String rPad(String initialString, int width) {
String returnString = null;
if(initialString.length() >= width) {
// truncate the string and return it
returnString = initialString.substring(0, width-1);
} else {
returnString = initialString;
for(int i=initialString.length(); i<width; i++) {
// pad the return string to the right
returnString = returnString.concat(" ");
return returnString;
private String lPad(String initialString, int width) {
String returnString = null;
if(initialString.length() >= width) {
// truncate the string and return it
returnString = initialString.substring(0, width-1);
} else {
returnString = new String("");
for(int i=initialString.length(); i<width; i++) {
// pad the return string to the right
returnString = returnString.concat(" ");
returnString = returnString.concat(initialString);
return returnString;
public static void main(String[] args) {
mainClass=new Hw();
} I have tried other solution from other "Exception in thread "main"" posts
I have tried all kinds of CLASSPATH's
My teacher said to use: Set CLASSPATH=D:\java3\hw\classesMy Error at runtime:_
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp
Exception in thread "main" java.lang.NoClassDefFoundError: HW
Caused by: java.lang.ClassNotFoundException: HWO_o
That's two different errors.
Try to execute with:
java -cp . HW -
I am getting the following exception described below:
Exception in thread "main" java.lang.NoClassDefFoundError: java/sql/Savepoint
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java, Compiled Code)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java, Compiled Code)
at java.net.URLClassLoader.defineClass(URLClassLoader.java, Compiled Code)
at java.net.URLClassLoader.access$1(URLClassLoader.java, Compiled Code)
at java.net.URLClassLoader$1.run(URLClassLoader.java, Compiled Code)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java, Compiled Code)
at java.lang.ClassLoader.loadClass(ClassLoader.java, Compiled Code)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java, Compiled Code)
at java.lang.ClassLoader.loadClass(ClassLoader.java, Compiled Code)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java, Compiled Code)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java, Compiled Code)
at java.sql.DriverManager.getConnection(DriverManager.java, Compiled Code)
at java.sql.DriverManager.getConnection(DriverManager.java, Compiled Code)
at source.UserCompileASLFromPatch.getConnection(UserCompileASLFromPatch.java, Compiled Code)
at source.UserCompileASLFromPatch.initialize(UserCompileASLFromPatch.java, Compiled Code)
at source.UserCompileASLFromPatch.main(UserCompileASLFromPatch.java, Compiled Code)
I am using java version "1.4.2_09" for the JDBC Connection. Is it the version problem or can be a problem specific to the code?hello debdatta
The JVM is unable to find the class. Just check ur driver class whether its included in the class path.
and its not getting the location of the file. The path where ur program is searching the class isnt there. so its the problem with ur path not the program. -
HELP Needed with this error: Exception in thread "main" java.lang.NoClass
Folks,
I am having a problem connecting to my MSDE SQL 2000 DB on a WindowsXP pro. environment. I am learning Java and writing a small test prgm to connect the the database. The code compiles ok, but when I try to execute it i keep getting this error:
"Exception in thread "main" java.lang.NoClassDefFoundError: Test1"
I am using the Microsoft jdbc driver and my CLASSPATH is setup correctly, I've also noticed that several people have complained about this error, but have not seen any solutions....can someone help ?
Here is the one of the test programs that I am using:
import java.sql.*;
* Microsoft SQL Server JDBC test program
public class Test1 {
public Test1() throws Exception {
// Get connection
DriverManager.registerDriver(new
com.microsoft.jdbc.sqlserver.SQLServerDriver());
Connection connection = DriverManager.getConnection(
"jdbc:microsoft:sqlserver://LAPTOP01:1433","sa","sqladmin");
if (connection != null) {
System.out.println();
System.out.println("Successfully connected");
System.out.println();
// Meta data
DatabaseMetaData meta = connection.getMetaData();
System.out.println("\nDriver Information");
System.out.println("Driver Name: "
+ meta.getDriverName());
System.out.println("Driver Version: "
+ meta.getDriverVersion());
System.out.println("\nDatabase Information ");
System.out.println("Database Name: "
+ meta.getDatabaseProductName());
System.out.println("Database Version: "+
meta.getDatabaseProductVersion());
} // Test
public static void main (String args[]) throws Exception {
Test1 test = new Test1();I want to say that there was nothing wrong
with my classpath config., I am still not sure why
that didn't work, there is what I did to resolved
this issue.You can say that all you like but if you are getting NoClassDefFound errors, that's because the class associated with the error is not in your classpath.
(For future reference: you will find it easier to solve problems if you assume that the problem is your fault, instead of trying to blame something else. It almost always is your fault -- at least that's been my experience.)
1. I had to set my DB connection protocol to TCP/IP
(this was not the default), this was done by running
the
file "svrnetcn.exe" and then in the SQL Server Network
Utility window, enable TCP/IP and set the port to
1433.Irrelevant to the classpath problem.
2. I then copied all three of the Microsoft JDBC
driver files to the ..\jre\lib\ext dir of my jdk
installed dir.The classpath always includes all jar files in this directory. That's why doing that fixed your problem. My bet is that you didn't have the jar file containing the driver in your classpath before, you just had the directory containing that jar file.
3. Updated my OS path to located these files
and....BINGO! (that simple)Unnecessary for solving classpath problems.
4. Took a crash course on JDBC & basic Java and now I
have created my database, all tables, scripts,
stored procedures and can read/write and do all kinds
of neat stuff.All's well that ends well. After a few months you'll wonder what all the fuss was about. -
Hi
I am trying to use type 4 driver to connect to my Oracle 9i Rel2 database. I downloaded the odbc14.jar from oracle and added in the C:\Oracle9i\jdbc\lib path. As on the website, I setup my environment:
Setting Up Your Environment
On Win95/Win98/NT:
- Add [ORACLE_HOME]\jdbc\lib\classes111.zip and
[ORACLE_HOME]\jdbc\lib\nls_charset11.zip to your CLASSPATH.
(Add classes12.zip and nls_charset12.zip if JDK 1.2.x or 1.3 is
used. Add ojdbc14.jar and nls_charset12.zip if JDK 1.4 is used.)
- Make sure [ORACLE_HOME]\bin is in your PATH.
Still I am getting the following error during runtime:
Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at jdbc.InsertQueryEx.main(InsertQueryEx.java:11)
Below is the source code:
import java.sql.*;
import java.io.*;
public class InsertQueryEx {
public static void main(String[] args)throws Exception{
Class.forName("oracle.jdbc.OracleDriver");
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@Prashy:1521:orcl", "scott", "tiger");
DataInputStream din = new DataInputStream(System.in);
Statement stmt = con.createStatement();
while(true){
try{
System.out.println("enter emp name");
String name = din.readLine();
System.out.println("enter emp no");
int no = Integer.parseInt(din.readLine());
System.out.println("enter emp salary");
float sal = Float.parseFloat(din.readLine());
System.out.println("enter emp address");
String addr = din.readLine();
int count = stmt.executeUpdate("insert into myemp values("+no+",'"+name+"',"+sal+",'"+addr+"')");
if(count>0)
System.out.println("Record added");
else
System.out.println("Failed");
catch (Exception e){
System.err.println("Exception: "+e.getMessage());
Any help is appreciated
Thanks
PrashantI am sorry but I did add those in the classpath but still getting this error:
This is what I have for user variable in classpath:
.;C:\Oracle9i\jdbc\lib\ojdbc14.jar;C:\Oracle9i\jdbc\lib\nls_charset12.jar
error is:
java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at jdbc.InsertQueryEx.main(InsertQueryEx.java:14)
Thanks -
DB:11.1.0.7
Oracle Apps:12.1.1
OS:RHEL Linux 4 86x64
Hi All,
On executing the following command on node 2 of TEST instance, we received the following error but did not find any such error messages in node 1
Notes: (1) Node 1 has java version:
java -version
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Server VM (build 11.0-b15, mixed mode)
(2) Node 2 has java version:
java -version
java version "1.4.2"
gcj (GCC) 3.4.6 20060404 (Red Hat 3.4.6-9)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Error message in node2:
On executing the following command on node 2 of TEST instance, we received the following error:
java oracle.jrad.tools.xml.importer.XMLImporter /tmp/custdocs/oracle/apps/pos/home/webui/customizations/site/0/PosHpgOrders.xml ....
/usr/bin/java: line 36: [: `)' expected, found -
Exception in thread "main" java.lang.VerifyError: verification failed at PC 152 in oracle.jdbc.driver.OracleDriver:registerMBeans(()V): String, int, or float constant expected
at JvBytecodeVerifier.verify_fail(byte, int) (/usr/lib64/libgcj.so.5.0.0)
at JvBytecodeVerifier.verify_instructions_0() (/usr/lib64/libgcj.so.5.0.0)
at JvVerifyMethod(_Jv_InterpMethod) (/usr/lib64/libgcj.so.5.0.0)
at JvPrepareClass(java.lang.Class) (/usr/lib64/libgcj.so.5.0.0)
at JvWaitForState(java.lang.Class, int) (/usr/lib64/libgcj.so.5.0.0)
at java.lang.VMClassLoader.linkClass0(java.lang.Class) (/usr/lib64/libgcj.so.5.0.0)
at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib64/libgcj.so.5.0.0)
at java.lang.Class.initializeClass() (/usr/lib64/libgcj.so.5.0.0)
at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/usr/lib64/libgcj.so.5.0.0)
at oracle.adf.mds.tools.util.ConnectUtils.getDBConnection(java.lang.String) (Unknown Source)
at oracle.jrad.tools.xml.importer.XMLImporter.importDocuments(java.lang.String[], java.sql.Connection) (Unknown Source)
at oracle.jrad.tools.xml.importer.XMLImporter.main(java.lang.String[]) (Unknown Source)
Could anyone please share such an issue faced before and provide resolution as to what's wrong in here in node 2?
Thanks for your time!
Regards,Hi,
(2) Node 2 has java version:
java -version
java version "1.4.2"Do you run this command as applmgr user? If yes, did you source the application env file?
Could anyone please share such an issue faced before and provide resolution as to what's wrong in here in node 2?Why the java version is different on the both nodes?
Thanks,
Hussein -
Problem about "Exception in thread "main" java.lang.NullPointerException"
This is t error message once i run the file
Exception in thread "main" java.lang.NullPointerException
at sendInterface.<init>(sendInterface.java:64)
at sendInterface.main(sendInterface.java:133)
* @(#)sendInterface.java
* @author
* @version 1.00 2008/7/18
import java.awt.BorderLayout;
import java.awt.Image;
import java.awt.GridLayout;
import java.awt.Panel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.DefaultListModel;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.ListModel;
import javax.swing.UIManager;
import javax.swing.SwingConstants;
import java.io.*;
import java.sql.*;
import java.net.*;
public class sendInterface /*implements ActionListener*/{
JFrame frame = new JFrame();
private Panel topPanel;
private Panel sendMessagePanel;
private Panel sendFilePanel;
private JLabel senderID;
private JLabel receiverID;
private JLabel senderDisplay;
private DefaultListModel receiverListModel = new DefaultListModel();
private JList receiverID_lst = new JList(receiverListModel);
private JRadioButton sendType;
String userName;
String[] userList = null ;
int i=0;
Connection con;
public sendInterface() {
String ListName;
try
JFrame.setDefaultLookAndFeelDecorated( true );
catch (Exception e)
System.err.println( "Look and feel not set." );
frame.setTitle( "Send Interface" );
topPanel.setLayout( new GridLayout( 2 , 1 ) ); //line 64*************************
senderID = new JLabel( "Sender:", SwingConstants.LEFT );
senderDisplay = new JLabel( "'+...+'", SwingConstants.LEFT );
receiverID = new JLabel( "Receiver:", SwingConstants.LEFT);
// receiverID_lst = new JList( ListName );
frame.add(senderID);
frame.add(senderDisplay);
frame.add(receiverID);
// frame.add(receiverListModel);
frame.add(new JScrollPane(receiverID_lst), BorderLayout.CENTER);
frame.setLocation(200, 200);
frame.setSize(250, 90);
frame.setVisible(true);
public void setListName(String user)
try{
userName = user;
Class.forName("com.mysql.jdbc.Driver");
String url = "jdbc:mysql://localhost:3306/thesis";
con = DriverManager.getConnection(url, "root", "");
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet rs = stmt.executeQuery("select * from user where User_ID!= '" + userName + "'");
System.out.println("Display all results:");
while(rs.next()){
String user_id = rs.getString("User_ID");
System.out.println("\tuser_id= " + user_id );
// receiverListModel.addElement(user_id);
userList=user_id;
i++;
}//end while loop
receiverListModel.addElement(userList);
catch(Exception ex)
ex.printStackTrace();
finally
if (con != null)
try
con.close ();
System.out.println ("Database connection terminated");
catch (Exception e) { /* ignore close errors */ }
public String getUserName()
return userName;
public String[] getUserList()
return userList;
public static void main(String[] args) {
new sendInterface(); //line 133******************************************
thank ur reply:D
Edited by: ocibala on Aug 3, 2008 9:54 AMAnd where do you instantiate topPanel before you invoke setLayout?
db -
Exception in thread "main" java.lang.NoClassDefFoundError: oracle/xml/parser/v2/
XSLException
Hi
I have downloaded XDK and was trying to use the XSU feature..
I unzipped the XDK file, I ran the following query on SQL plus
select * from emp. It displayed the full table.
Then i set the class path for XDK,XMLparserv2,oracle JDBC driver and then ran the same query on dos prompt(that is front end command line for java in my case).
The following is the line i tried to execute on the command prompt
java OracleXML getXML -user "scott/tiger" -conn "jdbc:oracle:thin:@localhost
:1521:PomonaT" "select * from emp"
PomonaT is the db name(Host string i use to enter SQL+)
I get the following error
Exception in thread "main" java.lang.NoClassDefFoundError: oracle/xml/parser/v2/
XSLException
at OracleXML.To_XML(OracleXML.java:1038)
at OracleXML.ExecuteGetXML(OracleXML.java:917)
at OracleXML.main(OracleXML.java:184)
IS SOMETHING MISSING IN MY CLASSPATH??
IF YES? Could anyone tell what??
KunalAdd xmlparserv2.jar to Classpath & reboot.
-
Exception in thread "main" java.lang.NullPointerException error JDeveloper 12c
Hello,
I am trying to call a java stored procedure in java application. I am using ORACLE database and JDeveloper.
I am getting error "Exception in thread "main" java.lang.NullPointerException. I have no idea what have I been doing wrong.
I have a table "Beer" and I want to select all the data out with a stored procedure which I call out of Java app.
I have a java.class file Store_A.java which I have loaded into the ORACLE database with LOADJAVA :
import java.sql.*;
import java.io.*;
public class Store_a {
public static void apskatit ()
throws SQLException
{ String sql =
"SELECT * FROM Beer";
try { Connection conn = DriverManager.getConnection("jdbc:default:connection:");
PreparedStatement pstmt = conn.prepareStatement(sql);
ResultSet rset = pstmt.executeQuery();
rset.close();
pstmt.close();
catch (SQLException e) {System.err.println(e.getMessage());
Then I have created a procedure which I plan to call out in java:
CREATE OR REPLACE PACKAGE Store_a AS
PROCEDURE apskatit;
END Store_a;
CREATE OR REPLACE PACKAGE BODY Store_a AS
PROCEDURE apskatit AS LANGUAGE JAVA
NAME 'Store_a.apskatit()';
END Store_a;
And I have a java file that I have created with JDeveloper 12c:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
public class Class1 {
* @param args
public static void main(String[] args) throws SQLException {
Connection conn = null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
//Izveidojam savienojumu
conn = DriverManager.getConnection("jdbc.oracle.thin:@localhost:1521", "SYSTEM", "asdasd");
// Izveidojam callable statement
CallableStatement stmt = conn.prepareCall("CALL Store_a.apskatit()");
ResultSet resul = stmt.executeQuery();
while (resul.next()) {
System.out.println(resul.getInt(1) + "\t" + resul.getString(2));
} catch (ClassNotFoundException e) {
e.printStackTrace();
} finally {
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
When I try to run the java file, I get this error "Exception in thread "main" java.lang.NullPointerException at client.Class1.main(Class1.java:29).
So the line I get error in is "conn.close();"
How to fix this?
Thank you very much in advance.I am trying to call a java stored procedure in java application. I am using ORACLE database and JDeveloper.
I am getting error "Exception in thread "main" java.lang.NullPointerException. I have no idea what have I been doing wrong.
Maybe you haven't read it yet but I told you in your other thread what you were doing wrong and, step by step, how to address the problem.
https://forums.oracle.com/thread/2611124
I'm not going to repeat everything again just this one main piece of advice:
Until you get you code working outside the database don't even bother trying to load it into the DB and create a Java stored procedure.
You are trying to deal with too many different issues at the same time. Unless you solve your primary Java problem by fixing the code outside the DB you will have nothing but problems loading it into the DB.
And just get rid of this line of code - you don't need it anymore and it hasn't been done like that for many years now:
Class.forName("oracle.jdbc.driver.OracleDriver");
Maybe you are looking for
-
OBIEE : Schedule a Publisher report
Hi, Is there any solution to schedule a report on BI Publisher ? Thanks in advance
-
HT201304 I can't in app purchases can some help me figure this out?
Everytime I try to make an in app purchese it keeps telling me that my purchase could not be completed. Is anyone else having this problem and if you are how do I fix it?
-
Where's the customer support????
Where's the customer support???? I have two purchased CC memberships and I am unable to access them. Waste of money. Someone please tell me how you can actually contact Adobe to solve things instead of forums that waste our time.
-
I can't forward emails from my hotmail account on my iPad.
Hi there. I'm hoping someone can help me. I can't forward emails from my hotmail account on my iPad. When I try to click on more it won't open up. Any ideas? Thanks in advance
-
While Front Row is playing music or other mp3 it shows the progress bar and the "album jacket" associated with the file. Every minute or so, the album jacket switches from one side of the screen to the other automatically. Is there a way to stop the