title: JDOFatalUserException: Persistence Manager has been closed
body: <p>I am trying to write a small application to use DataNucleus' JDO implementation on a local H2 database. I start by deleting any existing H2 DB and recreate it with a simple connection.</p>
  
  <p>However, I get a <code>JDOFatalUserException: Persistence Manager has been closed</code> error and I don't know why. This happens when I perform the first call to PM (at <code>FeedDatabaseFR.java:59</code>):</p>
  
  <pre><code>Transaction tx=DataNucleus.PM.currentTransaction();
  </code></pre>
  
  <p>Here is the output I get:</p>
  
  <pre><code>C:/Temp/FWDB/
  jdbc:h2:file:C:/Temp/FWDB/FWDB;MODE=MySQL
  Connection retrieved
  Connection closed
  Creating PersistenceManagerFactory
  01-mars-2012 17:30:42 org.datanucleus.store.rdbms.table.AbstractTable create
  INFO: Creating table DELETEME1330619442915
  01-mars-2012 17:30:42 org.datanucleus.store.rdbms.table.AbstractTable drop
  INFO: Dropping table DELETEME1330619442915
  01-mars-2012 17:30:42 org.datanucleus.store.rdbms.RDBMSStoreManager initialiseSchema
  INFO: Initialising Catalog "fwdb", Schema "public" using "None" auto-start option
  01-mars-2012 17:30:42 org.datanucleus.store.rdbms.RDBMSStoreManager initialiseSchema
  INFO: Catalog "fwdb", Schema "public" initialised - managing 0 classes
  01-mars-2012 17:30:42 org.datanucleus.NucleusContext logConfiguration
  INFO: ================= Persistence Configuration ===============
  01-mars-2012 17:30:42 org.datanucleus.NucleusContext logConfiguration
  INFO: DataNucleus Persistence Factory - Vendor: "DataNucleus"  Version: "3.0.0.release"
  01-mars-2012 17:30:42 org.datanucleus.NucleusContext logConfiguration
  INFO: DataNucleus Persistence Factory initialised for datastore URL="jdbc:h2:file:C:/Temp/FWDB/FWDB;MODE=MySQL" driver="org.h2.Driver" userName="sa"
  01-mars-2012 17:30:42 org.datanucleus.NucleusContext logConfiguration
  INFO: ===========================================================
  PersistenceManagerFactory is not null
  Creating PersistenceManager
  01-mars-2012 17:30:42 org.datanucleus.api.jdo.metadata.JDOMetaDataManager &lt;init&gt;
  INFO: Registering listener for metadata initialisation
  PersistenceManager is not null
  01-mars-2012 17:30:43 org.datanucleus.api.jdo.metadata.JDOMetaDataManager$MetaDataRegisterClassListener registerClass
  INFO: Listener found initialisation for persistable class net.dwst.findword.DataNucleus.RawBeginItem
  01-mars-2012 17:30:43 org.datanucleus.api.jdo.metadata.JDOAnnotationReader processClassAnnotations
  INFO: Class "net.dwst.findword.DataNucleus.RawBeginItem" has been specified with JDO annotations so using those.
  01-mars-2012 17:30:43 org.datanucleus.store.StoreDataManager registerStoreData
  INFO: Managing Persistence of Class : net.dwst.findword.DataNucleus.RawBeginItem [Table : RAWBEGINITEM, InheritanceStrategy : new-table]
  01-mars-2012 17:30:43 org.datanucleus.store.rdbms.table.AbstractTable create
  INFO: Creating table RAWBEGINITEM
  01-mars-2012 17:30:43 org.datanucleus.api.jdo.metadata.JDOMetaDataManager$MetaDataRegisterClassListener registerClass
  INFO: Listener found initialisation for persistable class net.dwst.findword.DataNucleus.RawEndItem
  01-mars-2012 17:30:43 org.datanucleus.api.jdo.metadata.JDOAnnotationReader processClassAnnotations
  INFO: Class "net.dwst.findword.DataNucleus.RawEndItem" has been specified with JDO annotations so using those.
  01-mars-2012 17:30:43 org.datanucleus.store.StoreDataManager registerStoreData
  INFO: Managing Persistence of Class : net.dwst.findword.DataNucleus.RawEndItem [Table : RAWENDITEM, InheritanceStrategy : new-table]
  01-mars-2012 17:30:43 org.datanucleus.store.rdbms.table.AbstractTable create
  INFO: Creating table RAWENDITEM
  01-mars-2012 17:30:43 org.datanucleus.api.jdo.metadata.JDOMetaDataManager$MetaDataRegisterClassListener registerClass
  INFO: Listener found initialisation for persistable class net.dwst.findword.DataNucleus.RawContainItem
  01-mars-2012 17:30:43 org.datanucleus.api.jdo.metadata.JDOAnnotationReader processClassAnnotations
  INFO: Class "net.dwst.findword.DataNucleus.RawContainItem" has been specified with JDO annotations so using those.
  01-mars-2012 17:30:43 org.datanucleus.store.StoreDataManager registerStoreData
  INFO: Managing Persistence of Class : net.dwst.findword.DataNucleus.RawContainItem [Table : RAWCONTAINITEM, InheritanceStrategy : new-table]
  01-mars-2012 17:30:43 org.datanucleus.store.rdbms.table.AbstractTable create
  INFO: Creating table RAWCONTAINITEM
  01-mars-2012 17:30:43 org.datanucleus.api.jdo.metadata.JDOMetaDataManager$MetaDataRegisterClassListener registerClass
  INFO: Listener found initialisation for persistable class net.dwst.findword.DataNucleus.RawMadeOfItem
  01-mars-2012 17:30:43 org.datanucleus.api.jdo.metadata.JDOAnnotationReader processClassAnnotations
  INFO: Class "net.dwst.findword.DataNucleus.RawMadeOfItem" has been specified with JDO annotations so using those.
  01-mars-2012 17:30:43 org.datanucleus.store.StoreDataManager registerStoreData
  INFO: Managing Persistence of Class : net.dwst.findword.DataNucleus.RawMadeOfItem [Table : RAWMADEOFITEM, InheritanceStrategy : new-table]
  01-mars-2012 17:30:43 org.datanucleus.store.rdbms.table.AbstractTable create
  INFO: Creating table RAWMADEOFITEM
  Exception in thread "main" javax.jdo.JDOFatalUserException: Persistence Manager has been closed
      at org.datanucleus.api.jdo.JDOPersistenceManager.assertIsOpen(JDOPersistenceManager.java:2193)
      at org.datanucleus.api.jdo.JDOPersistenceManager.currentTransaction(JDOPersistenceManager.java:383)
      at net.dwst.findword.FR.FeedDatabaseFR.main(FeedDatabaseFR.java:59)
  </code></pre>
  
  <p>I have absolutely no idea why this happens! Anyone has a clue? Anyone has ideas to suggest? Any help is welcome! Thanks.</p>