Announcement Announcement Module
Collapse
No announcement yet.
org.springmodules.commons.configuration.CommonsCon figurationFactoryBean in spring 3 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • org.springmodules.commons.configuration.CommonsCon figurationFactoryBean in spring 3

    Hi All!!!!

    I need help....
    I configured a spring 2.5 bean that obtain properties from db!
    Today I change my spring version: from 2.5 to 3.0.5 but I'm receiving an exception:

    Code:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'goWebPropertiesFromDB' defined in ServletContext resource [/WEB-INF/spring-properties-from-db-context.xml]: Cannot resolve reference to bean 'goWebCommonsConfigurationFactoryBean' while setting bean property 'properties'; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springmodules.commons.configuration.CommonsConfigurationFactoryBean] for bean with name 'goWebCommonsConfigurationFactoryBean' defined in ServletContext resource [/WEB-INF/spring-properties-from-db-context.xml]; nested exception is java.lang.ClassNotFoundException: org.springmodules.commons.configuration.CommonsConfigurationFactoryBean
    My beans:
    Code:
    <!-- PROPERTIES BEAN FROM DB -->	
    	<bean id="goWebPropertiesFromDB" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
        	<property name="properties" ref="goWebCommonsConfigurationFactoryBean" />
    	</bean>
    	
    	<bean class="it.niuma.goWeb.goWebOrderedPropertyPlaceholderConfigurer.GOWebOrderedPropertyPlaceholderConfigurer">
        	<constructor-arg ref="goWebPropertiesFromDB" />
    	</bean>
      	
    	<bean name="goWebCommonsConfigurationFactoryBean" class="org.springmodules.commons.configuration.CommonsConfigurationFactoryBean">
           <constructor-arg ref="goWebDatabaseConfiguration"/>
    	</bean>
    	
    	<bean name="goWebDatabaseConfiguration" class="org.apache.commons.configuration.DatabaseConfiguration">
            <constructor-arg>
       			<bean id="ds1" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
         			<property name="driverClassName" >
         				<value>${database.driver}</value>
    				</property>
         			<property name="url">
         				<value>${database.url}</value>
         			</property>
         			<property name="username">
         				<value>${database.user}</value>
         			</property>
         			<property name="password">
         				<value>${database.password}</value>
         			</property>     			
       			</bean>
       		</constructor-arg>
            <constructor-arg index="1" value="UTENTERFX.RFX_PROPERTIES_TABLE"/>
            <constructor-arg index="2" value="PROPERTY_KEY"/>
            <constructor-arg index="3" value="PROPERTY_VALUE"/>
    	</bean>
    So....which is the correct configuration in spring 3?

    Thanks in advance for suggestions!

    Have a nice week end!
    Cheers, Vale

  • #2
    Hello

    nested exception is java.lang.ClassNotFoundException:
    org.springmodules.commons.configuration.CommonsCon figurationFactoryBean
    The error is clear, such class is missing in your classpath

    Since you did a migration from Spring 2.5.x to 3.0.# some package names and jars has been changed, can you show the jars used? Are you working with Maven or Ant?

    Comment


    • #3
      Thanks for the reply!

      I'm using these jars in classpath:

      org.springframework.aop-3.0.5.RELEASE.jar
      org.springframework.asm-3.0.5.RELEASE.jar
      org.springframework.aspects-3.0.5.RELEASE.jar
      org.springframework.beans-3.0.5.RELEASE.jar
      org.springframework.context-3.0.5.RELEASE.jar
      org.springframework.context.support-3.0.5.RELEASE.jar
      org.springframework.core-3.0.5.RELEASE.jar
      org.springframework.expression-3.0.5.RELEASE.jar
      org.springframework.instrument-3.0.5.RELEASE.jar
      org.springframework.instrument.tomcat-3.0.5.RELEASE.jar
      org.springframework.jdbc-3.0.5.RELEASE.jar
      org.springframework.jms-3.0.5.RELEASE.jar
      org.springframework.orm-3.0.5.RELEASE.jar
      org.springframework.oxm-3.0.5.RELEASE.jar
      org.springframework.spring-library-3.0.5.RELEASE.libd
      org.springframework.test-3.0.5.RELEASE.jar
      org.springframework.transaction-3.0.5.RELEASE.jar
      org.springframework.web-3.0.5.RELEASE.jar
      org.springframework.web.portlet-3.0.5.RELEASE.jar
      org.springframework.web.servlet-3.0.5.RELEASE.jar
      org.springframework.web.struts-3.0.5.RELEASE.jar

      Comment


      • #4
        Hello

        The package org.springmodules.commons.configuration and class the CommonsConfigurationFactoryBean not appear in Spring API 2.5.x nor Spring API 3.0.X and even not in SpringSource Enterprise Bundle Repository

        Therefore check your jar list in your project where work with Spring 2.5, you should have a special jar which contains this missing class

        I recall I have work with this before, but I can't recall the special jar or dependency

        Comment


        • #5
          Doh!

          I have explained....
          With Spring 2.5 I need a special jar named spring-modules-x.x.jar
          My doubt is....should I use spring-modules with spring 3 like I used it with spring 2.5 or not?
          There is a new jar that replace a spring-modules?

          Sorry for my poor english
          I hope I explained my doubt....

          Thanks for your help!

          Cheers, Vale

          Comment


          • #6
            Hello

            About the spring-modules-x.x.jar never was mentioned in your first post, I assume you have downloaded such jar from springmodules, BTW the project is locked and the last release was in 06 March 2008

            My doubt is....should I use spring-modules with spring 3 like I used it with spring 2.5 or not?
            Have you tried?, how it is not part of the core, I don't think that could generate problem

            But according with the documentation

            Spring Modules is a collection of tools, add-ons and modules to extend the Spring Framework. The core goal of Spring Modules is to facilitate integration between Spring and other projects without cluttering or expanding the Spring core.
            Why you used Spring Modules + Spring 2.5.x,
            I would assume due by this

            Code:
            <bean name="goWebCommonsConfigurationFactoryBean" 
            class="org.springmodules.commons.configuration.CommonsConfigurationFactoryBean">
                   <constructor-arg ref="goWebDatabaseConfiguration"/>
            </bean>
            	
            <bean name="goWebDatabaseConfiguration"
             class="org.apache.commons.configuration.DatabaseConfiguration">
             ...
            </bean>
            I mean due by the org.apache.commons.configuration.DatabaseConfigura tion right?

            perhaps is not anymore need in Spring 3.0.x., you can use other types of configurations for this class (DatabaseConfiguration), did you research in the forum with this term?

            Let me know your advance

            Comment

            Working...
            X