Announcement Announcement Module
Collapse
No announcement yet.
Spring LDAP Transactions Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring LDAP Transactions

    Hello guys,

    Im new in this little world, and Im trying to develope a Spring Ldap Transaction and I have serious problems with the Spring bean creation.

    I have this config XML file:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans 
    	http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
    
    	<bean id="ldapContextSource" class="org.springframework.ldap.core.support.LdapContextSource">
    		<property name="url" value="ldap://localhost:10389" />
    		<property name="base" value="dc=***,dc=com" />
    		<property name="authenticationSource" ref="authenticationSource" />
    		<property name="pooled" value="false" />
    		<property name="baseEnvironmentProperties">
    			<map>
    				<entry key="com.sun.jndi.ldap.connect.timeout" value="500" />
    				<entry key="java.naming.referral" value="follow" />
    			</map>
    		</property>
    	</bean>
    
    	<bean id="authenticationSource"
    		class="org.springframework.ldap.authentication.DefaultValuesAuthenticationSourceDecorator">
    		<property name="target" ref="springSecurityAuthenticationSource" />
    		<property name="defaultUser" value="uid=admin,ou=system" />
    		<property name="defaultPassword" value="secret" />
    	</bean>
    
    	<bean id="springSecurityAuthenticationSource"
    		class="org.springframework.security.ldap.authentication.SpringSecurityAuthenticationSource" />
    
    	<bean id="ldapTransactionContextSource"
    		class="org.springframework.ldap.transaction.compensating.manager.TransactionAwareContextSourceProxy">
    		<constructor-arg ref="ldapContextSource" />
    	</bean>
    
    	<bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate">
    		<constructor-arg ref="ldapTransactionContextSource" />
    	</bean>
    
    	<bean id="transactionManager"
    		class="org.springframework.ldap.transaction.compensating.manager.ContextSourceTransactionManager">
    		<property name="contextSource" ref="ldapTransactionContextSource" />
    	</bean>
    
    	<bean id="userDaoTarget" class="com.***.daos.UserDao">
    		<property name="ldapTemplate" ref="ldapTemplate" />
    	</bean>
    
    	<bean id="userDao"
    		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    		<property name="transactionManager" ref="transactionManager" />
    		<property name="target" ref="userDaoTarget" />
    		<property name="transactionAttributes">
    			<props>
    				<prop key="*">PROPAGATION_REQUIRES_NEW</prop>
    			</props>
    		</property>
    	</bean>
    </beans>
    And I have problems when the "userDaoTarget" bean is created because it trows this exception:
    Code:
    java.lang.NoClassDefFoundError: org.springframework.beans.FatalBeanException
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:997)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:943)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:605)
    	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:925)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:472)
    	at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:140)
    	at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:84)
    Finaly my UserDao.class is the next code:
    Code:
    public class UserDao extends CommonDao implements ICommonDao<User> {
    
        private LdapTemplate ldapTemplate;
    
        public void setLdapTemplate(LdapTemplate ldapTemplate) {
            this.ldapTemplate = ldapTemplate;
        }
    }
    Can someone help me with the bean creation? I think that the code is correct but i dont know what happens...

    Thanks all for your time

  • #2
    Anyone can help me or know how or where can i get more information.

    Comment

    Working...
    X