8

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

Jyotirmoy Sundi
  • 355
  • 1
  • 5
  • 12
  • I had a similar problem. What you need to do is check data nucleus/jdo/jpa versions used in your new project. Different versions may have different syntactic implementations of classes that are corresponding to a data model. – mert Dec 01 '12 at 09:36

3 Answers3

3

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)
Shedolamack
  • 319
  • 1
  • 4
0

(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

steff_bdh
  • 1,108
  • 2
  • 15
  • 32
-2

This is because enhancer does not properly enhance your entities. You should enhance entities.

olyanren
  • 1,448
  • 4
  • 24
  • 42
  • The error has nothing to do with entities. The entity manager is what is not being initialized. – Shedolamack Jun 14 '13 at 03:43
  • @Shedolamack actually it can be related to entities. I encountered this error twice. In both cases I was only changing annotations in entities' relation and suddenly the problem appeared. I tried to clear DB and to restore previous annotations but I wasn't able to solve it. – HAL9000 May 08 '14 at 08:47