When running a VERY simple URL grab script from within IntelliJ IDEA, I get:
java.net.SocketException: Permission denied: connect
but when I run it from the Groovy Console, it works just fine.
Here is the full script:
def data = new URL("http://wisc.edu").getText()
and here is the full console output from IntelliJ:
"C:\Program Files\Java\jdk1.7.0_01\bin\java" "-Dtools.jar=C:\Program Files\Java\jdk1.7.0_01\lib\tools.jar" "-Dgroovy.home=C:\Program Files (x86)\Groovy\Groovy-1.8.2" "-Dgroovy.starter.conf=C:\Program Files (x86)\Groovy\Groovy-1.8.2\conf\groovy-starter.conf" -Didea.launcher.port=7534 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 110.492\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\groovy-1.8.2.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 110.492\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.groovy.tools.GroovyStarter --conf "C:\Program Files (x86)\Groovy\Groovy-1.8.2\conf\groovy-starter.conf" --main groovy.ui.GroovyMain --classpath "C:\Users\[REDACTED]\IdeaProjects\test\out\production\test;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\ant-1.8.2.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\ant-antlr-1.8.2.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\ant-junit-1.8.2.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\ant-launcher-1.8.2.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\antlr-2.7.7.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\asm-3.2.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\asm-analysis-3.2.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\asm-commons-3.2.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\asm-tree-3.2.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\asm-util-3.2.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\balloontip-20090102.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\batik-anim-1.7.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\batik-awt-util-1.7.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\batik-bridge-1.7.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\batik-codec-1.7.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\batik-css-1.7.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\batik-dom-1.7.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\batik-ext-1.7.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\batik-extension-1.7.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\batik-gui-util-1.7.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\batik-gvt-1.7.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\batik-parser-1.7.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\batik-script-1.7.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\batik-svg-dom-1.7.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\batik-svggen-1.7.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\batik-swing-1.7.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\batik-transcoder-1.7.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\batik-util-1.7.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\batik-xml-1.7.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\bsf-2.4.0.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\commons-cli-1.2.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\commons-logging-1.1.1.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\cssbuilder-0.5.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\cssparser-0.9.5.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\easyb-0.9.8.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\extra166y-1.7.0.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\flamingo-4.1.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\flamingobuilder-0.4.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\forms-1.2.1.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\gant-1.9.6_groovy-1.8.1.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\gfxbuilder-core-0.5.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\gfxbuilder-svg-0.5.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\gfxbuilder-swingx-0.5.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\gmock-0.8.1.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\gpars-0.12.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\groovy-1.8.2.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\groovypp-0.9.0_1.8.2.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\groovyserv-0.9.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\ivy-2.2.0.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\jacob-1.14.3.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\jansi-1.6.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\jcsp-1.1-rc5.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\jide-oss-2.9.1.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\jidebuilder-4.0.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\jline-0.9.94.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\jna-3.2.2.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\jsilhouette-geom-0.4.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\jsp-api-2.0.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\jsr166y-1.7.0.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\junit-4.8.2.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\l2fprod-common-all-6.9.1.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\macwidgets-0.9.4.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\macwidgetsbuilder-0.4.1.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\maven-ant-tasks-2.1.0.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\multiplegradientpaint-1.0.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\multiverse-beta-0.7-RC-1.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\netty-3.1.5.GA.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\sac-1.3.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\scriptom-1.6.0.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\scriptom-ie-6-tlb-1.6.0.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\scriptom-office-2K3-tlb-1.6.0.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\scriptom-sapi-tlb-1.6.0.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\scriptom-scripting-tlb-1.6.0.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\scriptom-wbem-tlb-1.6.0.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\scriptom-wsh-tlb-1.6.0.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\servlet-api-2.4.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\spock-core-0.6-groovy-1.8-SNAPSHOT.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\swing-worker-1.1.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\swingx-beaninfo-1.6.2-2.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\swingx-core-1.6.2-2.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\swingxbuilder-0.1.8.1.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\swingxtrasbuilder-0.3.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\timingframework-1.0.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\trident-6.2.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\tridentbuilder-0.5.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\xml-apis-ext-1.3.04.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\xmlpull-1.1.3.1.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\xstream-1.4.1.jar;C:\Program Files (x86)\Groovy\Groovy-1.8.2\lib\xswingx-0.2.jar" --encoding=UTF-8 C:\Users\[REDACTED]\IdeaProjects\test\test.groovy
Caught: java.net.SocketException: Permission denied: connect
java.net.SocketException: Permission denied: connect
at test.run(test.groovy:9)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Process finished with exit code 1
I have absolutely no idea what is causing the problem, but my guess is that it's something IDEA is doing when it runs the groovy code that keeps it from being able to access the network.
Has anyone else experienced this? Does anyone know of a workaround?
There is a known bug in JDK 1.7 related to IPv6.
Adding -Djava.net.preferIPv4Stack=true
in VM Options should fix the problem.
See also related question on this site.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With