Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 10 of 10

Thread: java.lang.NoClassDefFoundError incompatible with

  1. #1
    Junior Member
    Join Date
    Nov 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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.
     
     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?


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,310
    Thanks
    56
    Thanked 2,373 Times in 2,344 Posts

    Default Re: java.lang.NoClassDefFoundError incompatible with

    Try uncommenting this to get the full error message without your edits:
    //e.printStackTrace();

  3. #3
    Junior Member
    Join Date
    Nov 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: java.lang.NoClassDefFoundError incompatible with

    Quote Originally Posted by Norm View Post
    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)

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,310
    Thanks
    56
    Thanked 2,373 Times in 2,344 Posts

    Default Re: java.lang.NoClassDefFoundError incompatible with

    ClassCastException
    Where is the casting done with these classes?
    NoClassDefFoundError
    SQLException

  5. #5
    Junior Member
    Join Date
    Nov 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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;
    Last edited by mackogacko; November 29th, 2011 at 08:24 AM.

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,310
    Thanks
    56
    Thanked 2,373 Times in 2,344 Posts

    Default Re: java.lang.NoClassDefFoundError incompatible with

    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?

  7. #7
    Junior Member
    Join Date
    Nov 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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.)

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,310
    Thanks
    56
    Thanked 2,373 Times in 2,344 Posts

    Default 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.

  9. #9
    Junior Member
    Join Date
    Nov 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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

  10. #10
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,310
    Thanks
    56
    Thanked 2,373 Times in 2,344 Posts

    Default Re: java.lang.NoClassDefFoundError incompatible with

    32 vs 64 bit - yet another complication in getting programs to work.

Similar Threads

  1. Java.lang.NoClassDefFoundError
    By mikedflip2006 in forum Exceptions
    Replies: 0
    Last Post: November 21st, 2011, 11:29 PM
  2. java.lang.NoClassDefFoundError
    By nrao in forum What's Wrong With My Code?
    Replies: 1
    Last Post: January 27th, 2011, 08:18 AM
  3. java.lang.NoClassDefFoundError
    By anonymous001 in forum What's Wrong With My Code?
    Replies: 8
    Last Post: January 26th, 2011, 04:41 PM
  4. Replies: 3
    Last Post: May 15th, 2010, 03:05 PM
  5. Replies: 1
    Last Post: October 25th, 2009, 12:54 PM