title: Maven/GAE - Missing some Datanucleus classes
body: <p>I have been struggling for hours trying to figure the good pom.xml out for my already existing GAE/J project.</p>
  
  <p>Here is the "most working" version of my pom.xml (and it's probably terribly messy):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
  &lt;!-- The Basics --&gt;
  &lt;groupId&gt;com.***&lt;/groupId&gt;
  &lt;artifactId&gt;***&lt;/artifactId&gt;
  &lt;version&gt;0.3-SNAPSHOT&lt;/version&gt;
  &lt;packaging&gt;war&lt;/packaging&gt;
  
  &lt;name&gt;***&lt;/name&gt;
  
  &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;downloadSources&gt;true&lt;/downloadSources&gt;
  
      &lt;!-- GAE SPECIFICS --&gt;
      &lt;!-- Upload to http://test.latest.&lt;applicationName&gt;.appspot.com by default --&gt;
      &lt;gae.application.version&gt;test&lt;/gae.application.version&gt;
      &lt;gae.version&gt;1.6.1&lt;/gae.version&gt;
      &lt;gae.sdk.version&gt;1.6.1&lt;/gae.sdk.version&gt;
      &lt;gae.port&gt;8888&lt;/gae.port&gt;
      &lt;datanucleus.gae.version&gt;1.0.10&lt;/datanucleus.gae.version&gt;
      &lt;datanucleus.version&gt;3.0.5&lt;/datanucleus.version&gt;
  
      &lt;!-- Web --&gt;
      &lt;servlet.version&gt;2.5&lt;/servlet.version&gt;
      &lt;spring.version&gt;3.0.5.RELEASE&lt;/spring.version&gt;
  
      &lt;!-- Data --&gt;
      &lt;jdo.version&gt;2.3-ea&lt;/jdo.version&gt;
  
      &lt;!-- Validation --&gt;
      &lt;validation.version&gt;1.0.0.GA&lt;/validation.version&gt;
      &lt;hibernate.validator.version&gt;4.2.0.Final&lt;/hibernate.validator.version&gt;
  
      &lt;!-- Utils --&gt;
      &lt;log.version&gt;1.6.1&lt;/log.version&gt;
  
      &lt;!-- Test --&gt;
      &lt;mockito.version&gt;1.8.5&lt;/mockito.version&gt;
      &lt;junit.version&gt;4.8.2&lt;/junit.version&gt;
  &lt;/properties&gt;
  
  &lt;dependencies&gt;
  
      &lt;!-- Google App Engine meta-package --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;net.kindleit&lt;/groupId&gt;
          &lt;artifactId&gt;gae-runtime&lt;/artifactId&gt;
          &lt;version&gt;${gae.version}&lt;/version&gt;
          &lt;type&gt;pom&lt;/type&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Web --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
          &lt;version&gt;${spring.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
          &lt;artifactId&gt;spring-security-web&lt;/artifactId&gt;
          &lt;version&gt;${spring.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
          &lt;artifactId&gt;spring-security-config&lt;/artifactId&gt;
          &lt;version&gt;${spring.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
          &lt;artifactId&gt;spring-security-taglibs&lt;/artifactId&gt;
          &lt;version&gt;${spring.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
          &lt;artifactId&gt;servlet-api&lt;/artifactId&gt;
          &lt;version&gt;${servlet.version}&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Data --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.jdo&lt;/groupId&gt;
          &lt;artifactId&gt;jdo2-api&lt;/artifactId&gt;
          &lt;version&gt;${jdo.version}&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;javax.transaction&lt;/groupId&gt;
                  &lt;artifactId&gt;transaction-api&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.datanucleus&lt;/groupId&gt;
          &lt;artifactId&gt;datanucleus-core&lt;/artifactId&gt;
          &lt;version&gt;${datanucleus.version}&lt;/version&gt;
          &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;javax.transaction&lt;/groupId&gt;
                  &lt;artifactId&gt;transaction-api&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.datanucleus&lt;/groupId&gt;
          &lt;artifactId&gt;datanucleus-api-jpa&lt;/artifactId&gt;
          &lt;version&gt;3.0.5&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.transaction&lt;/groupId&gt;
          &lt;artifactId&gt;jta&lt;/artifactId&gt;
          &lt;version&gt;1.1&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.datanucleus&lt;/groupId&gt;
          &lt;artifactId&gt;datanucleus-rdbms&lt;/artifactId&gt;
          &lt;version&gt;${datanucleus.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.appengine.orm&lt;/groupId&gt;
          &lt;artifactId&gt;datanucleus-appengine&lt;/artifactId&gt;
          &lt;version&gt;1.0.10&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.geronimo.specs&lt;/groupId&gt;
          &lt;artifactId&gt;geronimo-jpa_2.0_spec&lt;/artifactId&gt;
          &lt;version&gt;1.0&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Validation --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
          &lt;version&gt;${hibernate.validator.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.validation&lt;/groupId&gt;
          &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
          &lt;version&gt;${validation.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;javax.persistence&lt;/groupId&gt;
          &lt;artifactId&gt;persistence-api&lt;/artifactId&gt;
          &lt;version&gt;1.0&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;javax.transaction&lt;/groupId&gt;
          &lt;artifactId&gt;jta&lt;/artifactId&gt;
          &lt;version&gt;1.1&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- J2EE Servlet API. We need it to compile IndexServlet class. You can 
          probably remove it, if you don't explicitly use Servlets --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.geronimo.specs&lt;/groupId&gt;
          &lt;artifactId&gt;geronimo-servlet_2.5_spec&lt;/artifactId&gt;
          &lt;version&gt;1.2&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Make use of JSP tags. Remove, if you don't use JSPs --&gt;
      &lt;dependency&gt;
          &lt;artifactId&gt;standard&lt;/artifactId&gt;
          &lt;groupId&gt;taglibs&lt;/groupId&gt;
          &lt;version&gt;1.1.2&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
          &lt;scope&gt;runtime&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;!-- These dependencies are here just for enabling logging --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
          &lt;version&gt;1.6.1&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;
          &lt;artifactId&gt;logback-classic&lt;/artifactId&gt;
          &lt;version&gt;0.9.24&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.mockito&lt;/groupId&gt;
          &lt;artifactId&gt;mockito-all&lt;/artifactId&gt;
          &lt;version&gt;${mockito.version}&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;version&gt;${junit.version}&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;!-- GAE libraries for local testing as described here: http://code.google.com/appengine/docs/java/howto/unittesting.html --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.appengine&lt;/groupId&gt;
          &lt;artifactId&gt;appengine-api-labs&lt;/artifactId&gt;
          &lt;version&gt;${gae.version}&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.appengine&lt;/groupId&gt;
          &lt;artifactId&gt;appengine-api-stubs&lt;/artifactId&gt;
          &lt;version&gt;${gae.version}&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.appengine&lt;/groupId&gt;
          &lt;artifactId&gt;appengine-testing&lt;/artifactId&gt;
          &lt;version&gt;${gae.version}&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;!-- This plug-in "enhances" your domain model objects (i.e. makes them 
              persistent for datanucleus) --&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.datanucleus&lt;/groupId&gt;
              &lt;artifactId&gt;maven-datanucleus-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.0.1&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;!-- Make sure this path contains your persistent classes! --&gt;
                  &lt;mappingIncludes&gt;**/model/*.class&lt;/mappingIncludes&gt;
                  &lt;verbose&gt;true&lt;/verbose&gt;
                  &lt;enhancerName&gt;ASM&lt;/enhancerName&gt;
                  &lt;api&gt;JPA&lt;/api&gt;
              &lt;/configuration&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;phase&gt;compile&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;enhance&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
              &lt;dependencies&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;org.datanucleus&lt;/groupId&gt;
                      &lt;artifactId&gt;datanucleus-core&lt;/artifactId&gt;
                      &lt;version&gt;${datanucleus.version}&lt;/version&gt;
                      &lt;exclusions&gt;
                          &lt;exclusion&gt;
                              &lt;groupId&gt;javax.transaction&lt;/groupId&gt;
                              &lt;artifactId&gt;transaction-api&lt;/artifactId&gt;
                          &lt;/exclusion&gt;
                      &lt;/exclusions&gt;
                  &lt;/dependency&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;org.datanucleus&lt;/groupId&gt;
                      &lt;artifactId&gt;datanucleus-rdbms&lt;/artifactId&gt;
                      &lt;version&gt;${datanucleus.version}&lt;/version&gt;
                  &lt;/dependency&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;org.datanucleus&lt;/groupId&gt;
                      &lt;artifactId&gt;datanucleus-enhancer&lt;/artifactId&gt;
                      &lt;version&gt;3.0.1&lt;/version&gt;
                  &lt;/dependency&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;javax.jdo&lt;/groupId&gt;
                      &lt;artifactId&gt;jdo2-api&lt;/artifactId&gt;
                      &lt;version&gt;${jdo.version}&lt;/version&gt;
                      &lt;scope&gt;runtime&lt;/scope&gt;
                  &lt;/dependency&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;javax.jdo&lt;/groupId&gt;
                      &lt;artifactId&gt;jdo-api&lt;/artifactId&gt;
                      &lt;version&gt;3.0&lt;/version&gt;
                  &lt;/dependency&gt;
              &lt;/dependencies&gt;
          &lt;/plugin&gt;
  
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.1-beta-1&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;webResources&gt;
                      &lt;resource&gt;
                          &lt;directory&gt;src/main/webapp&lt;/directory&gt;
                          &lt;filtering&gt;true&lt;/filtering&gt;
                          &lt;includes&gt;
                              &lt;include&gt;**/appengine-web.xml&lt;/include&gt;
                          &lt;/includes&gt;
                      &lt;/resource&gt;
                  &lt;/webResources&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  
          &lt;!-- The actual maven-gae-plugin. Type "mvn gae:run" to run project, "mvn 
              gae:deploy" to upload to GAE. --&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;net.kindleit&lt;/groupId&gt;
              &lt;artifactId&gt;maven-gae-plugin&lt;/artifactId&gt;
              &lt;version&gt;0.9.2&lt;/version&gt;
              &lt;dependencies&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;net.kindleit&lt;/groupId&gt;
                      &lt;artifactId&gt;gae-runtime&lt;/artifactId&gt;
                      &lt;version&gt;${gae.version}&lt;/version&gt;
                      &lt;type&gt;pom&lt;/type&gt;
                  &lt;/dependency&gt;
              &lt;/dependencies&gt;
          &lt;/plugin&gt;
  
          &lt;!-- Upload application to the appspot automatically, during release:perform --&gt;
          &lt;plugin&gt;
              &lt;artifactId&gt;maven-release-plugin&lt;/artifactId&gt;
              &lt;configuration&gt;
                  &lt;goals&gt;gae:deploy&lt;/goals&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  
          &lt;!-- Java compiler version --&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.0&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;source&gt;1.6&lt;/source&gt;
                  &lt;target&gt;1.6&lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.5&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;excludes&gt;
                      &lt;exclude&gt;com/***/integration/**/*Test.java&lt;/exclude&gt;
                  &lt;/excludes&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  
  &lt;profiles&gt;
      &lt;!-- We can configure our integration server to activate this profile and 
          perform gae:deploy, thus uploading latest snapshot to the http://1.latest.&lt;applicationName&gt;.appspot.com 
          automatically --&gt;
      &lt;profile&gt;
          &lt;id&gt;integration-build&lt;/id&gt;
          &lt;properties&gt;
              &lt;gae.application.version&gt;stage&lt;/gae.application.version&gt;
          &lt;/properties&gt;
      &lt;/profile&gt;
  
      &lt;!-- This profile will activate automatically during release and upload 
          application to the http://2.latest.&lt;applicationName&gt;.appspot.com (We might 
          want to set the 2nd version as our applications Default version to be accessible 
          at http://&lt;applicationName&gt;.appspot.com) --&gt;
      &lt;profile&gt;
          &lt;id&gt;release-build&lt;/id&gt;
          &lt;activation&gt;
              &lt;property&gt;
                  &lt;name&gt;performRelease&lt;/name&gt;
                  &lt;value&gt;true&lt;/value&gt;
              &lt;/property&gt;
          &lt;/activation&gt;
  
          &lt;properties&gt;
              &lt;!-- During release, set application version in appengine-web.xml to 
                  2 --&gt;
              &lt;gae.application.version&gt;release&lt;/gae.application.version&gt;
          &lt;/properties&gt;
      &lt;/profile&gt;
  &lt;/profiles&gt;
  </code></pre>
  
  <p></p>
  
  <p>And this is what I get when running <code>mvn gae:run</code>:</p>
  
  <pre><code>WARNING: Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/***-services.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public static javax.persistence.EntityManagerFactory javax.persistence.Persistence.createEntityManagerFactory(java.lang.String)] threw exception; nested exception is java.lang.NoClassDefFoundError: org/datanucleus/OMFContext:
  java.lang.ClassNotFoundException: org.datanucleus.OMFContext
      at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
      at com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:176)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
      at org.datanucleus.jpa.EntityManagerFactoryImpl.&lt;init&gt;(EntityManagerFactoryImpl.java:293)
      at org.datanucleus.store.appengine.jpa.DatastoreEntityManagerFactory.&lt;init&gt;(DatastoreEntityManagerFactory.java:63)
      at org.datanucleus.store.appengine.jpa.DatastorePersistenceProvider.createEntityManagerFactory(DatastorePersistenceProvider.java:35)
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:150)
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:70)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:104)
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:145)
      at org.springframework.beans.factory.support.ConstructorResolver$3.run(ConstructorResolver.java:564)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:562)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:983)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:879)
  [...]
  Jan 17, 2012 11:24:55 PM com.google.apphosting.utils.jetty.JettyLogger info
  INFO: Started SelectChannelConnector@0.0.0.0:8888
  Jan 17, 2012 11:24:55 PM com.google.appengine.tools.development.DevAppServerImpl start
  INFO: The server is running at http://localhost:8888/
  Jan 17, 2012 11:24:55 PM com.google.appengine.tools.development.DevAppServerImpl start
  INFO: The admin console is running at http://localhost:8888/_ah/admin
  </code></pre>
  
  <p>I changed the version of datanucleus-core so that OMFContent could be found but then it fails even more badly.</p>
  
  <p>Any idea how to solve this? </p>