embedded database for IDP storage service

Peter Schober peter.schober at univie.ac.at
Thu Sep 6 13:13:19 EDT 2018

> > I get the impression that I'd need to use JPA and Hibernate to use a
> > persistence layer for consent records, though? (I may be
> > misunderstanding this, as it was not necessary for persistent IDs.)
> Yes, that's about the only code in the IdP that doesn't use a fixed
> storage API, it's been carried along since it was created by hand.

OK. Since all my attempts failed to verify the claims from Oracle's
documentation that the JDK contains Java DB (Apache Derby) -- at least
in current jdk1.8.0_181 there's no 'db' subdirectory, neither in the
GNU/Linux RPM nor in the .tar.gz -- I thought I might as well try
something else, H2 in this case.
(This is all with Tomcat 8.5, one that has commons-dbcp.jar and
tomcat-dbcp.jar and tomcat-jdbc.jar available.)

I know nothing about connection pooling implementations or why one
would prefer one over the other and what any of this means for an
embedded database ony accessed by code running inside the same
JVM, so I started out with the hopefully simplest possible case using
what Tomcat already provides:

I added the two "DB-independent" beans to my conf/global.xml, as per

I can't get the DB-specific ones to work, though. The vendor dialect
seems simple enough, I tried "H2" and "H2Dialect" (which doesn't
seem to make any difference):

<bean id="shibboleth.JPAStorageService.JPAVendorAdapter"
    <property name="database" value="H2" />

So I seem to be failing mainly on the data source front, currently:

<bean id="shibboleth.JPAStorageService.DataSource"
    p:jdbcUrl="jdbc:h2:file:/opt/shibboleth-idp/db/test" />

The driverClassName value comes directly from the H2 docs:
And jdbcUrl also seems to be correct per their docs:

I took a guess what the bean/@class should be, after poking around in
different jar files and looking at other people's docs (references
below), so that's the most likely source of the error I'm getting:

  Error creating bean with name
  'shibboleth.JPAStorageService.DataSource' defined in file
  [/opt/shibboleth-idp/system/conf/../../conf/global.xml]: Error
  setting property values; nested exception is
  org.springframework.beans.NotWritablePropertyException: Invalid
  property 'jdbcUrl' of bean class
  [org.apache.tomcat.jdbc.pool.DataSource]: Bean property 'jdbcUrl' is
  not writable or has an invalid setter method.

The Tomcat docs mention "org.apache.tomcat.jdbc.pool" as a replacement
for the Apache Commons one:

DFN-AAI accordingly documents use of the class
"org.apache.tomcat.jdbc.pool.DataSource" in their Tomcat 8 docs:
(Direct link to the properties snippet detailing the class:
https://wiki.aai.dfn.de/_export/code/de:shibidp3storage?codeblock=6 )

SWITCHaai documents use of the class
"org.apache.commons.dbcp.BasicDataSource" for their Tomcat 7 docs:
which also makes sense, I guess (being based on Tomcat 7).

I also tried "org.apache.tomcat.dbcp.dbcp2.BasicDataSource" for good
measure (making sure the class exists), but no dice: The error message
from Tomcat remains the same, no matter what I try. So I must be Doing
It Wrong, and more guessing won't fix it.


More information about the users mailing list