Eclipselink factory.createEntityManager() stalls with more than one instance running
Posted
by Raven
on Stack Overflow
See other posts from Stack Overflow
or by Raven
Published on 2010-03-26T10:39:21Z
Indexed on
2010/03/26
10:43 UTC
Read the original article
Hit count: 559
Hi,
with my RCP program I have the problem that I want to have more than one copy running on my PC. The first instance runs very good. If I start the second instance, everything is fine until I want to access the database.
Using this code:
..
Map properties = new HashMap();
properties.put("javax.persistence.jdbc.driver", dbDriver);
properties.put("javax.persistence.jdbc.url", dbUrl);
properties.put("javax.persistence.jdbc.user", dbUser);
properties.put("javax.persistence.jdbc.password", dbPass);
try {
factory = Persistence.createEntityManagerFactory(
PERSISTENCE_UNIT_NAME, properties);
} catch (Exception e) {
System.out.println(e);
}
em=factory.createEntityManager(); // the second instance stops here
...
with an persistence.xml of
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.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_1_0.xsd">
<persistence-unit name="default">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>myclasshere</class>
<properties>
<property name="eclipselink.ddl-generation" value="create-tables" />
<property name="eclipselink.ddl-generation.output-mode" value="database" />
<property name="eclipselink.jdbc.read-connections.min" value="1" />
<property name="eclipselink.jdbc.write-connections.min" value="1" />
<property name="eclipselink.jdbc.batch-writing" value="JDBC" />
<property name="eclipselink.logging.level" value="SEVERE" />
<property name="eclipselink.logging.timestamp" value="false" />
<property name="eclipselink.logging.session" value="false" />
<property name="eclipselink.logging.thread" value="false" />
</properties>
</persistence-unit>
</persistence>
The program stalls / does not continue in the second instance beyond this step:
em=factory.createEntityManager();
Debugging the program step by step showed me, that nothing happens at this point. Perhaps the program runs into a timeout. I havent been wainting for more than 1 minute....
Do you have any clues what might cause this stall might?
© Stack Overflow or respective owner