Diagnosing an EclipseLink connection delay?

2019-08-02 08:00发布

I am using a GlassFish 3.1.2 server and my web application uses EclipseLink 3.1.2 as a JPA provider. GlassFish is running locally, the MySQL server is remote.

The problem is that when I start my server the server hangs for a long time, with the following line as the last thing in the log.

[#|2012-03-26T14:37:31.765-0700|INFO|glassfish3.1.2|org.eclipse.persistence.session.file:/Users/alan/NetBeansProjects/MyApp/target/MyApp/WEB-INF/classes/_com.myapp|_ThreadID=10;_ThreadName=Thread-3;|EclipseLink, version: Eclipse Persistence Services - 2.3.2.v20111125-r10461|#]

After waiting here for 2-3 minutes, it will typically continue and then act as everything is normal. My web-app works with the data base the way I would expect.

If NetBeans tries to start the server it will most often time-out, thinking that the start failed. If I start the domain with the asadmin command, it takes the same amount of time but it succeeds.

I have an identical system at home that connects to the same MySQL server that does not do this.

So how do I tell EclipseLink to tell me more about what it is waiting for?

UPDATE:

Here is my persistence.xml file -- nothing remarkable. Are there EclipseLink-specific commands that could be used to help?

<?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="com.myapp" transaction-type="JTA">
    <jta-data-source>jdbc/MyApp</jta-data-source>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
</persistence-unit>

1条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-08-02 08:57

If you run kill or ctrl break on windows, Java should dumps the current threads, so you can see what it is waiting on. Or pause the thread in a debugger.

Include your persistence.xml. Check the size of your connection pool, and if your network can access your database properly. How many classes are in your jar file? Have you tried disabling weaving or listing the classes?

查看更多
登录 后发表回答