This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Learn Java with Math: Using Fun Projects and Games and have Ron Dai on-line!
See this thread for details.
Win a copy of Learn Java with Math: Using Fun Projects and Games this week in the Beginning Java forum!

alan freeman

Greenhorn
+ Follow
since Nov 25, 2014
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by alan freeman

I encountered pratap's problem (Permiission denied: connect) with a new laptop so was able to study it under more controlled conditions.
I think it is a firewall problem. I tried various other fixes that are recommended such as adding -Djava.net.preferIP4Stack=true to the command line, but these did not work.
I don't think the JDK was a cause, because I installed the latest JRE (8) and JDK (1.8)
The puzzle was also that my setup was working perfectly on an identical laptop (Yoga Pro running Windows 8.1) - I happened to have two for a brief while because the manufacturers had send me the wrong model. Only difference was memory size.
Also for this reason, a clean Windows 8.1 Install on both machines

The only differences between the setups that I could detect were
(1) the new machine (call it Yoga 2) was running ZoneAlarrm instead of McAfee
(2) the new machine could have downloaded some more recent Windows 8.1 upgrades. I don't know

To ensure a controlled environment I ran Maven from within Netbeans and set up a Maven Web Application project. The problem reproduces whether Maven is run from the command line or within NetBeans, but Netbeans gives more human-readable information (IMO as a relative Maven newbie)

What seemed to fix the problem was turning Windows Firewall off. I notice that Pratap says "I don't use Firewall" but I think it is the Windows default - at least for Windows 8 it is. So you have to consciously turn it off.

Here are the steps I took and what happened:

Uninstall Netbeans, Tomcat and Glassfish
Delete Netbeans directory in Documents
Delete .nb1 directory
Delete .m2 directory
Delete all Netbeans settings in Program Files
Delete all Netbeans settings in Appdata

JRE8 and JDK 1.8 not deleted

Download and re-install Netbeans "all" 8.0.1 with Glassfish and Tomcat enabled

Create a new Maven project (File->New->Maven->Web application
No change to Maven settings

Results

Project created and runs
Programme spends long time (>30 minuts) Importing the index
When it is finished, you can see .m2 has been populated
But the ''Services>Maven Repositories>Central Repository shows flickering 'looking for index' message

Now, the project will not build. Instead it reports that it cannot access the remote repository, with the error 'connect'

Next steps:

Disabled ZoneAlarm
Switched off Windows Firewall

Results:

Now it builds, also carries out a clean and build
Also after some downloading (<5 minutes) it displays the Central Repository
However, all this still succeeds after firewall is switched on - I suspect because it has downloaded all the dependencies that it needs.

I don't yet understand which selective Firewall Settings I should use to ensure that the Maven repository can be accessed but this should be clear from the error message ie repo1.maven.org or whatever repository the projects and plugins are trying to access.

I hope this helps somebody because the problem intrigued me but also held me up. I am sure many newbies encounter problems like this, for which there is a fix but it takes a while to find, and generally it is much harder at the early stage when you are still learning a new technology, because you can't even get to the point where the technology works, in order to study it. In this case I was lucky that it worked the first time, but not the second.

Cheers
Alan

5 years ago