title: getting error Invalid property 'packagesToScan' of bean class[..]. Bean property 'packagesToScan' is not writable or has an invalid setter method
body: <p>I am getting the following error</p>
  
  <blockquote>
    <p>Caused by: org.springframework.beans.NotWritablePropertyException: Invalid 
        property 'packagesToScan' of bean 
        class[org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]: Bean
        property 'packagesToScan' is not writable or has an invalid setter method. Does 
        the parameter type of the setter match the return type of the getter?\</p>
  </blockquote>
  
  <p>I am using spring3.2. Dependencies are added using MAven. Everything seems ok. Why i am getting this error. Here is my file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:context="http://www.springframework.org/schema/context"
  xmlns:jdbc="http://www.springframework.org/schema/jdbc"
  xmlns:jpa="http://www.springframework.org/schema/data/jpa"
  xmlns:tx="http://www.springframework.org/schema/tx"
  xsi:schemaLocation="http://www.springframework.org/schema/beans 
                      http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
                      http://www.springframework.org/schema/context 
                      http://www.springframework.org/schema/context/spring-context-3.2.xsd
                      http://www.springframework.org/schema/jdbc 
                      http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd
                      http://www.springframework.org/schema/data/jpa 
                      http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd
                      http://www.springframework.org/schema/tx 
                      http://www.springframework.org/schema/tx/spring-tx-3.2.xsd"&gt;
  
  ....
  &lt;bean id="emf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt;
      &lt;property name="dataSource" ref="dataSource" /&gt;
      &lt;property name="jpaVendorAdapter"&gt;
          &lt;bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" /&gt;
      &lt;/property&gt;        
      &lt;property name="packagesToScan" value="pk.training.basitMahmood.domain"/&gt;
      &lt;property name="jpaProperties"&gt;
          &lt;props&gt;
              &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.H2Dialect&lt;/prop&gt;
              &lt;prop key="hibernate.max_fetch_depth"&gt;3&lt;/prop&gt;
              &lt;prop key="hibernate.jdbc.fetch_size"&gt;50&lt;/prop&gt;
              &lt;prop key="hibernate.jdbc.batch_size"&gt;10&lt;/prop&gt;
              &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;              
          &lt;/props&gt;        
      &lt;/property&gt;
  &lt;/bean&gt;    
  
  &lt;context:annotation-config/&gt; 
  
  .....
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>Thanks</p>