Announcement Announcement Module
Collapse
No announcement yet.
Error: No setter found for property 'packagesToScan'. At servlet-context.xml Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error: No setter found for property 'packagesToScan'. At servlet-context.xml

    Hello

    I've been wondering about what sub-forum is the right one for this issue. If Data sub-forum is more appropiate, just let me know

    Trying to connect Hibernate 3 with my Spring application, I wrote this bean at servlet-context.xml:

    Code:
    <beans:bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    	<beans:property	name="dataSource" ref="dataSource"/>
    	<beans:property name="packagesToScan" value="cat.tfcproject.springmvc.domain"/>
    	<beans:property	name="hibernateProperties">
    		<beans:props>
    			<beans:prop	key="dialect">org.hibernate.dialect.HSQLDialect</beans:prop>
    		</beans:props>
    	</beans:property>
    </beans:bean>
    No errors, except packagesToScan. I have no idea about how to create a setter for 'packagesToScan', where it has suppose to be created, or how to set it.

    I read in some forums looking for an answer, that application has to be implemented under a recent Spring version, 3.1 or upper, but I already have 3.2.0.RELEASE version, as 'Help' main-menu option indicates me



    Any Idea?

  • #2
    Use Spring 3.2.2 or later... This property was added later.

    Comment


    • #3
      Thanks, your comment has been helpful.

      'packagesToScan' attribute is associated, in my case, with a 'org.springframework.orm...' class, so the only thing to do is to add the suitable and updated 'orm' dependency, from 'org.springframework' artifact, into pom.xml file:

      Code:
      <dependency>
      	<groupId>org.springframework</groupId>
      	<artifactId>spring-orm</artifactId>
      	<version>3.2.3.RELEASE</version>
      </dependency>
      You'll found all maven dependences at http://mvnrepository.com/
      Last edited by bonetky; Jun 5th, 2013, 10:20 AM.

      Comment


      • #4
        NEVER update only a single module always use all the jars belonging to the SAME version... NEVER NEVER mix different versions of jars from a framework!

        Comment


        • #5
          Okay, is there some way to update, for example, all org.springframework dependencies at once? or they have to be included/changed one by one

          Comment


          • #6
            No you have to change one by one. But since you are using maven, you can have a version property and use it, without hard coding the version every where.

            Code:
            	<properties>
            		<spring.version>3.2.3.RELEASE</spring.version>
            	</properties>
            
            	<dependencies>
            		<dependency>
            			<groupId>org.springframework</groupId>
            			<artifactId>spring-core</artifactId>
            			<version>${spring.version}</version>
            		</dependency>
            
            		<dependency>
            			<groupId>org.springframework</groupId>
            			<artifactId>spring-beans</artifactId>
            			<version>${spring.version}</version>
            		</dependency>
            	</dependencies>

            Comment


            • #7
              This is a good way to be sure you have de same version of all artifacts from same group dependences. Thank you very much

              Thread solved

              Comment

              Working...
              X