Jetspeed 2
  1. Jetspeed 2
  2. JS2-593

NullPointerException whent getting database connection in BatchedStatistics

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1-dev
    • Fix Version/s: 2.1.3
    • Component/s: Persistence and DAO
    • Labels:
      None
    • Environment:
      Java 1.5
      Ubuntu 6.0.6

      Description

      When jetspeed call BatchedStatistics I have a NullPointerException on ds.getConnection(), it seems that my Datasource doesn't have a datasource associated, after debugging it seems that in afterPropertiesSet method of class ConnectionRepositoryEntry we do not save the datasource found into de the datasource field of BasicDataSource.

      I made a patch for you you will find it in attachments

      1. Jetspeed2.1-dev.patch
        2 kB
        Cédric Mailleux

        Activity

        Hide
        Scott T Weaver added a comment -

        I had this same issue. The problem is org.apache.jetspeed.components.rdbms.ojb.ConnectionRepositoryEntry.getConnection() does not override org.apache.commons.dbcp.BasicDataSource.getConnection(), which means that it will try to put together a connection pool from jdbc settings (which may not exist, causing NPEs) totally ignoring the configured JNDI datasource. The fix is simple, just override the getConnection() and getConnection(String, String) to first check for a pre-configured JNDI datadsource. If one exists just delegate to that datasource's getConnection() methods, otherwise delegate to org.apache.commons.dbcp.BasicDataSource getConnection() methods. I have a fix I will be committing shortly.

        Show
        Scott T Weaver added a comment - I had this same issue. The problem is org.apache.jetspeed.components.rdbms.ojb.ConnectionRepositoryEntry.getConnection() does not override org.apache.commons.dbcp.BasicDataSource.getConnection(), which means that it will try to put together a connection pool from jdbc settings (which may not exist, causing NPEs) totally ignoring the configured JNDI datasource. The fix is simple, just override the getConnection() and getConnection(String, String) to first check for a pre-configured JNDI datadsource. If one exists just delegate to that datasource's getConnection() methods, otherwise delegate to org.apache.commons.dbcp.BasicDataSource getConnection() methods. I have a fix I will be committing shortly.
        Hide
        Ate Douma added a comment -

        Scott, if you do have a patch available, can you please commit this soon as we're nearing the 2.1.3 release shortly.

        Show
        Ate Douma added a comment - Scott, if you do have a patch available, can you please commit this soon as we're nearing the 2.1.3 release shortly.
        Hide
        Scott T Weaver added a comment -

        Has actually been in place since 9/21/2007. I just forgot to close the issue.

        Show
        Scott T Weaver added a comment - Has actually been in place since 9/21/2007. I just forgot to close the issue.

          People

          • Assignee:
            Scott T Weaver
            Reporter:
            Cédric Mailleux
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development