I tried to generate a new app using ROO and it configured the pom to use the latest and greatest versions. Unfortunately, the same bean definitions I am using in another project with older versions no longer works - when I try to run a main() method as a Java Application, I get the following error:
Here are the versions I'm using in the POM:Code:Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/security/core/context/SecurityContextHolder at org.springframework.security.ldap.authentication.SpringSecurityAuthenticationSource.getPrincipal(SpringSecurityAuthenticationSource.java:32) at org.springframework.ldap.authentication.DefaultValuesAuthenticationSourceDecorator.getPrincipal(DefaultValuesAuthenticationSourceDecorator.java:96) at org.springframework.ldap.core.support.AbstractContextSource.getReadOnlyContext(AbstractContextSource.java:125) at org.springframework.ldap.core.LdapTemplate.executeReadOnly(LdapTemplate.java:792) at org.springframework.ldap.core.LdapTemplate.lookup(LdapTemplate.java:876) at org.springframework.ldap.core.simple.SimpleLdapTemplate.lookup(SimpleLdapTemplate.java:180) at com.qualcomm.corp.isso.cis.ldap.dao.LdapDAOBase.findByPrimaryKey(LdapDAOBase.java:83) at com.qualcomm.corp.isso.cis.ldap.operations.GetPerson.invoke(GetPerson.java:194) at com.qualcomm.corp.isso.cis.ldap.operations.GetPerson.main(GetPerson.java:31) Caused by: java.lang.ClassNotFoundException: org.springframework.security.core.context.SecurityContextHolder
And here is the applicationContext-ldap.xml file that is being imported into my primary applicationContext.xml file:Code:<java.version>1.6</java.version> <org.springframework.ldap-version>1.3.1.RELEASE</org.springframework.ldap-version> <org.springframework.security-version>3.1.0.RELEASE</org.springframework.security-version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <slf4j.version>1.6.2</slf4j.version> <spring.version>3.1.0.RELEASE</spring.version>
For now I'm going to revert to the older versions so that I can get my application to run but I would love to know what is wrong with the configuration for the newer versions -- or is there a bug in the latest and greatest code?Code:<!-- http://static.springsource.org/spring-ldap/site/reference/html/configuration.html#context-source-configuration --> <!-- Basic DataSource --> <bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource" p:url="${ldap.url}" p:base="${ldap.base}" p:authenticationSource-ref="authenticationSource" /> <bean id="authenticationSource" class="org.springframework.ldap.authentication.DefaultValuesAuthenticationSourceDecorator" p:target-ref="springSecurityAuthenticationSource" p:defaultUser="${ldap.user}" p:defaultPassword="${ldap.pw}" /> <bean id="springSecurityAuthenticationSource" class="org.springframework.security.ldap.authentication.SpringSecurityAuthenticationSource" /> <bean class="org.springframework.ldap.core.support.BaseLdapPathBeanPostProcessor" /> <bean id="simpleLdapTemplate" class="org.springframework.ldap.core.simple.SimpleLdapTemplate"> <constructor-arg ref="contextSource" /> </bean>
NOTE: I googled for this error and I saw that this can occur if the app is using another library which is compiled against Spring Security 2. The pom's Dependency Hierarchy does not indicate that any older versions are being used. It may also be useful to note that we are using spring-ldap-core-tiger in the app...


Reply With Quote
