Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

DriverManager.getConnection deadlocks if AWT/Swing gui is loaded

843807Dec 17 2009 — edited Feb 12 2010
I have the following code (most of the gui made using the NetBeans ide):
    public static void main(String[] args) {
        launch(AuctioneerGui.class, args);
        Class.forName("oracle.jdbc.OracleDriver").newInstance();
        System.out.println("1");
        System.out.println(Thread.currentThread().toString());
        System.out.println(SwingUtilities.isEventDispatchThread());
        Connection conn = DriverManager.getConnection(dbUrl, dbUser, dbPass);
        System.out.println("2");                         
The output is:

1
Thread[main,5,main]
false

As you can see, no exception is thrown, and the program halts forever on the getConnection statement.

This only happens if the DB is remote, if it is locally it doesn't get stuck. Additionally, if I comment the GUI builder and run it with a remote DB, it works again.

Anyone has any tip as to why this is happening?

Edited by: TylerDurden83 on Dec 17, 2009 3:01 AM

Edited by: TylerDurden83 on Dec 17, 2009 3:01 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 15 2010
Added on Dec 17 2009
1 comment
100 views