title: Datanucleus, JDO and executable jar - how to do it?
body: <p>I am developing a desktop app with Datanucleus and JDO for embedded H2 database. It all works fine when I run it from Eclipse, but it stops working when I try to make executable jar out of it. I get a following error:</p>
  
  <p><strong>org.datanucleus.exceptions.NucleusUserException: Persistence process has been specified to use a ClassLoaderResolver of name "jdo" yet this has not been found by the DataNucleus plugin mechanism. Please check your CLASSPATH and plugin specification.</strong></p>
  
  <p>Of course it shows that I have not configured something properly - what am I missing? If I was missing something big, it wouldn't work at all, so I am assuming it's a flawed executable jar. I have seen that error in other apps, like JPOX, where it was fixed, but without any solution given.</p>
  
  <p>Whole error stacktrace:</p>
  
  <pre><code>Exception in thread "main" javax.jdo.JDOFatalInternalException: Unexpected exception caught.
          at javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1193)
          at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:808)
          at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:701)
          at db.PersistenceManagerFilter.init(PersistenceManagerFilter.java:44)
          at Main.main(Main.java:26)
  NestedThrowablesStackTrace:
  java.lang.reflect.InvocationTargetException
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
          at java.lang.reflect.Method.invoke(Unknown Source)
          at javax.jdo.JDOHelper$16.run(JDOHelper.java:1965)
          at java.security.AccessController.doPrivileged(Native Method)
          at javax.jdo.JDOHelper.invoke(JDOHelper.java:1960)
          at javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1166)
          at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:808)
          at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:701)
          at db.PersistenceManagerFilter.init(PersistenceManagerFilter.java:44)
          at Main.main(Main.java:26)
  Caused by: org.datanucleus.exceptions.NucleusUserException: Persistence process has been specified to use a ClassLoaderResolver of name "jdo" yet this has not been found by the DataNucleus plugin mechanism. Please check your CLASSPATH and plugin specification.
          at org.datanucleus.NucleusContext.&lt;init&gt;(NucleusContext.java:233)
          at org.datanucleus.NucleusContext.&lt;init&gt;(NucleusContext.java:196)
          at org.datanucleus.NucleusContext.&lt;init&gt;(NucleusContext.java:174)
          at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.&lt;init&gt;(JDOPersistenceManagerFactory.java:364)
          at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.createPersistenceManagerFactory(JDOPersistenceManagerFactory.java:294)
          at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.getPersistenceManagerFactory(JDOPersistenceManagerFactory.java:195)
          ... 12 more
  </code></pre>
  
  <p>The line it points to is PersistenceManagerFilter init method:</p>
  
  <pre><code>pmf = JDOHelper.getPersistenceManagerFactory(getProperties());
  </code></pre>
  
  <p>Properties file looks like that:</p>
  
  <pre><code>    javax.jdo.PersistenceManagerFactoryClass=org.datanucleus.api.jdo.JDOPersistenceManagerFactory
  datanucleus.ConnectionDriverName=org.h2.Driver
  datanucleus.ConnectionURL=jdbc:h2:datanucleus
  datanucleus.ConnectionUserName=sa
  datanucleus.ConnectionPassword=
  </code></pre>
  
  <p>I have all dependencies from maven, with a goal to deploy with dependencies. Dependencies are as stated on datanucleus page <a href="http://www.datanucleus.org/products/datanucleus/jdo/maven.html" rel="noreferrer">http://www.datanucleus.org/products/datanucleus/jdo/maven.html</a></p>
  
  <p>Any ideas?</p>