2011-08-18 35 views
0

您好我已經在EJB 3.0持久性的glassfish服務器上開發了我的Java應用程序。在我的本地機器上,應用程序運行正常並且完美地保存了數據。然而,當我部署它在Linux服務器上,每當我堅持任何數據它給了我這個EJB異常錯誤:服務器上的實體管理器錯誤?

Caused by: Java.lang.IllegalStateException: Attempting to execute an operation on a closed EntityManagerFactory. 

這裏是我的persistence.xml文件:

<?xml version="1.0" encoding="UTF-8" ?> 
    <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> 
    <persistence-unit name="MyPU" transaction-type="JTA"> 
     <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> 
     <jta-data-source>jdbc/security</jta-data-source> 
     <exclude-unlisted-classes>false</exclude-unlisted-classes> 
     <properties> 
      <property name="eclipselink.ddl-generation" value="create-tables" /> 
     </properties> 
    </persistence-unit> 
    </persistence> 

什麼事情possbily導致這個?

PS:我使用Glassfish 3.1.43,EJB 3.0

回答

0

我終於設法解決了!問題是數據庫連接沒有正確設置!現在我已經連接到數據庫並且數據被保存了!

1

您使用的數據庫是?我將驗證您在連接池中配置的用戶是否有權創建表。

相關問題