Commons Dbcp
  1. Commons Dbcp
  2. DBCP-143

[dbcp] SQLNestedException thrown by server causes client ClassNotFoundException.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0
    • Labels:
      None
    • Environment:

      Operating System: other
      Platform: Other

      Description

      This is a GUI client / application server / database server application.

      On the GUI client side, we see java.lang.ClassNotFoundException:
      org.apache.commons.dbcp.SQLNestedException.

      This happens when the database server is down, DBCP cannot connect to the
      database, and throws a org.apache.commons.dbcp.SQLNestedException.

      Our application server code sends the java.sql.SQLException it sees to the
      client via RMI.

      However, on the client, we have not provided commons-dbcp.jar.

      And I don't think we should - DBCP is server code.

      But, when the client does not have SQLNestedException's class file, the attempt
      to de-serialize it results in the ClassNotFoundException we've been seeing.

      Even old http://java.sun.com/j2se/1.3/docs/api/java/sql/SQLException.html has
      the facilities that SQLNestedExcepion offers: It is able to chain another
      SQLException to itself. So while SQLNestedException clearly causes problems, I
      don't understand what DBCP gains from it.

      What would we loose if it were scratched?

      1. DBCP-143.patch
        24 kB
        Dain Sundstrom

        Issue Links

          Activity

          Andreas Krüger created issue -
          Henri Yandell made changes -
          Field Original Value New Value
          issue.field.bugzillaimportkey 37181 12342650
          Henri Yandell made changes -
          Project Commons [ 12310458 ] Commons Dbcp [ 12310469 ]
          Component/s Dbcp [ 12311109 ]
          Key COM-2498 DBCP-143
          Assignee Jakarta Commons Developers Mailing List [ commons-dev@jakarta.apache.org ]
          Affects Version/s unspecified [ 12311647 ]
          Phil Steitz made changes -
          Bugzilla Id 37181
          Fix Version/s 1.3 [ 12311977 ]
          Hide
          Henri Yandell added a comment -

          It was there in 1.2 too.

          Looking at the source, the only part of SQLNestedException used is the SQLNestedException(String,Throwable). However sometimes that latter argument is not a SQLException; which would be one reason not to use the setNextException message.

          Another alternative would be to bring the minimum JDK up to 1.4 and switch to standard exception chaining.

          Show
          Henri Yandell added a comment - It was there in 1.2 too. Looking at the source, the only part of SQLNestedException used is the SQLNestedException(String,Throwable). However sometimes that latter argument is not a SQLException; which would be one reason not to use the setNextException message. Another alternative would be to bring the minimum JDK up to 1.4 and switch to standard exception chaining.
          Hide
          Dain Sundstrom added a comment -

          This patch replaces:

          new SQLNestedException(msg, e);

          with:

          (SQLException) new SQLException(msg).initCause(e);

          Show
          Dain Sundstrom added a comment - This patch replaces: new SQLNestedException(msg, e); with: (SQLException) new SQLException(msg).initCause(e);
          Dain Sundstrom made changes -
          Attachment DBCP-143.patch [ 12362384 ]
          Hide
          Dain Sundstrom added a comment -

          SQLNestedException has been deprecated in 1.3 and will be removed in 1.4

          Show
          Dain Sundstrom added a comment - SQLNestedException has been deprecated in 1.3 and will be removed in 1.4
          Dain Sundstrom made changes -
          Fix Version/s 1.4 [ 12312615 ]
          Fix Version/s 1.3 [ 12311977 ]
          Hide
          Mark Thomas added a comment -

          Removing the SQLNestedException would be an API breaking change so it would have to wait until a DBCP 2.0 release. To be perfectly honest, I don't see a 2.0 release on the horizon right now. However, I am not closing this as WONTFIX as it is always possible that there will be a 2.0 release at some point but please be aware that this is some time (possibly years) away.

          Show
          Mark Thomas added a comment - Removing the SQLNestedException would be an API breaking change so it would have to wait until a DBCP 2.0 release. To be perfectly honest, I don't see a 2.0 release on the horizon right now. However, I am not closing this as WONTFIX as it is always possible that there will be a 2.0 release at some point but please be aware that this is some time (possibly years) away.
          Mark Thomas made changes -
          Fix Version/s 2.0 [ 12313721 ]
          Fix Version/s 1.4 [ 12312615 ]
          Hide
          Mark Thomas added a comment -

          Forgot to include this:

          See http://markmail.org/thread/qd2mowgifkka2gkd for further discussion on this very topic.

          Show
          Mark Thomas added a comment - Forgot to include this: See http://markmail.org/thread/qd2mowgifkka2gkd for further discussion on this very topic.
          Niall Pemberton made changes -
          Link This issue relates to DBCP-310 [ DBCP-310 ]
          Hide
          Mark Thomas added a comment -

          SQLNestedException has been removed in trunk as part of the work towards DBCP-2

          Show
          Mark Thomas added a comment - SQLNestedException has been removed in trunk as part of the work towards DBCP-2
          Mark Thomas made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Phil Steitz made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Resolved Resolved
          2833d 2h 51m 1 Mark Thomas 24/Jul/13 00:09
          Resolved Resolved Closed Closed
          580d 4h 13m 1 Phil Steitz 24/Feb/15 03:23

            People

            • Assignee:
              Unassigned
              Reporter:
              Andreas Krüger
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development