<!DOCTYPE html>
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hello,</p>
    <p>have you managed to set postgresql as a consent storage for
      shibboleth IdP V5?<br>
    </p>
    <p>I tried to do it using this page
<a class="moz-txt-link-freetext" href="https://shibboleth.atlassian.net/wiki/spaces/IDPPLUGINS/pages/2989096970/JDBCStorageService">https://shibboleth.atlassian.net/wiki/spaces/IDPPLUGINS/pages/2989096970/JDBCStorageService</a></p>
    <p>So I :<br>
      - installed the jdbc plugin: <i>/opt/shibboleth-idp/bin/plugin.sh
        -I net.shibboleth.plugin.storage.jdbc</i><br>
      - downloaded the jdbc driver <a class="moz-txt-link-freetext" href="https://jdbc.postgresql.org/download">https://jdbc.postgresql.org/download</a>
      and put it in <i>/opt/shibboleth-idp/edit-webapp/WEB-INF/lib</i><br>
      - created the database table for the plugin to use and the table
      StorageRecords<br>
      - downloaded the lib apache  Commons DBCP2 and put it in <i>/opt/shibboleth-idp/edit-webapp/WEB-INF/lib<br>
      </i>- set the connection in <i>/opt/shibboleth-idp/conf/global.xml</i>:</p>
    <p><i><bean id="databaseConnexionData"
        class="org.apache.commons.dbcp2.BasicDataSource"
        destroy-method="close" lazy-init="true"<br>
                p:driverClassName="org.postgresql.Driver"<br>
               p:url="jdbc:postgresql://localhost:5432/shibboleth"<br>
               p:username="shibboleth"<br>
               p:retryableErrors="4001, 4002"<br>
               p:password="%{idp.JDBCPassword}" /><br>
        <br>
            <bean id="JDBCStorageService"
        parent="shibboleth.JDBCStorageService"<br>
                  p:dataSource-ref="databaseConnexionData"<br>
                  p:transactionIsolation="4"<br>
                  p:retryableErrors="40001"<br>
            /></i></p>
    <p>And when I restart my jetty service after a build I've got this
      errors :</p>
    <p><i>Error creating bean with name 'JDBCStorageService' defined in
        file [/opt/shibboleth-idp/conf/global.xml]: Cannot resolve
        reference to bean 'databaseConnectionSource' while setting bean
        property 'dataSource'<br>
      </i></p>
    <p>Which is caused by this error (indeed the been <i>databaseConnectionSource</i>
      could not been created):</p>
    <p><i>Error creating bean with name 'databaseConnectionSource'
        defined in file [/opt/shibboleth-idp/conf/global.xml]: Failed to
        instantiate [org.apache.commons.dbcp2.BasicDataSource]:
        Constructor threw exception</i></p>
    <p>Which is, indeed, cause by this exception :</p>
    <p><i>Caused by: java.lang.NoSuchFieldError:
        DEFAULT_DURATION_BETWEEN_EVICTION_RUNS<br>
          at
org.apache.commons.dbcp2.BasicDataSource.<init>(BasicDataSource.java:260)</i></p>
    <p>So yes it seems to be an issue with my class instanciation, but I
      don't know how to fix this <i>DEFAULT_DURATION_BETWEEN_EVICTION_RUNS</i>
      thing.</p>
    <p>If someone has a solution, it'd be great.</p>
    <p>Best regards,<br>
    </p>
    <pre class="moz-signature" cols="200">-- 
Erwan Colin
Ingénieur système/System engineer
IMT Mines Albi
🖁 +33 754 369 060
☎ +33 563 493 356
🚪 0A20</pre>
  </body>
</html>