1

I'm trying to install and run Java EE 6 Tutorial examples. In this particular case, Duke's Forest Case Study Example. No problem with first install step "To Create the JDBC Realm and Populate the Database", apparently the JavaDB is created and populated. But in second step I'm getting the following error trying to connect to JavaDB: "An error occurred while creating the database: java.sql.SqlNonTransientConnectionException: A communications error has been detected: Software caused connection abort: recv failed.."

The strange thing is that although connecting JavaDB seems not to work, the db creation using "ant" with the tutorial scripts seems to work. And furthermore, starting the JavaDB Server seems to work as well, showing a message stating it is ready and listening on port 1527.

Similar problem asked in Getting a java.sql.SqlNonTransientConnectionException.

I'm running Windows XP, NetBeans 8.1, JDK 1.7.0_60.

Community
  • 1
  • 1
madvargas
  • 21
  • 1
  • 8
  • At which point to you get this exception? Do you have maybe different Glassfish versions installed in Netbeans? – SubOptimal Jan 25 '16 at 12:31
  • Point 5 in the tutorial (second step), after opening the project, trying to associate the data source. I have just one Glassfish server installed. – madvargas Jan 26 '16 at 08:29
  • Please check the following. **1)** Under `Services` what is the name of the Glassfish Server. **2)** After you start the Glassfish server. Do you have under `Resources -> JDBC Resources` a resource named `jdbc/forest`? – SubOptimal Jan 26 '16 at 08:37
  • The name is "GlassFish Server". I don't have a resource named `jdbc/forest`, because when I try to add this datasource to the project, the error is shown. – madvargas Jan 26 '16 at 09:19

1 Answers1

0

Finally, I found the problem. It's a little tricky, although now it seems obvious. I use two different network configurations for browsing, one using a Socks v5 proxy (in Chrome) and one without a proxy (in Firefox). The one in Chrome is the Windows XP default and now I know that Netbeans use this.

When I executed the 'ant' script (step 1 in the tutorial), I use a command line window, which it seems not to use the default Windows network configuration. So I got no errors. But, when I tried to connect from Netbeans, the error was shown.

Now, I've eliminated the proxy in the default network configuration, I've restarted Netbeans and it works!

NOTE: After that, I found the “Proxy Settings” in the NetBeans Options dialog. By default, NetBeans set “Use System Proxy Settings”. So, I thought that changing to “No proxy”, everything would go well, but no. The JavaDB connection worked, but when I tried to start Glassfish, found that it use the proxy configuration for network connection. I have also found a check in the NetBeans Glassfish server configuration dialog (Java Tab) named “Use IDE’s proxy settings” that seemed to be related to this question, but after several testing, I found that didn’t work.

madvargas
  • 21
  • 1
  • 8