This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Scenario: DB server is on LAN. Workstation connects through a SQUID proxy to access the internet. Proxy Exception list is deployed to stations in the format of 10.* or *.company.com. Expected Behavior: Database connections should bypass proxy for local addresses and connect to resources. Observed Behavior: Database connections time out while connecting to proxy. This Does Occur: When using the Netbeans IDE with a "Java Desktop Application (Basic Application)" (GUI) AND - When using Tools --> Options --> General --> Proxy Settings --> System Proxy OR - When using Tools --> Options --> General --> Proxy Settings --> No Proxy OR - When using Tools --> Options --> General --> Proxy Settings --> Manual Proxy This Does Not Occur: When using the Netbeans IDE with a "Java Application" (No GUI) OR When using the Netbeans IDE with a "Java Desktop Application (Basic Application)" (GUI) AND - When host is added explicitely WITHOUT wildcard to: Control Panel --> Internet Options --> Connections --> LAN Settings --> Advanced --> Exceptions Additional Notes: The following returns true, suggesting the proxy settings may not be the culprit: - System.out.println(InetAddress.getByName(IP_ADDRESS).isReachable(3000)); This behavior exists with the following drivers: jTDS: net.sourceforge.jtds.jdbc.Driver (latest) - SQLException: Network error IOException: Malformed reply from SOCKS server AS400: com.ibm.as400.access.AS400JDBCDriver (latest) - SQLException: The application requester cannot establish the connection. (Malformed reply from SOCKS server) MYSQL: com.mysql.jdbc.Driver (latest) - CommunicationsException: Communications link failure Links to other bugs/posts with this same behavior: http://www.netbeans.org/issues/show_bug.cgi?id=125588 (Search "oracle") http://www.netbeans.org/issues/show_bug.cgi?id=131164 http://forum.java.sun.com/thread.jspa?threadID=5278678 This behavior has been found to occur on two workstations in our company, both running Windows XP SP2, in Netbeans versions 6.0, 6.0.1, 6.1. This behavior does not occur during creation of a "Java Desktop Application (Datababase Application)" but does occur during Run. -Tres
I would like to add a confirmation that this issue carries over to Ubuntu 8.04, however, the proxy exception work-around does not fix it. Disabling the proxy altogether however is a temporary work-around. For our organization this seems to break a major component of applications developed with NetBeans 6.x. -Tres
Given that now you can't even configure the OS to work around this issue, raising to a P2. I'm not sure yet how to fix it, but we'll give it the ol' college try as part of the bugfix phase of this release.
By the way, thanks for the *excellent* description. Top notch.
Are you getting all these exceptions when connecting to a database in the Services tab in NetBeans, or are they thrown by your Java application which you are running from NetBeans?
>> Are you getting all these exceptions when connecting to a database in the >> Services tab in NetBeans, or are they thrown by your Java application >> which you are running from NetBeans? Java Application. I'm not familiar with Services tab method. The only GUI method I've tried is "Java Desktop Application --> Database Application" with similar results. No GUI, no error. >> This behavior does not occur during creation of a "Java Desktop Application >> Datababase Application)" but does occur during Run. Thanks, -Tres
Not an issue in the database support then. Looks the Java SE project type isn't setting the proxy when running the application, but was it ever supposed to do that?
Java SE 5.0 is fine, and so is Java SE 6.0. This bug only occurs when using the GUI builder. If I make a GUI from scratch, this bug does not occur. -Tres
>> If I make a GUI from scratch, this bug does not occur. Rephrased: "If I make a GUI/Form from strictly code, this bug does not occur, it only occurs when using the NetBeans IDE to create my GUI/Form" -Tres
Same bug (but database is oracle in my case). That's exactly how Tres described.
Update: Made some more ground work. I noticed on a Mac that this bug didn't carry over. So I checked: Apple --> System Preferences --> Network --> Advanced --> Proxies Since Mac has no check box to "Use this proxy for all protocols", the SOCKS proxy section is left blank. WORKAROUND #2: Leave SOCKS proxy connections BLANK in Network Connections and "Use this proxy for all protocols" is NOT checked. This works for Windows too. Will test Ubuntu shortly. -Tres
If I understand correctly then the problem occurs during execution of Java Desktop Applications applications only. I am not able to reproduce it. So, I have to ask you to do some experiments to help us localize the problem. You wrote already that your testConnection() method works correctly when it is invoked from main() method directly (e.g. with no GUI). You also mentioned that exactly the same method fails when it is executed as a part of some Task that is invoked when some button is pressed. Could you, please, try the following scenarios and let us know whether the connection can be established or not? Thank you in advance. 1. Ordinary event handler in Java Desktop Appplication a) Create new Java Desktop Application based on Basic (not Database!) application shell. b) Add new JButton c) Select the JButton and invoke Events > Action > actionPerformed menu item from the contextual menu of this JButton d) Put invocation of your testConnection() method into the generated jButton1ActionPerformed() method. e) Clean, Build and Execute the project and try to press the button. f) Was the connection established successfully? 2. Ordinary action in Java Desktop Application a) Create new Java Desktop Application based on Basic (not Database!) application shell. b) Add new JButton c) Select JButton and invoke Set Action ... from the contextual menu of this JButton d) Select Create New Action ... from the combo-box at the top of the dialog. e) Specify 'myMethod' in Action's Method: text-field. f) Specify 'MyButton' in Text: text-field. g) Press OK. h) Put invocation of your testConnection() method into the generated myMethod() method. i) Clean, Build and Execute the project and try to press the button. j) Was the connection established successfully? 3. Background task in Java Desktop Application (I assume that this is one of the scenarios you already mentioned, but I want to make sure that it is covered) a) Create new Java Desktop Application based on Basic (not Database!) application shell. b) Add new JButton c) Select JButton and invoke Set Action ... from the contextual menu of this JButton d) Select Create New Action ... from the combo-box at the top of the dialog. e) Specify 'myAnotherMethod' in Action's Method: text-field. f) Specify 'MyAnotherButton' in Text: text-field. g) Check Background Task: check-box. h) Press OK. i) Put invocation of your testConnection() method into the doInBackground() method of the generated MyAnotherMethodTask. j) Clean, Build and Execute the project and try to press the button. k) Was the connection established successfully? 4. DB connection in a project using Java Persistence, but outside Java Desktop Application a) Create new (ordinary) Java Application (not Java Desktop Application!) b) Create new Master/Detail Sample Form (in File > New File > Swing GUI Forms) in some package. Use some DB table from the problematic DB connection. c) Add new JButton (next to other buttons) into the generated form. d) Select the JButton and invoke Events > Action > actionPerformed menu item from the contextual menu of this JButton e) Put invocation of your testConnection() method into the generated jButton1ActionPerformed() method. f) Clean, Build and Execute the generated Master/Detail form and try to press the button. g) Was the connection established successfully? You wrote that it sometimes takes several minutes before the exception (signaling unsuccessful attempt to establish the connection) is thrown. Could you, please, attach a thread dump taken during this wait-period. Thank you in advance. See http://wiki.netbeans.org/GenerateThreadDump if you don't know how to generate a thread dump.
Option #1, #2, and #3, bug occurs, yes. I have not tried option #4. I have not obtained a "thread dump". I will perform option #4 and I will attempt to deliver a thread dump. I will attach the thread dump as a file if supported. -Tres
P.S. jstola - Thank you for the detailed follow-up. I'm eager to deliver requested results. -Tres
Thank you very much for your additional information. It clearly shows that the problem is somewhere in Swing Application Framework (that is used to build Java Desktop Application). Finally, I (hopefully) found the problematic line in Swing Application Framework. It is located in org.jdesktop.application.Application.create() method. This method sets "java.net.useSystemProxies" system property to "true". This property is used by default ProxySelector to determine correct proxies. The workaround is to invoke ProxySelector.getDefault() in main() method - this will force initialization of the ProxySelector before the problematic change in the system property is made. Another workaround is to set the mentioned property back to "false" in startup() method of your application e.g. invoke System.setProperty ("java.net.useSystemProxies", "false"); Please, let me know whether this workaround works for you. I would like to make sure that we identified the root of this issue correctly before I will move this issue into bug-tracking system of Swing Application Framework. Thank you in advance.
More people complained about this on appframework users list. There's also https://appframework.dev.java.net/issues/show_bug.cgi?id=69
Hi jstola, I had same bug as Tres described. Both workarounds you suggested worked fine. :-) Thanks a lot. Regards, Evandro
Thank you for testing the workarounds. I will close this issue as "will not fix" because it is caused by suspicious feature of Swing Application Framework and it doesn't seem to be correct to switch this feature off (e.g. use one of the mentioned workarounds) automatically because it could break other use-cases.
Hi jstola, Will be it open another issue concerning this subject in Swing Application Framework area? Regards, Evandro
> Will be it open another issue concerning this subject in Swing Application Framework area? There already is an issue about this problem, but it is not very verbose: https://appframework.dev.java.net/issues/show_bug.cgi?id=69 Feel free to add your comments/suggestions there or just monitor it by putting yourself on CC of that issue.
Thanks jstola. Best regards.
This news made my week. Thanks all that were involved. This will certainly increase my productivity with the Netbeans IDE! -Tres
*** Issue 150057 has been marked as a duplicate of this issue. ***
*** Issue 149698 has been marked as a duplicate of this issue. ***
*** Issue 163565 has been marked as a duplicate of this issue. ***
*** Issue 166947 has been marked as a duplicate of this issue. ***
*** Issue 165181 has been marked as a duplicate of this issue. ***
*** Issue 170437 has been marked as a duplicate of this issue. ***
*** Bug 200590 has been marked as a duplicate of this bug. ***