Use Relational Database in BeanManagedConnection

Ramon Pfeiffer ramon.pfeiffer at uni-tuebingen.de
Tue Nov 13 09:18:08 EST 2018


Hi all,

I fetch attributes for my attribute resolvers from relational databases
via a SimpleManagedConnection:


<DataConnector
    id="ELPGuestDB"
    xsi:type="RelationalDatabase"
    queryTimeout="PT5S">

    <SimpleManagedConnection
        jdbcDriver="com.microsoft.sqlserver.jdbc.SQLServerDriver"
        jdbcURL="..."
        jdbcUserName="%{idp.attribute.resolver.MSSQL.ElpGuest.UserName}"
        jdbcPassword="%{idp.attribute.resolver.MSSQL.ElpGuest.Password}" />

    <QueryTemplate>...</QueryTemplate>
</DataConnector>

This works as intended.

I tried to move the database connection definition into a bean defined
in global.xml and referenced in the DataConnector, as shown in [1]:

<bean id="ELPGuestDB"
    class="org.apache.commons.dbcp.BasicDataSource"
    destroy-method="close"
    p:driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
    ... />

<DataConnector
    id="ELPGuestDB"
    xsi:type="RelationalDatabase"
    queryTimeout="PT5S">

    <BeanManagedConnection>ELPGuestDB</BeanManagedConnection>

    <QueryTemplate>...</QueryTemplate>

</DataConnector>

This throws an error during startup, shown below. Any hints as to what I
am missing are greatly appreciated!

Thanks and best regards
Ramon


2018-11-13 15:10:50,135 - WARN
[net.shibboleth.ext.spring.context.FilesystemGenericApplicationContext:551]
- Exception encountered during context initialization - cancelling
refresh attempt:
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'ELPGuestDB': Initialization of bean failed; nested
exception is org.springframework.beans.ConversionNotSupportedException:
Failed to convert property value of type
'net.shibboleth.idp.attribute.resolver.dc.rdbms.impl.RDBMSDataConnector'
to required type 'javax.sql.DataSource' for property 'DataSource';
nested exception is java.lang.IllegalStateException: Cannot convert
value of type
'net.shibboleth.idp.attribute.resolver.dc.rdbms.impl.RDBMSDataConnector'
to required type 'javax.sql.DataSource' for property 'DataSource': no
matching editors or conversion strategy found
2018-11-13 15:10:50,140 - ERROR
[net.shibboleth.utilities.java.support.service.AbstractReloadableService:182]
- Service 'shibboleth.AttributeResolverService': Initial load failed
net.shibboleth.utilities.java.support.service.ServiceException:
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'ELPGuestDB': Initialization of bean failed; nested
exception is org.springframework.beans.ConversionNotSupportedException:
Failed to convert property value of type
'net.shibboleth.idp.attribute.resolver.dc.rdbms.impl.RDBMSDataConnector'
to required type 'javax.sql.DataSource' for property 'DataSource';
nested exception is java.lang.IllegalStateException: Cannot convert
value of type
'net.shibboleth.idp.attribute.resolver.dc.rdbms.impl.RDBMSDataConnector'
to required type 'javax.sql.DataSource' for property 'DataSource': no
matching editors or conversion strategy found
        at
net.shibboleth.ext.spring.service.ReloadableSpringService.doReload(ReloadableSpringService.java:377)
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'ELPGuestDB': Initialization of bean
failed; nested exception is
org.springframework.beans.ConversionNotSupportedException: Failed to
convert property value of type
'net.shibboleth.idp.attribute.resolver.dc.rdbms.impl.RDBMSDataConnector'
to required type 'javax.sql.DataSource' for property 'DataSource';
nested exception is java.lang.IllegalStateException: Cannot convert
value of type
'net.shibboleth.idp.attribute.resolver.dc.rdbms.impl.RDBMSDataConnector'
to required type 'javax.sql.DataSource' for property 'DataSource': no
matching editors or conversion strategy found
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:562)
Caused by: org.springframework.beans.ConversionNotSupportedException:
Failed to convert property value of type
'net.shibboleth.idp.attribute.resolver.dc.rdbms.impl.RDBMSDataConnector'
to required type 'javax.sql.DataSource' for property 'DataSource';
nested exception is java.lang.IllegalStateException: Cannot convert
value of type
'net.shibboleth.idp.attribute.resolver.dc.rdbms.impl.RDBMSDataConnector'
to required type 'javax.sql.DataSource' for property 'DataSource': no
matching editors or conversion strategy found
        at
org.springframework.beans.AbstractNestablePropertyAccessor.convertIfNecessary(AbstractNestablePropertyAccessor.java:603)
Caused by: java.lang.IllegalStateException: Cannot convert value of type
'net.shibboleth.idp.attribute.resolver.dc.rdbms.impl.RDBMSDataConnector'
to required type 'javax.sql.DataSource' for property 'DataSource': no
matching editors or conversion strategy found
        at
org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:307)

[1]:
https://wiki.shibboleth.net/confluence/display/IDP30/BeanManagedConnection

-- 
--
Universität Tübingen
Zentrum für Datenverarbeitung
Wächterstraße 76
72074 Tübingen

E-Mail: ramon.pfeiffer at uni-tuebingen.de
Telefon: +49-7071-29-70213


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5217 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://shibboleth.net/pipermail/users/attachments/20181113/303df71c/attachment.p7s>


More information about the users mailing list