NoClassDefFoundError Could not initialize class EMFService
I have imported a an app engine project in my eclipse.It was running fine on my previous laptop, here i have copied the eclipse directory from my old machine and imported the project in it. Now I am seeing an error "java.lang.NoClassDefFoundError: Could not initialize class sharepro.java.dao.EMFService" . The error is in line "EntityManager em = EMFService.get().createEntityManager();". I have all the jars added. any pointer on whcih jar I am mising or any conf issue??
Thanks and Regards Sun开发者_StackOverflowdi
I realize this is an old post, but I just had this exact problem, and it took me a couple of hours to figure this out today (June 2013). I'm still not sure why my solution worked out (or rather, why my situation was causing the error), but this is what I did to fix it:
I had a source folder in my project structure with a /test folder, where I had some JUnit stuff. I deleted that folder, and now everything works. Weird.
Other things that I saw people suggest for this problem include the following:
- Make sure you have copied the appropriate .jar files into your /war/WEB-INF/lib folder
- Make sure you're not calling your EMF singleton from client code (if you're using GWT)
- Make sure you have enabled the Datastore option for your project (Project Properties > Google > App Engine > Datastore > Use Datanucleus JDO/JPA to access the datastore)
(I know this is an old post but in case anyone else needs help)
Your error is more than likely in your JDO, I just had this problem, I didn't annotate a JDO properly and I got the same error as you did
This is because enhancer does not properly enhance your entities. You should enhance entities.
精彩评论