This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I don't know this is the right forum but, let me try... =]
I've had the below problem in my application (JSF 2, Spring 3.1, Hibernate/JPA) when I run on Glassfish 3.1:
It seems that Spring can't load the bean.
You probably should have asked in the Spring forum, actually.
I see a definition for "entityManagerFactory" in your Spring config file. However, that definition isn't being applied. So either the config file isn't being used or there was an earlier failure in instantiating that object. If the emf couldn't be instantiated, that should have resulted in an error message in the log.
I haven't looked at the syntax for the web.xml Spring config file locations, but I do have some questions about what you did. First off, you qualified it with "classpath:", but your files aren't actually in the webapp's classpath. Secondly, you have that curious construct "*/WEB-INF". The WEB-INF directory is ALWAYS at the root of a WAR, per the J2EE spec, but you seem to be defining a case where you have several directories at the WAR root, each with a directory named WEB-INF under them. And while that's technically legal, naming a directory WEB-INF doesn't give it the magic powers that the root-level WEB-INF has, they would be plain old directories whose names just happened to be "WEB-INF" instead of something like "WEB-STUFF" or "web-inf".
So what I'd expect to see if you really wanted to keep your config files hidden from unfriendly eyes would be more like this:
An IDE is no substitute for an Intelligent Developer.
Joined: May 10, 2011
Thanks Tim Holloway
You realy helped me, with that error but, I'm still with an error when I try to run the project. =[
Now Spring can read de spring-*.xml files, but the entityManagerFactory can't be created and not even injected in my CaixaDao class.
Can you help me more one time?
Normally I'd expect that your DataSource Spring bean would be an input to an EntityManagerFactory Spring bean, and that bean would be injected into your DAOs. You don't seem to have defined that bean, so the dependent bean cannot be constructed.
For the record, all my DAOs implement the EntityManager as an injectable property, not as a constructor parameter.
Joined: May 10, 2011
But I didn't understand how can I use generic DAO like that, injected a EntityManager in all my DAO?