Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid property 'packagesToScan' of bean class [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]

I have tried to find the solution, but still no luck.

I am following the book "Pro Spring 3" (Appress) [page 351]

I have generated the project as jpa project.

As far as I understand I can either use persistence.xml or can manage it internally in the bean, which is what I want.

For the latest we need to define packagesToScan property.

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaPersonService': Injection of persistence dependencies failed; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'emf' defined in class path resource [META-INF/app-context.xml]: Error setting property values; nested exception 
is **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?

When I try to ask for suggestions (ctrl+space) , it does not have packagesToScan property.enter image description here

What am I missing?

like image 334
Aubergine Avatar asked Dec 20 '22 21:12

Aubergine


1 Answers

'packagesToScan' property was added in Spring 3.1 (compare 3.0 and 3.1).

Make sure you are including the newest 3.1 Spring JARs in your CLASSPATH.

like image 194
Tomasz Nurkiewicz Avatar answered Jan 13 '23 17:01

Tomasz Nurkiewicz