Diagnosing an EclipseLink connection delay?

浪尽此生 提交于 2019-12-11 05:58:43

问题


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:


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?



来源:https://stackoverflow.com/questions/9880365/diagnosing-an-eclipselink-connection-delay

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!