Entity manager error on the server?
Asked Answered
M

2

0

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 persisting 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

Mccorkle answered 18/8, 2011 at 0:17 Comment(0)
M
0

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!!

Mccorkle answered 18/8, 2011 at 14:46 Comment(0)
C
1

What database are you using? I would verify that the user you have configured in the connection pool has the privilege to create tables.

Collete answered 18/8, 2011 at 1:37 Comment(0)
M
0

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!!

Mccorkle answered 18/8, 2011 at 14:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.