Entity manager error on the server?
Hi I have developed my java application on glassfish server with EJB 3.0 persistance. On my local machine the application was running fine and was persisti开发者_如何学运维ng the data perfectly. However, When I deployed it on the linux server, whenever I persist any data it gives me this EJB exception error:
Caused by: Java.lang.IllegalStateException: Attempting to execute an operation on a closed EntityManagerFactory.
And here is my persistence.xml file:
<?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>
what could possbily cause this?
PS: Im using Glassfish 3.1.43, EJB 3.0
What database are you using? I would verify that the user you have configured in the connection pool has the privilege to create tables.
I have managed to solve it finally!! The problem was in the database connection that was not set properly!! Now I have connected to the database and the data are persisted!!
精彩评论