Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-5570

dblook should not swallow ClassNotFoundException regardless of -verbose setting

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 10.8.2.2
    • None
    • Tools
    • Low
    • Newcomer, Repro attached

    Description

      When I (incorrectly) place only derbytools.jar in my classpath, dblook's behavior is very confusing:

      $ java -cp derbytools.jar org.apache.derby.tools.dblook -d jdbc:derby://localhost:1527/mydb
      – Timestamp: 2012-01-17 06:53:12.968
      – Source database is: mydb
      – Connection URL is: jdbc:derby://localhost:1527/mydb
      – appendLogs: false

      There is no hint of a problem; it just prints nothing and does nothing.

      This is very confusing, and leads uses to mess about with the -d argument, etc.

      When I add the -verbose flag, the real problem becomes clear:

      $ java -cp derbytools.jar org.apache.derby.tools.dblook -d jdbc:derby://localhost:1527/mydb -verbose
      – Timestamp: 2012-01-17 06:53:26.465
      – Source database is: mydb
      – Connection URL is: jdbc:derby://localhost:1527/mydb
      – appendLogs: false

      java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver
      at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:169)
      at org.apache.derby.tools.dblook.loadDriver(dblook.java:325)
      at org.apache.derby.tools.dblook.<init>(dblook.java:132)
      at org.apache.derby.tools.dblook.main(dblook.java:97)

      I think that dblook should be more careful about the exceptions that it's quietly
      swallowing, and in particular should not swallow a ClassNotFoundException.

      That would make it much easier for users to figure out that the problem lies with
      their classpath, not with their connection URL.

      Attachments

        Activity

          People

            Unassigned Unassigned
            bryanpendleton Bryan Pendleton
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: