Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: using ldap : exception

  1. #1

    Default using ldap : exception

    good evening ,

    I'm tring to use ldap for authentication but I have this problem always :

    Code:
    [ERROR,ContextLoader] Context initialization failed
    java.lang.NoSuchMethodError: org.springframework.web.context.ConfigurableWebApplicationContext.setId(Ljava/lang/String;)V
    	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:264)
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
    	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
    	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    	at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
    	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    	at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    29 sept. 2010 17:58:25 org.apache.catalina.core.StandardContext listenerStart
    GRAVE: Exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de classe d'écoute (listener) org.springframework.web.context.ContextLoaderListener
    java.lang.NoSuchMethodError: org.springframework.web.context.ConfigurableWebApplicationContext.setId(Ljava/lang/String;)V
    	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:264)
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
    	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
    	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    	at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
    	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    	at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    My security context is
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans:beans xmlns="http://www.springframework.org/schema/security"
    			 xmlns:beans="http://www.springframework.org/schema/beans"
    			 xmlns:security="http://www.springframework.org/schema/security"
    			 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.0.xsd
    									   http://www.springframework.org/schema/security
    									   http://www.springframework.org/schema/security/spring-security-3.0.3.xsd">
    									   		   						 
    									   
    	<security:http auto-config='true'>
    	    <security:intercept-url pattern="/index.htm*" filters="none"/>
    	    <security:intercept-url pattern="/logo*" filters="none"/>  
    		<security:intercept-url pattern="/vermeg.css" filters="none"/> 
    		<security:intercept-url pattern="/login.jsp*" filters="none"/>
    		<security:intercept-url pattern="/Managing.html" access="ROLE_ADMIN" />
    		<security:intercept-url pattern="/Application.html" access="ROLE_USER" />
    		<security:intercept-url pattern="/**" access="ROLE_USER" />
    		<security:form-login login-page='/login.jsp' authentication-failure-url="/login.jsp?login_error=1" />
    		<security:logout logout-success-url="/index.htm" />	
    	</security:http>	
    	
    	 <!--  Simple namespace-based configuration  --> 
    	 <security:ldap-server ldif="classpath:users.ldif" port="10389" />
    	 
    	 <security:authentication-manager>
      		<security:ldap-authentication-provider group-search-filter="member={0}" group-search-base="ou=groups" user-search-base="ou=people" user-search-filter="uid={0}" /> 
      		<security:authentication-provider ref="secondLdapProvider" /> 
      	 </security:authentication-manager>
         <!--  Traditional Bean version of the same configuration   --> 
         <!--  This bean points at the embedded directory server created by the ldap-server element above  --> 
    	
       	 <beans:bean id="contextSource" class="org.springframework.security.ldap.DefaultSpringSecurityContextSource">
           <beans:constructor-arg value="ldap://localhost:10389/dc=springframework,dc=org" /> 
         </beans:bean>
    	 
    	<beans:bean id="secondLdapProvider" class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider">
     	 <beans:constructor-arg>
      		<beans:bean class="org.springframework.security.ldap.authentication.BindAuthenticator">
      			 <beans:constructor-arg ref="contextSource" /> 
      				<beans:property name="userSearch">
      					<beans:bean id="userSearch" class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch">
      						<beans:constructor-arg index="0" value="ou=users" /> 
      						<beans:constructor-arg index="1" value="(uid={0})" /> 
      						<beans:constructor-arg index="2" ref="contextSource" /> 
      	       			</beans:bean>
      				</beans:property>
      		</beans:bean>
      	 </beans:constructor-arg>
      	 <beans:constructor-arg>
    		 <beans:bean class="org.springframework.security.ldap.userdetails.DefaultLdapAuthoritiesPopulator">
      			<beans:constructor-arg ref="contextSource" /> 
      			<beans:constructor-arg value="ou=groups" /> 
      			<beans:property name="groupSearchFilter" value="(member={0})" /> 
      			<beans:property name="rolePrefix" value="ROLE_" /> 
      			<beans:property name="searchSubtree" value="true" /> 
      			<beans:property name="convertToUpperCase" value="true" /> 
      		 </beans:bean>
      	 </beans:constructor-arg>
        </beans:bean> 										
    	
    </beans:beans>

    any help will be apreciated
    thanks

  2. #2
    Join Date
    Jan 2008
    Posts
    1,826

    Default

    What version of spring-context do you have? It looks like it is loading the 2.x version of ConfigurableApplicationContext. You should have all the same versions of spring on your classpath (i.e. all 3.x).
    Rob Winch - @rob_winch
    Spring Security Lead
    Pivotal

  3. #3

    Default still don't want to work

    thanks I didn't remark That I put 2 spring context of 2 versions
    but I still have aa problem :

    Code:
    [ERROR,ContextLoader] Context initialization failed
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.apacheDirectoryServerContainer': Resolution of declared constructors on bean Class [org.springframework.security.ldap.server.ApacheDSContainer] from ClassLoader [WebappClassLoader
      delegate: false
      repositories:
        /WEB-INF/classes/
    ----------> Parent Classloader:
    org.apache.catalina.loader.StandardClassLoader@19c26f5
    ] failed; nested exception is java.lang.NoClassDefFoundError: org/apache/directory/shared/ldap/exception/LdapNameNotFoundException
    	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:155)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:993)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:897)
    	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:291)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:574)
    	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
    	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
    	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
    	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    	at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
    	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    	at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    Caused by: java.lang.NoClassDefFoundError: org/apache/directory/shared/ldap/exception/LdapNameNotFoundException
    	at java.lang.Class.getDeclaredConstructors0(Native Method)
    	at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
    	at java.lang.Class.getDeclaredConstructors(Unknown Source)
    	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:152)
    	... 29 more
    Caused by: java.lang.ClassNotFoundException: org.apache.directory.shared.ldap.exception.LdapNameNotFoundException
    	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1360)
    	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206)
    	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    	... 33 more
    I attached an image of what I use as libraries.

    Thanks
    Attached Images Attached Images

  4. #4
    Join Date
    Jan 2008
    Posts
    1,826

    Default

    What are you using to manage dependencies (i.e. ivy, maven, gradle, manually, etc)? I would suggest you checkout the Spring Security ldap sample and look at the dependencies listed on it. You can perform this using gradle --dependencies. Alternatively you can Goolge for your error and it will tell you the missing jar.
    Rob Winch - @rob_winch
    Spring Security Lead
    Pivotal

  5. #5

    Default

    Actually I manage them manually . I tried google but I didn't put the write keys words I think thanks for the help I'm gooing to try this now and I will keep you informed.

    Thanks

  6. #6
    Join Date
    Sep 2004
    Location
    Manchester, NH
    Posts
    1,236

    Default

    If you are managing them yourself, you'll need to include almost all the JARs shipped with ApacheDS. As Rob says, it's easiest just to have a tool manage the dependencies for you
    Peter Mularien | Blog
    Author, Spring Security 3 (Book) - Packt Publishing, Available in print and eBook form
    SCJP 5, Oracle DBA
    Any postings are my own opinion, and should not be attributed to my employer or clients.


  7. #7

    Default

    Thanks,

    I did include them But still have that problem. I want to know what can offert me a manager and if doesn't bother you can you suggest me a tool for managing dependencies but a simple one please(A day or less to understand it and use it).


    Thanks

  8. #8
    Join Date
    Jan 2008
    Posts
    1,826

    Default

    I prefer maven because it is simple and well established. If you use eclipse, I recommend the m2eclipse plugin.
    Rob Winch - @rob_winch
    Spring Security Lead
    Pivotal

  9. #9

    Default

    I installed it but I didn't found a simple tutorial to use it.

  10. #10
    Join Date
    Sep 2004
    Location
    Manchester, NH
    Posts
    1,236

    Default

    I'm not really sure how we can help you further; we've provided many pointers to ways you can make this work. Maven is well-documented, and there are lots of tutorials and books available to help you learn how to use it.
    Peter Mularien | Blog
    Author, Spring Security 3 (Book) - Packt Publishing, Available in print and eBook form
    SCJP 5, Oracle DBA
    Any postings are my own opinion, and should not be attributed to my employer or clients.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •