Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 Sundi

like image 285
Jyotirmoy Sundi Avatar asked Jul 16 '11 15:07

Jyotirmoy Sundi


1 Answers

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:

  1. Make sure you have copied the appropriate .jar files into your /war/WEB-INF/lib folder
  2. Make sure you're not calling your EMF singleton from client code (if you're using GWT)
  3. 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)
like image 122
Shedolamack Avatar answered Jan 02 '23 09:01

Shedolamack