Forum Stats

  • 3,781,158 Users
  • 2,254,484 Discussions
  • 7,879,596 Comments

Discussions

SQL Developer 4.0 Mac OS X

OSCSQLDEV
OSCSQLDEV Member Posts: 6
edited May 19, 2014 12:20PM in SQL Developer

Hi,

I am running SQL Developer 4.02 on MacOS (Java 1.7), and I am unable to  edit Views.  The editing module crashes with the following error message:

java.lang.NoSuchMethodError: oracle.jdbc.driver.OracleConnection.getCurrentSchema()Ljava/lang/String;


The ojdbc6.jar shipped with SQLDeveloper 4 contains this method, but it's not under "driver".  The method is at oracle.jdbc.OracleConnection.getCurrentSchema().  I even tried to fix the jar file, but it seems like the program does not use the JDBC jar file shipped with it in the ~sqldeveloper/jdbc/lib/ directory.  I have no other ojdbc*.jar on the computer.  I even removed the ojdbc driver from the computer, and SQL Developer was still able to run and connect to the database.  Does anyone know how to fix this problem? 


Thanks.

«1

Answers

  • Gary Graham-Oracle
    Gary Graham-Oracle Member Posts: 3,256 Bronze Crown
    edited May 9, 2014 9:07PM

    Interesting.  The jar that ships with SQL Developer is correct and is supposed to be used by default unless overridden by changing a preference setting in:

    Tools > Preferences... > Database > Advanced > Use Oracle Client
    

    This is a new feature for 4.0.x, by the way.  If overridden, the version specified must be an Oracle Home or Oracle Instant Client of 11.2.0.3 or above. The method oracle.jdbc.OracleConnection.getCurrentSchema should have been called instead, not something in ...jdbc.driver...

    If no other Oracle Client exists on your Mac, and the Use Oracle Client preference has not been set, then I would guess either the download / install is corrupt, or you installed on top of an existing install (not sure if that's possible on a Mac).  Perhaps cleaning up things and reinstalling will help.

    Regards,
    Gary

    SQL Developer Team

    Gary Graham-Oracle
  • OSCSQLDEV
    OSCSQLDEV Member Posts: 6

    Gary,

    Thank you for your reply. "Use Oracle Client"  is unchecked and I also did a new reinstall.  I am still getting the same error message.  What I am confused about is that why the "Edit View" panel routine that shows the current schema is calling oracle.jdbc.driver.OracleConnection.getCurrentSchema if it's supposed to call jdbc.OracleConnection.getCurrentSchema?  Is this something that was overlooked in Mac's version of SQLDeveloper 4.0? I have verified that this function works in 3.2.  Regardless of what jdbc driver is being used (or not used), the call seems to be incorrect.  Do you agree?

    Thanks.

  • Gary Graham-Oracle
    Gary Graham-Oracle Member Posts: 3,256 Bronze Crown

    If you are actually using the ojdbc6.jar that comes with SQL Developer 4.0.2, here is how the getCurrentSchema() call should be handled...

    1. oracle.jdbc.driver.OracleConnection is an abstract class (partially concrete) which extends

    2. oracle.jdbc.OracleConnectionWrapper, a concrete class which implements the getCurrentSchema() method,  as it implements

    3. oracle.jdbc.OracleConnection, an abstract interface.

    So since ...driver.OracleConnection is an extension of the implementation that contains getCurrentSchema(), no NoSuchMethodError should occur.

    To check if something in your environment is the cause, could you please:

    1. post the value of sun.boot.classpath

    2. check the directories listed in java.ext.dirs, and look for any jdbc jars

  • Gary,

    Thanks again for your help.  Could you please let me know where I can find sun.boot.classpath and java.ext.dirs values?  If sun.boot.classpath refers to CLASSPATH environment variable, it's not set to anything by default.  SQLDeveloper sets JAVA_HOME to Java 1.7 Home in its startup script, and I think subsequent scripts (sqldeveloper.sh, launcher.sh) create CLASSPATH env variable from application and java paths.  I have checked everywhere on my computer for other ojdbc files, and I am not finding one.  But sun.boot.classpath and java.ext.dirs values may reveal something I am not seeing.  BTW, I grep'd for them in SQLDeveloper.app directory, and nothing came up, so maybe I am not understanding what these refer to.

    Thanks.

  • Gary Graham-Oracle
    Gary Graham-Oracle Member Posts: 3,256 Bronze Crown
    edited May 15, 2014 3:28PM

    Not being a Mac user, I can only assume the value of these system variables may be found by running the env command from a terminal.  However, from within SQL Developer, you can also find them via Help > About > Properties, then search for each:

    1. java.ext.dirs
    2. sun.boot.class.path  (I got this one wrong in the prior post, ending with classpath rather than class.path)
    
    

    Next, search in all the folders listed in the property values for any other occurrences of ojdbc<N>.jar files.  There will be other locations than just SQLDeveloper.app.

  • OSCSQLDEV
    OSCSQLDEV Member Posts: 6

    Gary,

    Here are the values of the two properties I got from About->Properties:  I did find sun.boot.class.path, but not sun.boot.classpath.  I also verified that there is no CLASSPATH set by my or the system in my environment

    sun.boot.class.path

    ../../rdbms/jlib/ojdi.jar:

    ../../ide/bin/../../rdbms/jlib/ojdi.jar:

    /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/resources.jar:

    /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/rt.jar:

    /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/sunrsasign.jar:

    /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/jsse.jar:

    /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/jce.jar:

    /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/charsets.jar:

    /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/jfr.jar:

    /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/classes:

    /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/lib/tools.jar:

    /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/lib/dt.jar

    java.ext.dirs

    /Users/oscsqldev/Library/Java/Extensions:

    /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/ext:

    /Library/Java/Extensions:

    /Network/Library/Java/Extensions:

    /System/Library/Java/Extensions:

    /usr/lib/java

    I looked in every one of those directories, and there is no ojdbc<N>.jar in any of them.  Moreover, the directory that the shipped ojdbc6.jar is in isn't listed in the above properties (<Application Package>...../sqldeveloper/jdbc/lib/ojdbc6.jar).  I even removed ojdbc6.jar (the one shipped with SQLDeveloper) from the system, and the SQLDeveloper was still able to connect to the Oracle database and do what I normally do --minus the ability to edit Views!!!  That makes me wonder if the ojdbc classes are shipped in another jar file(s).  The result of all these experiments is making the issue more confusing, to say the least!

    Thanks.

  • Gary Graham-Oracle
    Gary Graham-Oracle Member Posts: 3,256 Bronze Crown

    Certainly an unexpected result!  So if the shipped ojdbc6.jar is removed, and you use Help > About > Properties and search for the property name jdbc.library, what does it show as the property value? 

    I'm told that jars located in any of these external directories get picked up before ours, so if any of those contain old, incompatible versions of the Java class files in question, even if the jar has been renamed to some entirely different name, that could be the cause of your troubles.

    Hopefully either the property value or a further examination of those external directories will uncover a "smoking gun".  Otherwise I think we've taken this about as far as we can.

  • OSCSQLDEV
    OSCSQLDEV Member Posts: 6

    Gary,

    The value of the jdbc.library is pointing to the shipped ojdbc6.jar (/Applications/SQLDeveloper.app/Contents/Resources/sqldeveloper/jdbc/lib/ojdbc6.jar).  After looking more into the problem, I doubt that another jdbc is being picked up, because if that were true, SQLDeveloper 3.2 with the EXACT same properties (in terms of sun.boot.class.path and  java.ext.dirs) should have had the same problem, but it doesn't.  I even replaced the ojdbc the came with SQLDeveloper 4 with the one that was shipped with 3.2 (just in case), but that didn't help.  The only thing that's left is the SQLDeveloper 4.0 code itself.  I have always thought that Java is Java no matter what, but when it comes to Mac, I guess not.

    Thanks for trying.  Appreciate all your help.

  • Gary Graham-Oracle
    Gary Graham-Oracle Member Posts: 3,256 Bronze Crown

    Just to be clear, you are the only one to report NoSuchMethodError when editing views.  Probably half of the developers on our team have Macs, many as the preferred development platform.  I suspect something needs to be cleaned up on your Mac -- I am willing to bet that if you installed on a new machine there would be no problem.

    Sorry we could not help you reach some resolution.

    Best Wishes,

    Gary

  • Unknown
    edited May 15, 2014 8:54PM

    It's time that you do what you haven't yet done

    1. provide EXACT information about the SQL developer version you are using and WHERE it is located

    I am running SQL Developer 4.02 on MacOS (Java 1.7), and I am unable to  edit Views.

    Where, when, and how was that version installed? How are you launching that particular version. Post proof from the 'about' box that you are really using that version.

    2. provide EXACT information about ALL of the connection properties you have specified for the connection you are using when the problem occurs.

    3. provide EXACT information about the Oracle DB version you are connecting to and WHERE it is located.

    Here are the values of the two properties I got from About->Properties:  I did find sun.boot.class.path, but not sun.boot.classpath.  I also verified that there is no CLASSPATH set by my or the system in my environment
    
    
    
    
    sun.boot.class.path
    
    ../../rdbms/jlib/ojdi.jar:
    ../../ide/bin/../../rdbms/jlib/ojdi.jar:
    
    
    
    
    
     

    Those paths indicate to me that:

    1. the Oracle DB is on the SAME system as the sql developer you are executing. That 'rdbms/jlib/ojdi.jar' is part of the database installation.

    2. path #2 above points to the sqldeveloper version that was installed with the database.

    Here is the complete path on windows for the sqldeveloper installation that came with an 11g DB:

    D:\app\Administrator\product\11.2.0\dbhome_1\sqldeveloper\ide\bin

    Note that there are NO folders under the 'bin' folder. But if I go up two levels ('../..') I get to this folder:

    D:\app\Administrator\product\11.2.0\dbhome_1

    And then I find that 'ojdi.jar' exactly where path #2 says it is:

    D:\app\Administrator\product\11.2.0\dbhome_1\RDBMS\jlib\ojdi.jar

    Those paths suggest a local installation of SOME version of the Oracle DB.

      I even removed ojdbc6.jar (the one shipped with SQLDeveloper) from the system, and the SQLDeveloper was still able to connect to the Oracle database and do what I normally do
    . . .
    I have checked everywhere on my computer for other ojdbc files, and I am not finding one.

    Which would be odd indeed if the Oracle DB is on that same system since the DB installation installs SEVERAL versions and copies of the JDBC jar file. Here are the ones installed for a vanilla 11g installation:

    D:\app\Administrator>dir /b /s *jdbc*.jar
    D:\app\Administrator\product\11.2.0\dbhome_1\jdbc\lib\ojdbc5.jar
    D:\app\Administrator\product\11.2.0\dbhome_1\jdbc\lib\ojdbc5dms.jar
    D:\app\Administrator\product\11.2.0\dbhome_1\jdbc\lib\ojdbc5dms_g.jar
    D:\app\Administrator\product\11.2.0\dbhome_1\jdbc\lib\ojdbc5_g.jar
    D:\app\Administrator\product\11.2.0\dbhome_1\jdbc\lib\ojdbc6.jar
    D:\app\Administrator\product\11.2.0\dbhome_1\jdbc\lib\ojdbc6dms.jar
    D:\app\Administrator\product\11.2.0\dbhome_1\jdbc\lib\ojdbc6dms_g.jar
    D:\app\Administrator\product\11.2.0\dbhome_1\jdbc\lib\ojdbc6_g.jar
    D:\app\Administrator\product\11.2.0\dbhome_1\oc4j\jdbc\lib\ojdbc5dms.jar
    D:\app\Administrator\product\11.2.0\dbhome_1\owb\wf\lib\ojdbc14.jar
    D:\app\Administrator\product\11.2.0\dbhome_1\sqldeveloper\ide\processor-plugins
    oracle.jdbc-driver-locator.jar
    D:\app\Administrator\product\11.2.0\dbhome_1\sqldeveloper\jdbc\lib\ojdbc5.jar
    D:\app\Administrator\product\11.2.0\dbhome_1\sysman\jlib\emJDBC14.jar D:\app\Administrator>

    So some possibilities are:

    1. you are running a different version of sql dev than you think you are

    2. your installation of 4.02 went haywire and tromped all over your DB installation, a previous sql dev installation or both

    3. your environment variables are totally messed up.

    Have you tried launching the various sql dev executables from the command line AFTER navigating to the exact folder each executable is in?

    oracle.jdbc.driver.OracleConnection.getCurrentSchema()

    The (invalid) call to that non-existent method is coming from SOME piece of software. The two likely candidates are 1) sql developer as part of getting the metadata for editing views and 2) internally in a JDBC jar file.

    You might post a short thread in the JDBC forum asking about that second possibility.

    https://community.oracle.com/community/developer/english/java/database_connectivity/java_database_connectivity_(jdbc)

    Members of the JDBC dev team often monitor and respond in that forum. Add a link to this current thread but don't repeat all of the unrelated discussion. Put something JDBC related in the subject (e.g. "Invalid JDBC method 'oracle.jdbc.driver.OracleConnection.getCurrentSchema()' being called") and just mention the part about using sql dev to connect and the 'editing view' stuff.

This discussion has been closed.