Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Java connecting to Oracle problem

Options
  • 26-02-2009 6:33pm
    #1
    Registered Users Posts: 23,212 ✭✭✭✭


    I have a jar file that is invoked with various parameters, including username, password and database name. It is in a Windows batch file wrapper.

    Command line is:

    [PHP]java -jar -Xms256m -Xmx256m c:\conversion\Conversion.jar 1 20000 <username> <password> <database name> N Y >> c:\conversion\conversion.log 2>&1

    [/PHP]

    The jar appears to have trouble connecting to the database, giving the following error:

    Exception in thread "main" Start time is: 17:14:53
    java.lang.NoClassDefFoundError: java/sql/Savepoint
    at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at com.conv.conversion.JDBCConnection.connect(JDBCConnection.java:20)
    at com.conv.conversion.Reader.initialise(Reader.java:25)
    at com.conv.conversion.Conversion.<init>(Conversion.java:27)
    at com.conv.conversion.Conversion.main(Conversion.java:82)
    Exception in thread "main"

    Any ideas where to start? Not too hot on java..... :(

    Some background on this - it was working on a different machine, which broke, copied over to a new machine and now doesn't work. This suggests to me the environment is different in some way.


Comments

  • Registered Users Posts: 66 ✭✭bala


    I suspect that the version of Java is different in both the machines. The new Machine has newer version of Java. Do you have the source code for the class files in the jar?


  • Registered Users Posts: 23,212 ✭✭✭✭Tom Dunne


    bala wrote: »
    I suspect that the version of Java is different in both the machines. The new Machine has newer version of Java.

    This is where it gets messy.

    The JRE is in :

    C:\Program Files\Oracle\jre\

    There are two subdirectories, 1.1.8 and 1.3.1

    The old C: drive is still accessible (though not bootable) and the directory structure is the identical.

    Looking at the java version on the new machine:

    C:\>java -version
    java version "1.3.1_01"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
    Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)

    From this, I am deducing, that the versions of the old and new may in fact be the same.

    Does this make sense?
    bala wrote: »
    Do you have the source code for the class files in the jar?

    I have extracted the files from the JAR, but can I view the classes with something. Wordpad doesn't like them. Can I view them?

    The JAR was developed by my company, around 4-5 years ago, so I am not so sure if the source code is still around.


  • Registered Users Posts: 1,998 ✭✭✭lynchie


    eye fohne wrote: »
    I have a jar file that is invoked with various parameters, including username, password and database name. It is in a Windows batch file wrapper.

    Command line is:

    [PHP]java -jar -Xms256m -Xmx256m c:\conversion\Conversion.jar 1 20000 <username> <password> <database name> N Y >> c:\conversion\conversion.log 2>&1

    [/PHP]

    The jar appears to have trouble connecting to the database, giving the following error:

    Exception in thread "main" Start time is: 17:14:53
    java.lang.NoClassDefFoundError: java/sql/Savepoint
    at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at com.conv.conversion.JDBCConnection.connect(JDBCConnection.java:20)
    at com.conv.conversion.Reader.initialise(Reader.java:25)
    at com.conv.conversion.Conversion.<init>(Conversion.java:27)
    at com.conv.conversion.Conversion.main(Conversion.java:82)
    Exception in thread "main"

    Any ideas where to start? Not too hot on java..... :(

    Some background on this - it was working on a different machine, which broke, copied over to a new machine and now doesn't work. This suggests to me the environment is different in some way.

    java.sql.Savepoint was only added in jdk 1.4. running it with a jvm < 1.4 will cause this issue. Or if I remember correctly when using older versions of the jvm we also included the jdbc3.jar in teh classpath


  • Registered Users Posts: 23,212 ✭✭✭✭Tom Dunne


    lynchie wrote: »
    java.sql.Savepoint was only added in jdk 1.4. running it with a jvm < 1.4 will cause this issue. Or if I remember correctly when using older versions of the jvm we also included the jdbc3.jar in teh classpath

    Lovely stuff, you could be on to something there. I'll look into that.

    As I am further investigating this, it's incredible how convoluted this thing is.

    There's a stored procedure, reading in an external file, processing it, calling another procedure, calling a function, that calls a java package that runs the Windows batch file, which calls the java jar file, which updates the database.

    FFS, it's no wonder I have no hair left. :(


  • Registered Users Posts: 23,212 ✭✭✭✭Tom Dunne


    lynchie wrote: »
    java.sql.Savepoint was only added in jdk 1.4. running it with a jvm < 1.4 will cause this issue. Or if I remember correctly when using older versions of the jvm we also included the jdbc3.jar in teh classpath

    Looks like that was the problem. Thanks for that lynchie.

    I upgraded to JVM 1.4.2 and the batch file ran without problem.


  • Advertisement
Advertisement