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

  • BeanCreationException

    I am following the reference guide by Arthursson and Sandberg that comes with Spring-Ldap 1.1.2, but have had no luck getting it to work. I think I might be missing some knowledge that is assumed by the document. Here is my app. context.

    Code:
    <!-- LDAP Settings-->
            <bean id="contextSource"
    		class="org.springframework.ldap.support.LdapContextSource">		
                    <property name="url" value="ldap://persona.tu.ir:389"/>
    		<property name="base" value="dc=tu,dc=ir"/>
    		<property name="userName" value="cn=something"/>
    		<property name="password" value="secret"/>
    		<property name="dirObjectFactory" value="org.springframework.ldap.support.DefaultDirObjectFactory" />
    	</bean>
    	<bean id="ldapOperations" class="org.springframework.ldap.LdapTemplate">
    		<constructor-arg ref="contextSource" />
    	</bean>
    	<bean id="LdapUserDao" class="taxonomy.dao.spring.SpringLdapUserDao">
    		<property name="ldapOperations" ref="ldapOperations"/>
    	</bean>
    I think I may be having a library issue, but not sure, these are the libraries that I am using right now for spring.
    • spring.jar (v2.0)
    • spring-ldap-1.1.2.jar
    • commons-collections.jar
    • commons-lang.jar
    • commons-logging.jar
    • ldapbp.jar
    • spring-orm.jar

    Finally this is the error that I am getting.

    Code:
    2006-12-19 09:02:55 StandardContext[/taxonomy]Loading Spring root WebApplicationContext
    2006-12-19 09:02:56 StandardContext[/taxonomy]Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contextSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.apache.commons.lang.ArrayUtils.isEmpty([Ljava/lang/Object;)Z
    Caused by: java.lang.NoSuchMethodError: org.apache.commons.lang.ArrayUtils.isEmpty([Ljava/lang/Object;)Z
    	at org.springframework.ldap.support.AbstractContextSource.afterPropertiesSet(AbstractContextSource.java:240)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1057)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1024)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:421)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:140)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:273)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:346)
    	at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156)
    	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
    	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
    	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4343)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
    	at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
    	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
    	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
    	at org.apache.catalina.core.StandardService.start(StandardService.java:480)
    	at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
    	at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:324)
    	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
    	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
    Do I need to have a class to initialize the contextSource (like a LdapServerManager) or is that something that spring takes care of? In the sample program that comes with spring-ldap they have something like this:

    Code:
    <bean name="ldapServerManager" class="org.springframework.ldap.LdapServerManager">
    		<property name="contextSource" ref="contextSource" />
    		<property name="ldifFile" value="setup_data.ldif" />
    	 </bean>
    which I assume is what I'm missing.

    any help would be appreciated.

    Thanks,

    Tyler Perkins

  • #2
    I would say you have the wrong version of commons-lang. Make sure you use commons-lang 2.1.

    With regards to the usage of LdapServerManager, that's just an internal helper class that we used to simplify the bootstrapping of an in-memory ApacheDS LDAP-server for our integration tests and our sample application.

    Comment


    • #3
      It is likely that a newer version of commons-lang is required; your present version doesn't appear to have a required method.

      Comment


      • #4
        Hey thanks guys, that did the job. Ive been updating libraries and have found that it is not a very fun job. I've successfully upgraded from struts 1.1 to struts 2.0 and spring 1.1 to spring 2.0. Now I will attempt to update Hibernate.

        Thanks again,
        Tyler Perkins

        Comment


        • #5
          Hello, there,

          I got the same error, I upgraded the commons-lang to commons-lang-2.3jar and still got the same error. Do I have to upgrade anything else to get it work? How do you find out the spring version?

          Thanks!

          Comment


          • #6
            You will find the version of all Spring jars in the META-INF/MANIFEST.MF file.

            Comment


            • #7
              I just verified that the integration tests and the person sample works fine with commons-lang 2.3.

              Comment

              Working...
              X