Hi Alan,
you have managed to get yourself as deeply as possible into the messy world of
OSGi and class loading. To keep it short, the problem you are facing is that
you are asking Spring Security to load certain classes related to LDAP. The
Spring Security configuration is being loaded by the matterhorn-kernel module,
which up until now does not see anything related to LDAP, even if is installed
in your system, thanks to the Import-Package statement of the OSGi manifest,
which lists all the packages to be visible to the bundle.
Spring Security is now instantiated by the matterhorn-kernel module, using that
bundle's class loader. By now it may or may not be obvious why the LDAP classes
can't be found, leading to a failure loading the security configuration as a
whole.
On the bright side, there are two ways for dealing with this problem:
1) Modify the POM of the matterhorn-kernel bundle to include import statements
for the required ldap classes. You will need to do some digging or trial and
error to find the complete list of classes. A rather simple way would be to
take a look at Spring Security's LDAP bundle and import what that bundle
exports (see end of e-mail for what 1.3.1 exports). Then recompile, deploy and
you should be good.
The downside of this approach is that you now have your own version of the
matterhorn-kernel which you need to support over time. We could start talking
about adding these imports to the Matterhorn codebase in general, but that is
not feasible because the bundle then wouldn't start if LDAP wasn't deployed,
and second what about all the other things that could potentially be added to
the Spring Security configuration? Therefore, the second approach detailed
below is much more promising:
2) Use the matterhorn-ldap bundle, which is doing the imports from
SpringSecurity and then specifying matterhorn-kernel as the Fragment-Host,
which means that it is actually injecting the imports into the Kernel.
Let me know if this works, I highly recommend going with option 2) and I am
happy to help should this approach not be working for any reason.
Tobias
Exports of Spring Security LDAP-Bundle
org.springframework.ldap;version=${spring-ldap.version},
org.springframework.ldap.authentication;version=${spring-ldap.version},
org.springframework.ldap.control;version=${spring-ldap.version},
org.springframework.ldap.core;version=${spring-ldap.version},
org.springframework.ldap.core.simple;version=${spring-ldap.version},
org.springframework.ldap.core.support;version=${spring-ldap.version},
org.springframework.ldap.filter;version=${spring-ldap.version},
org.springframework.ldap.ldif;version=${spring-ldap.version},
org.springframework.ldap.ldif.parser;version=${spring-ldap.version},
org.springframework.ldap.ldif.support;version=${spring-ldap.version},
org.springframework.ldap.ldif.batch;version=${spring-ldap.version},
org.springframework.ldap.odm.annotations;version=${spring-ldap.version},
org.springframework.ldap.odm.core;version=${spring-ldap.version},
org.springframework.ldap.odm.tools;version=${spring-ldap.version},
org.springframework.ldap.odm.typeconversion;version=${spring-ldap.version},
org.springframework.ldap.pool;version=${spring-ldap.version},
org.springframework.ldap.pool.factory;version=${spring-ldap.version},
org.springframework.ldap.pool.validation;version=${spring-ldap.version},
org.springframework.ldap.support;version=${spring-ldap.version},
org.springframework.ldap.transaction.compensating;version=${spring-ldap.version},
org.springframework.ldap.transaction.compensating.manager;version=${spring-ldap.version},
org.springframework.transaction.compensating.support;version=${spring-ldap.version},
org.springframework.transaction.compensating;version=${spring-ldap.version}
On 31.10.2012, at 20:14, Wesley Alan Wright <[email protected]> wrote:
> I have this in my
> /opt/matterhorn/trunk/modules/matterhorn-runtime-dependencies/pom.xml
>
> <dependency>
> <groupId>org.opencastproject</groupId>
> <artifactId>org.springframework.ldap</artifactId>
> <version>1.3.1.RELEASE</version>
> </dependency>
>
> <dependency>
> <groupId>org.springframework.security</groupId>
> <artifactId>spring-security-ldap</artifactId>
> <version>${springsecurity.version}</version>
> </dependency>
>
> I have these in /opt/matterhorn/trunk/lib/ext/
>
> org.springframework.ldap-1.3.1.RELEASE.jar
> spring-security-ldap-3.1.0.RELEASE.jar
>
> these lines are in /opt/matterhorn/trunk/etc/system.properties
>
> # Add for LDAP authentication support
> file:${felix.home}/lib/ext/spring-jdbc-3.1.0.RELEASE.jar \
> file:${felix.home}/lib/ext/org.springframework.ldap-1.3.1.RELEASE.jar \
> file:${felix.home}/lib/ext/spring-security-ldap-3.1.0.RELEASE.jar \
>
> Finally, I add these to mh_default_org.xml
>
> <bean id="contextSource"
>
> class="org.springframework.security.ldap.DefaultSpringSecurityContextSource">
> <constructor-arg value="ldaps://ldap.uvm.edu/dc=edu,dc=uvm"/>
> </bean>
>
> what do I get for all my effort?
>
> ERROR (SpringSecurityConfigurationArtifactInstaller:121) - Unable to refresh
> spring security configuration file
> /opt/matterhorn/trunk/etc/security/mh_default_org.xml:
> org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find
> class [org.springframework.security.ldap.DefaultSpringSecurityContextSource]
> for bean with name 'contextSource' defined in OSGi
> resource[file:/opt/matterhorn/trunk/etc/security/mh_default_org.xml|bnd.id=142|bnd.sym=matterhorn-kernel];
> nested exception is java.lang.ClassNotFoundException:
> org.springframework.security.ldap.DefaultSpringSecurityContextSource not
> found from bundle [matterhorn-kernel]
>
>
> ?
>
>
> -----------------------------------------------------------------------
> | Wesley Alan Wright <mailto:[email protected]> |
> | Center for Teaching and Learning __0__ |
> | Room 407 Lafayette Building / \ | \ |
> | University of Vermont \77 |
> | Burlington, Vermont 05405-0160 USA. \\ http://www.uvm.edu/skivt-l |
> | Voice: 802-656-1254 vv |
> | aim:goim?screenname=maddogskideath http://www.uvm.edu/~waw/ |
> -----------------------------------------------------------------------
>
>
>
>
>
> _______________________________________________
> Matterhorn-users mailing list
> [email protected]
> http://lists.opencastproject.org/mailman/listinfo/matterhorn-users
_______________________________________________
Matterhorn-users mailing list
[email protected]
http://lists.opencastproject.org/mailman/listinfo/matterhorn-users