Exception in thread (JDBC for adabas D first use)
Dear my friends... I am developing a database application with Star Office, Adabas D, SuSE 8.2, Java and JDBC. This is my first experience in using JDBC and Adabas D. Usually I use PHP and MySQL. So please help me, I need many advices. I copy the adabasd.jar into the same directory where my application code (on Java language located). It is compiled successfully but it is not able to build a connection between my Adabas D and my application over JDBC. The error message is : " #prabu>java -classpath adabasd.jar konek Exception in thread "main" java.lang.NoClassDefFoundError : konek " The name of my code is "konek.java" after compiled it is "konek.class". Here is my code : " import java.sql.*; public class konek { public static void main(String[] args) { System.out.println("Hallo Indonesia"); try { Class.forName("de.sag.jdbc.adabasd.aDriver"); } catch (ClassNotFoundException e){ System.out.println("JDBC driver for Adabas D not found"); }; try { java.sql.Connection con = java.sql.DriverManager.getConnection("jdbc:adabasd://susefujitsu/prabusoft", "control", "duisburg"); } catch (java.sql.SQLException e) { System.out.println("Error " + e.getErrorCode() + " " + e.getMessage()); } } } " I don't know why it can not find the class whereas I've put the class (konek.class) on the command line to execute my compiled program. Please help. Thank you very much in advance. --------------------------------- Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month!
On Wednesday 02 July 2003 12:53, Prabu Subroto wrote:
Dear my friends...
I am developing a database application with Star Office, Adabas D, SuSE 8.2, Java and JDBC.
This is my first experience in using JDBC and Adabas D. Usually I use PHP and MySQL. So please help me, I need many advices.
I copy the adabasd.jar into the same directory where my application code (on Java language located). It is compiled successfully but it is not able to build a connection between my Adabas D and my application over JDBC. The error message is : " #prabu>java -classpath adabasd.jar konek Exception in thread "main" java.lang.NoClassDefFoundError : konek "
Whoops, that was pressing ctrl-enter too early :) anyways: You have to use the classpath "adabasd.jar:." This means you have to include the current dir (".") as well, seperated by a ":". Regards, -- tinus ___________________________________________________ "Words are weightless here on earth Because they're free." -- Josh Homme
Dear Tinus.
And for windows client which character should I use instead of ":."?
Because I found :
"
e:\prabu\kerja>java -classpath adabasd.jar:. konek
Exception in thread "main" java.lang.NoClassDefFoundError: konek
"
The "konek.class" and "adabasd.jar" are located under the same directory, namely : "e:\prabu\kerja". I simply copied the "adabasd.jar" into the directory.
What should I do now? Please help me.
Martijn Houtman
Dear my friends...
I am developing a database application with Star Office, Adabas D, SuSE 8.2, Java and JDBC.
This is my first experience in using JDBC and Adabas D. Usually I use PHP and MySQL. So please help me, I need many advices.
I copy the adabasd.jar into the same directory where my application code (on Java language located). It is compiled successfully but it is not able to build a connection between my Adabas D and my application over JDBC. The error message is : " #prabu>java -classpath adabasd.jar konek Exception in thread "main" java.lang.NoClassDefFoundError : konek "
You have to use the classpath "adabasd.jar:." This means you have to include the current dir (".' -- tinus ___________________________________________________ "Words are weightless here on earth Because they're free." -- Josh Homme % echo '[q]sa[ln0=aln256%Pln256/snlbx]sb3135071790101768542287578439snlbxq'|dc --------------------------------- Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month!
On Wednesday 02 July 2003 13:33, Prabu Subroto wrote:
And for windows client which character should I use instead of ":."? Because I found : " e:\prabu\kerja>java -classpath adabasd.jar:. konek Exception in thread "main" java.lang.NoClassDefFoundError: konek "
Oh, right, in windows it might be the character ; instead of :, not sure. Try using " around the classpath as well. Regards, -- tinus ___________________________________________________ "Words are weightless here on earth Because they're free." -- Josh Homme
Dear my friend, Martijn.
I tried this :
"
sag@susefujitsu:~/arsip> set
CLASSPATH="/usr/sag/aad/v1201/lib/adabasd.jar:/usr/sag/arsip/adabasd.jar"
sag@susefujitsu:~/arsip> java konek
Hallo Indonesia
JDBC driver for Adabas D not found
Error 0 No suitable driver
sag@susefujitsu:~/arsip>
"
But the location of the files are correct, see this
please:
"
sag@susefujitsu:~/arsip> ls
/usr/sag/aad/v1201/lib/adabasd.jar
/usr/sag/aad/v1201/lib/adabasd.jar
sag@susefujitsu:~/arsip> ls /usr/sag/arsip/adabasd.jar
/usr/sag/arsip/adabasd.jar
"
Here is my code:
"
import java.sql.*;
public class konek
{
public static void main(String[] args)
{
System.out.println("Hallo Indonesia");
try {
Class.forName("adabasd");
} catch (ClassNotFoundException e){
System.out.println("JDBC driver for Adabas D not
found");
};
try {
java.sql.Connection con =
java.sql.DriverManager.getConnection("jdbc:adabasd://localhost/prabusoft",
"control", "my_password");
} catch (java.sql.SQLException e) {
System.out.println("Error " + e.getErrorCode() + "
" + e.getMessage());
}
}
}
"
I am still confused. No clues yet absolutely. Please
help me.
Thank you very much in advance.
--- Martijn Houtman
On Wednesday 02 July 2003 13:33, Prabu Subroto wrote:
And for windows client which character should I use instead of ":."? Because I found : " e:\prabu\kerja>java -classpath adabasd.jar:. konek Exception in thread "main" java.lang.NoClassDefFoundError: konek "
Oh, right, in windows it might be the character ; instead of :, not sure. Try using " around the classpath as well.
Regards, -- tinus ___________________________________________________ "Words are weightless here on earth Because they're free." -- Josh Homme
-- To unsubscribe, email: suse-programming-e-unsubscribe@suse.com For additional commands, email: suse-programming-e-help@suse.com Archives can be found at: http://lists.suse.com/archive/suse-programming-e
__________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com
What if you run konek as: java -cp ".:/usr/sag/aad/v1201/lib/adabasd.jar" konek -- -- Verdi March --
Dear Verdi...
Then I found this error message:
"
sag@susefujitsu:~/arsip> set
CLASSPATH="/usr/sag/aad/v1201/lib/adabasd.jar:/usr/sag/arsip/adabasd.jar"
sag@susefujitsu:~/arsip> export
DBROOT="/usr/sag/aad/v1201"
sag@susefujitsu:~/arsip> java -cp
".:/usr/sag/aad/v1201/lib/adabasd.jar" konek
Hallo Prabu
JDBC driver for Adabas D not found
Error 0 No suitable driver
sag@susefujitsu:~/arsip> ls
AdabasD DokumentasiAdabasD adabasd.jar konek.class
konek.java nohup.out
sag@susefujitsu:~/arsip>
"
Here is my code my friends...
"
import java.sql.*;
public class konek
{
public static void main(String[] args)
{
System.out.println("Hallo Prabu");
try {
Class.forName("adabasd");
} catch (ClassNotFoundException e){
System.out.println("JDBC driver for Adabas D not
found");
};
try {
java.sql.Connection con =
java.sql.DriverManager.getConnection("jdbc:adabasd://127.0.0.1/mydb",
"control", "adabas");
} catch (java.sql.SQLException e) {
System.out.println("Error " + e.getErrorCode() + "
" + e.getMessage());
}
}
}
"
Please help me, Thank you very much my friend.
--- Verdi March
What if you run konek as: java -cp ".:/usr/sag/aad/v1201/lib/adabasd.jar" konek
--
-- Verdi March --
-- To unsubscribe, email: suse-programming-e-unsubscribe@suse.com For additional commands, email: suse-programming-e-help@suse.com Archives can be found at: http://lists.suse.com/archive/suse-programming-e
__________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com
What is the permission/ownership of adabasd.jar? Is it accessible by user "sag"? -- -- Verdi March --
Dear Verdi, Thank you for help. Please keep helping
me. I am still clueless now.
Here I have done:
sag@susefujitsu:~/arsip> export
DBROOT=/usr/sag/aad/v1201
sag@susefujitsu:~/arsip> set
CLASSPATH="/usr/sag/aad/v1201/lib/adabasd.jar:/usr/sag/arsip/adabasd.jar"
sag@susefujitsu:~/arsip> whoami
sag
sag@susefujitsu:~/arsip> ls -la
/usr/sag/arsip/adabasd.jar
-rwxrwxrwx 1 sag users 108944 2002-06-27
18:09 /usr/sag/arsip/adabasd.jar
sag@susefujitsu:~/arsip> ls -la
/usr/sag/aad/v1201/lib/adabasd.jar
-r--r--r-- 1 sag users 108944 2002-06-27
18:09 /usr/sag/aad/v1201/lib/adabasd.jar
sag@susefujitsu:~/arsip> chmod +777
/usr/sag/aad/v1201/lib/adabasd.jar
ag@susefujitsu:~/arsip> java -classpath
/usr/sag/aad/v1201/lib/adabasd.jar konek
Exception in thread "main"
java.lang.NoClassDefFoundError: konek
sag@susefujitsu:~/arsip>
The error message is still the same.
And here is my code:
import java.sql.*;
public class konek
{
public static void main(String[] args)
{
System.out.println("Hallo Prabu");
try {
Class.forName("de.sag.jdbc.adabasd.ADriver");
} catch (ClassNotFoundException e){
System.out.println("JDBC driver for Adabas D not
found");
};
try {
java.sql.Connection con =
java.sql.DriverManager.getConnection("jdbc:adabasd://127.0.0.1/MYDB",
"control", "adabas");
} catch (java.sql.SQLException e) {
System.out.println("Error " + e.getErrorCode() + "
" + e.getMessage());
}
}
}
Where is the mistake? Please help me.
--- Verdi March
What is the permission/ownership of adabasd.jar? Is it accessible by user "sag"?
--
-- Verdi March --
-- To unsubscribe, email: suse-programming-e-unsubscribe@suse.com For additional commands, email: suse-programming-e-help@suse.com Archives can be found at: http://lists.suse.com/archive/suse-programming-e
__________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com
Try to modify your catch block (both blocks) as: try (...) { ... } catch (...) { ... e.printStackTrace(); } Hopefully, the stack trace will give more information. -- -- Verdi March --
On Thursday 03 July 2003 19:34, Prabu Subroto wrote:
Exception in thread "main" java.lang.NoClassDefFoundError: konek
It seems that java is unable to find "konek". So here's what you need to verified: 1. You need to run java with [-cp ".:path_to_adabas_jar"] parameter. Notice the "." part? It instructs java to include current path when searching for classes. Without ".", you'll get "NoClassDefFOundError: konek". 2. With [-cp ".;path_to_adabass_jar"], from the previous mail, you got: Hallo Prabu JDBC driver for Adabas D not found Error 0 No suitable driver This means "konek" has been executed, but adabas jdbc driver can't be located. In your code, try to add e.printStackTrace() in both of the catch blocks, i.e try (...) { ... } catch (...) { .... e.printStackTrace(); } This will give more detail of the error. Hopefully you'll find something. 3. Make sure you're instantiating the correct class -- is it "adabas" or "de.sag.jdbc.adabasd.ADriver"? I tend to believe that it should be "de.sag.jdbc.adabasd.ADriver". 4. If everything has been verified, as the last resort, try to unzipping adabasd.jar (you can simply use unzip) to, say /tmp/haha/, then make sure that file /tmp/haha de/sag/jdbc/adabasd/ADriver.class exists. -- -- Verdi March --
Dear Verdi. Thank you very...very... much for your
furthered help.
It still doesn't give any change without I know why.
Here is my last try:
"
sag@susefujitsu:~/arsip> java -classpath
"/usr/sag/arsip/adabasd.jar:." konek
Exception in thread "main"
java.lang.NoClassDefFoundError:
com/softwareag/common/instrumentation/logging/LoggerFactory
at
de.sag.jdbc.adabasd.ADriver.<clinit>(ADriver.java:423)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:140)
at konek.main(konek.java:8)
sag@susefujitsu:~/arsip> java -classpath
".:/usr/sag/arsip/adabasd.jar" konek
Exception in thread "main"
java.lang.NoClassDefFoundError:
com/softwareag/common/instrumentation/logging/LoggerFactory
at
de.sag.jdbc.adabasd.ADriver.<clinit>(ADriver.java:423)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:140)
at konek.main(konek.java:8)
sag@susefujitsu:~/arsip>
"
The correct instance is :
"de.sag.jdbc.adabasd.ADriver".
Here is my current code:
===
import java.sql.*;
public class konek
{
public static void main(String[] args)
{
try {
Class.forName("de.sag.jdbc.adabasd.ADriver");
} catch (ClassNotFoundException e){
System.out.println("JDBC driver for Adabas D not
found");
e.printStackTrace();
}
try {
java.sql.Connection con =
java.sql.DriverManager.getConnection("jdbc:adabasd://127.0.0.1/MYDB",
"control", "adabas");
} catch (java.sql.SQLException e) {
System.out.println("Error " + e.getErrorCode() + "
" + e.getMessage());
e.printStackTrace();
}
}
}
--- Verdi March
On Thursday 03 July 2003 19:34, Prabu Subroto wrote:
Exception in thread "main" java.lang.NoClassDefFoundError: konek
It seems that java is unable to find "konek". So here's what you need to verified: 1. You need to run java with [-cp ".:path_to_adabas_jar"] parameter. Notice the "." part? It instructs java to include current path when searching for classes. Without ".", you'll get "NoClassDefFOundError: konek". 2. With [-cp ".;path_to_adabass_jar"], from the previous mail, you got: Hallo Prabu JDBC driver for Adabas D not found Error 0 No suitable driver This means "konek" has been executed, but adabas jdbc driver can't be located. In your code, try to add e.printStackTrace() in both of the catch blocks, i.e try (...) { ... } catch (...) { .... e.printStackTrace(); } This will give more detail of the error. Hopefully you'll find something.
3. Make sure you're instantiating the correct class -- is it "adabas" or "de.sag.jdbc.adabasd.ADriver"? I tend to believe that it should be "de.sag.jdbc.adabasd.ADriver".
4. If everything has been verified, as the last resort, try to unzipping adabasd.jar (you can simply use unzip) to, say /tmp/haha/, then make sure that file /tmp/haha de/sag/jdbc/adabasd/ADriver.class exists.
--
-- Verdi March --
-- To unsubscribe, email: suse-programming-e-unsubscribe@suse.com For additional commands, email: suse-programming-e-help@suse.com Archives can be found at: http://lists.suse.com/archive/suse-programming-e
__________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com
On Friday 04 July 2003 06:50, Prabu Subroto wrote:
Exception in thread "main" java.lang.NoClassDefFoundError: com/softwareag/common/instrumentation/logging/LoggerFactory at de.sag.jdbc.adabasd.ADriver.<clinit>(ADriver.java:423)
It seems this class: com.softwareag.common.instrumentation.logging.LoggerFactory couldn't be found. Are you sure the only required jar is adabas.jar? Have you tried to look into adabas.jar file, see if this file: com/softwareag/common/instrumentation/loggin/LoggerFactory.class exists? If not, then you clearly need another jar(s). -- -- Verdi March --
Hi Verdi... Thank you very much for your furthered
help. You are so generous...
Yeah, I found some other needed files. But it still
doesn't run properly. Here is my last try:
"
sag@susefujitsu:~> export
CLASSPATH=/usr/sag/aad/v1201/lib/adabasd.jar
sag@susefujitsu:~> export
CLASSPATH2=/usr/sag/aad/v1201/lib/instrumentation.jar
sag@susefujitsu:~> export
CLASSPATH3=/usr/sag/aad/v1201/lib/log4j.jar
sag@susefujitsu:~> export
CLASSPATH4=/usr/sag/aad/v1201/lib/jdbc2_0-stdext.jar
sag@susefujitsu:~> export DBROOT=/usr/sag/aad/v1201
sag@susefujitsu:~/arsip> pwd
/usr/sag/arsip
sag@susefujitsu:~/arsip> ls -la
total 119
drwxrwxrwx 6 sag root 288 2003-07-04
05:32 .
drwxr-xr-x 37 sag users 2280 2003-07-04
13:23 ..
drwxrwxrwx 4 sag root 96 2003-06-08
19:58 AdabasD
drwxrwxrwx 2 sag root 816 2003-07-04
03:46 DokumentasiAdabasD
drwxr-xr-x 2 sag users 80 2003-07-04
05:32 META-INF
-rwxrwxrwx 1 sag users 108944 2002-06-27
18:09 adabasd.jar
drwxr-xr-x 3 sag users 72 2003-07-04
05:32 de
-rw-r--r-- 1 sag users 1230 2003-07-04
06:20 konek.class
-rw-r--r-- 1 sag users 584 2003-07-04
06:19 konek.java
-rw------- 1 sag users 0 2003-07-03
08:17 nohup.out
sag@susefujitsu:~/arsip> java -classpath
$CLASSPATH:$CLASSPATH2:$CLASSPATH3:$CLASSPATH4:. konek
log4j:ERROR No appenders could be found for category
(com.softwareag.common.instrumentation.logging.Log4jLogger).
log4j:ERROR Please initialize the log4j system
properly.
Error 0 REMOTE-SQL SERVER MUST BE STARTED
java.sql.SQLException: REMOTE-SQL SERVER MUST BE
STARTED
at
de.sag.jdbc.adabasd.server.AServer.connect(server/AServer.java:94)
at
de.sag.jdbc.adabasd.AConnection.doServerConnect(AConnection.java:92)
at
de.sag.jdbc.adabasd.AConnection.<init>(AConnection.java:65)
at
de.sag.jdbc.adabasd.ADriver.connect(ADriver.java:158)
at
java.sql.DriverManager.getConnection(DriverManager.java:512)
at
java.sql.DriverManager.getConnection(DriverManager.java:171)
at konek.main(konek.java:13)
sag@susefujitsu:~/arsip>
"
Ufffhh.. please help me...
--- Verdi March
On Friday 04 July 2003 06:50, Prabu Subroto wrote:
Exception in thread "main" java.lang.NoClassDefFoundError:
com/softwareag/common/instrumentation/logging/LoggerFactory
at
de.sag.jdbc.adabasd.ADriver.<clinit>(ADriver.java:423)
It seems this class:
com.softwareag.common.instrumentation.logging.LoggerFactory
couldn't be found. Are you sure the only required jar is adabas.jar?
Have you tried to look into adabas.jar file, see if this file:
com/softwareag/common/instrumentation/loggin/LoggerFactory.class
exists? If not, then you clearly need another jar(s).
--
-- Verdi March --
-- To unsubscribe, email: suse-programming-e-unsubscribe@suse.com For additional commands, email: suse-programming-e-help@suse.com Archives can be found at: http://lists.suse.com/archive/suse-programming-e
__________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com
On Friday 04 July 2003 20:10, Prabu Subroto wrote:
sag@susefujitsu:~/arsip> java -classpath $CLASSPATH:$CLASSPATH2:$CLASSPATH3:$CLASSPATH4:. konek log4j:ERROR No appenders could be found for category (com.softwareag.common.instrumentation.logging.Log4jLogger). log4j:ERROR Please initialize the log4j system properly.
This one seems to be log4j errors. Can't help you with this one, as I've never used log4j before...
Error 0 REMOTE-SQL SERVER MUST BE STARTED java.sql.SQLException: REMOTE-SQL SERVER MUST BE STARTED at de.sag.jdbc.adabasd.server.AServer.connect(server/AServer.java:94)
This, I think, is related to the previous exceptions. You could try http://jakarta.apache.org/log4j/index.html as the starting point. -- -- Verdi March --
Dear Tinus...
It still doesn't work.
Here is my last try:
"
sag@susefujitsu:~/arsip> java -classpath
".:/usr/sag/arsip/adabasd.jar" konek
Exception in thread "main"
java.lang.NoClassDefFoundError:
com/softwareag/common/instrumentation/logging/LoggerFactory
at
de.sag.jdbc.adabasd.ADriver.<clinit>(ADriver.java:423)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:140)
at konek.main(konek.java:8)
sag@susefujitsu:~/arsip>
"
And here is my code:
"
import java.sql.*;
public class konek
{
public static void main(String[] args)
{
try {
Class.forName("de.sag.jdbc.adabasd.ADriver");
} catch (ClassNotFoundException e){
System.out.println("JDBC driver for Adabas D not
found");
e.printStackTrace();
}
try {
java.sql.Connection con =
java.sql.DriverManager.getConnection("jdbc:adabasd://127.0.0.1/MYDB",
"control", "adabas");
} catch (java.sql.SQLException e) {
System.out.println("Error " + e.getErrorCode() + "
" + e.getMessage());
e.printStackTrace();
}
}
}
"
What should I do now? Please tell me...
--- Martijn Houtman
Oh, right, in windows it might be the character ; instead of :, not sure. Try using " around the classpath as well.
Regards, -- tinus ___________________________________________________ "Words are weightless here on earth Because they're free." -- Josh Homme
__________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com
participants (3)
-
Martijn Houtman
-
Prabu Subroto
-
Verdi March