Autowiring fails: Not an managed Type

I got an very helpful advice from Oliver Gierke:

The last exception you get actually indicates a problem with your JPA
setup. “Not a managed bean” means not a type the JPA provider is aware
of. If you’re setting up a Spring based JPA application I’d recommend
to configure the “packagesToScan” property on the
LocalContainerEntityManagerFactory you have configured to the package
that contains your JPA entities. Alternatively you can list all your
entity classes in persistence.xml, but that’s usually more cumbersome.

The former error you got (NoClassDefFound) indicates the class
mentioned is not available on the projects classpath. So you might
wanna check the inter module dependencies you have. As the two
relevant classes seem to be located in the same module it might also
just be an issue with an incomplete deployment to Tomcat (WTP is kind
of bitchy sometimes). I’d definitely recommend to run a test for
verification (as you already did). As this seems to lead you to a
different exception, I guess it’s really some Eclipse glitch

Thanks!

Leave a Comment