Я пытаюсь написать небольшое приложение для использования реализации JDO DataNucleus в локальной базе данных H2. Я начинаю с удаления любой существующей базы данных H2 и воссоздаю ее с помощью простого соединения.
Однако я получаю ошибку JDOFatalUserException: Persistence Manager has been closed
и не знаю почему. Это происходит, когда я выполняю первый звонок в PM (на FeedDatabaseFR.java:59
):
Transaction tx=DataNucleus.PM.currentTransaction();
Вот вывод, который я получаю:
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 <init>
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)
Я понятия не имею, почему это происходит! У кого-нибудь есть подсказка? У кого-нибудь есть идеи, чтобы предложить? Любая помощь приветствуется! Спасибо.