java.lang.NoClassDefFoundError incompatible with
Hi guys!
I wrote simple piece of code to connect to databse. It works fine under windows xp with eclipse and 32 bit java,
It is one class only. I copied it to AIX 5.3 64 bit with JDK6 64bit. Compiled it there, created java archive.
Code Java:
try {
String driver = "com.informix.jdbc.IfxDriver";
Class.forName(driver).newInstance();
System.out.println("Obtained Informix driver.");
} catch (Exception e) {
System.out.println("ERROR: Failed to load Informix driver." + e.getMessage());
logger.error("Failed to load Informix driver. " + e.getLocalizedMessage() );
logger.error( e.getMessage() );
e.printStackTrace();
return;
}
try {
System.out.println("Using url: " + url);
con = DriverManager.getConnection(url, user, password); // HERE I GET THAT EXCEPTION
System.out.println("Connected");
} catch (Exception e) {
System.out
.println("SQLException: Faild to connect using given url");
System.out.println("ERROR: " + e.getMessage());
logger.error("Faild to connect using given url: " + e.getLocalizedMessage() );
logger.error("bla: "+ e.getMessage() );
//e.printStackTrace();
}
When I try to execute it i get:
SQLException: Faild to connect using given url
ERROR: [HTML]java.lang.NoClassDefFoundError incompatible with java.sql.SQLException/B]
java.lang.NullPointerException
As far as i am concered that exception means that some class (java.sql.Connection from java6_64/jre/libs/sql.jar ) is hided by other class.
MY questions: 1. Is that true what i have written about meaning of that exception:)
2. If answer on previous question is true How to figure out which jar is it an where it is?
Re: java.lang.NoClassDefFoundError incompatible with
Try uncommenting this to get the full error message without your edits:
//e.printStackTrace();
Re: java.lang.NoClassDefFoundError incompatible with
Quote:
Originally Posted by
Norm
Try uncommenting this to get the full error message without your edits:
//e.printStackTrace();
Sure, this is full error message:
java.lang.ClassCastException: java.lang.NoClassDefFoundError incompatible with java.sql.SQLException
at com.informix.jdbc.IfxDriver.connect(IfxDriver.java :266)
at java.sql.DriverManager.getConnection(DriverManager .java:316)
at java.sql.DriverManager.getConnection(DriverManager .java:353)
at com.mmdata.reutersAdapters.ReutersAdapter.onInitia lization(ReutersAdapter.java:151)
at com.tibco.sdk.m.k(MAppImpl.java:498)
at com.tibco.sdk.MDefaultAppImpl.start(MDefaultAppImp l.java:132)
at com.tibco.sdk.MApp.start(MApp.java:221)
Re: java.lang.NoClassDefFoundError incompatible with
Quote:
ClassCastException
Where is the casting done with these classes?
NoClassDefFoundError
SQLException
Re: java.lang.NoClassDefFoundError incompatible with
I have no idea where i could do any casting...:(
Linie 151 is that one: con = DriverManager.getConnection(url, user, password);
I get the same error when I leave in that line only(delete con = ):
DriverManager.getConnection(url, user, password);
I tried also with password and user in url: DriverManager.getConnection(url); but it didnt work
I run it with following classpath:
java -classpath reutersAdapter3.jar:/dane/tibco/tibrv/8.3/lib/tibrvnative.jar:/dane/tibco/tibrv/8.3/lib/tibrvjweb.jar:/dane/tibco/tibrv/8.3/lib/tibrvj.jar:/dane/tibco/tibrv/8.3/lib/rvconfig.jar:/dane/tibco/tra/5.7/lib/TIBCrypt.jar:/dane/tibco/tra/5.7/lib/TIBCOxml.jar:/dane/tibco/tra/5.7/lib/TIBCOtsm.jar:/dane/tibco/tra/5.7/lib/TIBCOrt.jar:/dane/tibco/tra/5.7/lib/TIBCOjms.jar:/dane/tibco/adapter/sdk/5.8/lib/Maverick5.jar:/dane/tibco/macko/lib/ifxsqlj-1.4.2.jar:/dane/tibco/macko/lib/ifxtools-1.4.2.jar:/dane/tibco/macko/lib/mazovia-charset-1.0.jar:/dane/tibco/macko/lib/ifxjdbc-1.4.2.jar:/dane/tibco/macko/lib/ifxjdbcx-1.4.2.jar:/dane/tibco/macko/lib/ifxlang-1.4.2.jar:/dane/tibco/macko/lib/ifxlsupp-1.4.2.jar:/dane/tibco/macko/lib/log4j-1.2.8.jar com.mmdata.reutersAdapters.ReutersAdapter
My url is:
jdbc:informix-sqli://10.151.67.77:60010/slink:INFORMIXSERVER=test_online_shm;SECURITY=PASS WORD;CLIENT_LOCALE=pl_pl.57384;NEWCODESET=X-Mazovia,pl,57384;IFX_LOCK_MODE_WAIT=60;
Re: java.lang.NoClassDefFoundError incompatible with
Quote:
at com.informix.jdbc.IfxDriver.connect(IfxDriver.java :266)
From the error message.
Do you have the source for the IfxDriver class? What does it do at line 266 in its connect method?
Re: java.lang.NoClassDefFoundError incompatible with
I ve been searching on the web for two days to find source code of that jar.
When i unjar that ifxjdbc-1.4.2.jar there are already compiled classes, so cant read anything. (I know my explanation sounds lasy.)
Re: java.lang.NoClassDefFoundError incompatible with
If you could look at why there is that error on that line it might help you solve your problem.
I have no idea how to get that file.
Re: java.lang.NoClassDefFoundError incompatible with
Hi norum!
The problem was: I took jdbc drivers libs from windows, there were working fine on windows but not on 64 bit aIX.
The key factor was to know that current libs are in informix folder on AIX where jdbc driver was installed.
I took the libs from there, compiled under aix, made jar under iax, and that made me happy.
Thanks for helping me.
PS. And do not forget to read manuals:)
I CLOSE THAT THREAD
Re: java.lang.NoClassDefFoundError incompatible with
32 vs 64 bit - yet another complication in getting programs to work.