0
我被卡在岩石和困難的地方之間此刻此刻的問題。如果我定義我的持久化上下文爲:Glassfish EJB 3 OpenJPA 2
@PersistenceContext(unitName = "persistentUnit")
private EntityManager entityManager;
Glassfish的拒絕開始與錯誤:
SEVERE: Could not resolve a persistence unit corresponding to the persistence-context-ref-name [com.ckd.business.MusicService/entityManager] in the scope of the module called [home]. Please verify your application.
但是,如果我改變了聲明:
[email protected](name = "persistentUnit")
private EntityManager entityManager;
GlassFish是能夠部署我的WAR文件,但當我加載頁面時,我得到這個:
java.lang.IllegalStateException: Unable to retrieve EntityManagerFactory for unitName null
幹什麼?!我已經根據需要將persistence.xml文件保存到WEB-INF \ classes \ META-INF目錄,並且看到Glassfish正確加載了JPA。但不管我做什麼,Glassfish總是失敗。我正在使用Glassfish 3.1 OpenSource Edition。
有沒有人知道這個解決方案或解決方法?謝謝。
感謝您的評論,但我已經在** persistence.xml **文件中指定了** name =「persistentUnit」**。最後,我不得不從硬盤驅動器中刪除Glassfish服務器,重新下載並重新開始。它現在似乎工作。儘管爲什麼Glassfish沒有報告說它沒有工作 - 即使日誌文件中的一行可能會有幫助 - 我什麼都沒有。阿爾格,這太令人沮喪了。 – ChuongPham 2011-03-23 14:55:27