Exception occurs when compiling script
When I try to run any script, eg. the following script:
/**
Created by IntelliJ IDEA.
User: akrieg
Date: Sep 10, 2007
Time: 9:31:12 PM
To change this template use File | Settings | File Templates.
*/
//This is a list
List items = ["foo", "bar","baz"];
//This is a Map
Map]]> map = ["foo":"bar", "baz":"bat"];
// or weakly typed
def foo = map;
assert foo == map;
for (item in items){
println item;
}
for (entry in map){
println entry.key" "entry.value;
}
//Can define classes just like in Java
// This is a GroovyBean, which generates its own getters and setters
class MyBean implements Runnable {
String name;
public void run() {
print (name);
}
}
MyBean myBean = new MyBean();
//Getters and setters defined by default
myBean.setName("fred");
// or shorthand will call setName
myBean.name ="Jimmy";
myBean.run();
I get:
java.lang.SecurityException: Prohibited package name: java.lang
at java.lang.ClassLoader.preDefineClass(ClassLoader.java:534)
at java.lang.ClassLoader.defineClass(ClassLoader.java:669)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:143)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:143)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:121)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:160)
I'm getting this with the latest version of JetGroovy available from the plugins. I tried posting this to Jira but got an error there, so sod it. It's in the forum.
Please sign in to leave a comment.
That exception is triggered by jdk classes getting to the class path of groovy class loader. It is a known problem now, that this happens when setting up IDEA sdk as a project jdk. Is it the case for you?
This case should be fixed in the next 1.5 release.
So, right now it is impossible to run .groovy script files from the IDE?
For the fun of it I parsed out the execution string that IDEA runs when it runs a groovy script.
Why does it have to be this long with the -classpath specified for both the JVM and groovy?
Is there anyway to shorten it?
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/bin/java
-Dgroovy.home=/dv/java/codehaus/groovy
-Dfile.encoding=MacRoman
-classpath
/dv/java/codehaus/grails/lib/ant-junit.jar:
/dv/java/codehaus/grails/lib/log4j-1.2.15.jar:
/dv/java/codehaus/grails/lib/jsp-api-2.0.jar:
/dv/java/codehaus/grails/lib/ehcache-1.2.4.jar:
/dv/java/codehaus/grails/lib/svnkit.jar:
/dv/java/codehaus/grails/lib/bsf-2.3.0.jar:
/dv/java/codehaus/grails/lib/jstl-2.3.jar:
/dv/java/codehaus/grails/lib/xpp3_min-1.1.3.4.O.jar:
/dv/java/codehaus/grails/lib/spring-webflow-2.0-m1.jar:
/dv/java/codehaus/grails/lib/commons-io-1.2.jar:
/dv/java/codehaus/grails/lib/commons-collections-3.2.jar:
/dv/java/codehaus/grails/lib/commons-pool-1.2.jar:
/dv/java/codehaus/grails/lib/standard-2.3.jar:
/dv/java/codehaus/grails/lib/commons-cli-1.0.jar:
/dv/java/codehaus/grails/lib/jasper-compiler-5.5.15.jar:
/dv/java/codehaus/grails/lib/commons-dbcp-1.2.1.jar:
/dv/java/codehaus/grails/dist:
/dv/java/codehaus/grails/lib/serializer.jar:
/dv/java/codehaus/grails/lib/commons-logging-1.1.jar:
/dv/java/codehaus/grails/lib/spring-binding-2.0-m1.jar:
/dv/java/codehaus/grails/lib/ant-nodeps.jar:
/dv/java/codehaus/grails/lib/spring-2.5.1.jar:
/dv/java/codehaus/grails/lib/jetty-naming-6.1.4.jar:
/dv/java/codehaus/grails/lib/cglib-nodep-2.1_3.jar:
/dv/java/codehaus/grails/dist/grails-test-1.0.jar:
/dv/java/codehaus/grails/lib/oro-2.0.8.jar:
/dv/java/codehaus/grails/dist/grails-spring-1.0.jar:
/dv/java/codehaus/grails/lib/jasper-compiler-jdt-5.5.15.jar:
/dv/java/codehaus/grails/lib/groovy-all-1.5.4.jar:
/dv/java/codehaus/grails/dist/grails-gorm-1.0.jar:
/dv/java/codehaus/grails/lib/hsqldb-1.8.0.5.jar:
/dv/java/codehaus/grails/lib/xercesImpl.jar:
/dv/java/codehaus/grails/dist/grails-webflow-1.0.jar:
/dv/java/codehaus/grails/lib/standard-2.4.jar:
/dv/java/codehaus/grails/lib/commons-el-1.0.jar:
/dv/java/codehaus/grails/dist/grails-core-1.0.jar:
/dv/java/codehaus/grails/lib/jetty-util-6.1.4.jar:
/dv/java/codehaus/grails/lib/jaxen-1.1-beta-11.jar:
/dv/java/codehaus/grails/lib/start.jar:
/dv/java/codehaus/grails/lib/ant-launcher.jar:
/dv/java/codehaus/grails/lib/springmodules-sandbox.jar:
/dv/java/codehaus/grails/lib/xstream-1.2.1.jar:
/dv/java/codehaus/grails/lib/ejb3-persistence.jar:
/dv/java/codehaus/grails/lib/sitemesh-2.3.jar:
/dv/java/codehaus/grails/lib:
/dv/java/codehaus/grails/lib/gant-1.1.0_groovy-1.5.2.jar:
/dv/java/codehaus/grails/lib/jasper-runtime-5.5.15.jar:
/dv/java/codehaus/grails/dist/grails-cli-1.0.jar:
/dv/java/codehaus/grails/lib/spring-test.jar:
/dv/java/codehaus/grails/lib/jline-0.9.91.jar:
/dv/java/codehaus/grails/lib/commons-beanutils-1.7.0.jar:
/dv/java/codehaus/grails/dist/grails-crud-1.0.jar:
/dv/java/codehaus/grails/lib/commons-lang-2.1.jar:
/dv/java/codehaus/grails/lib/jstl-2.4.jar:
/dv/java/codehaus/grails/lib/servlet-api-2.5-6.1.4.jar:
/dv/java/codehaus/grails/lib/hibernate-annotations.jar:
/dv/java/codehaus/grails/lib/jetty-6.1.4.jar:
/dv/java/codehaus/grails/lib/hibernate3.jar:
/dv/java/codehaus/grails/lib/jta.jar:
/dv/java/codehaus/grails/lib/commons-validator-1.3.0.jar:
/dv/java/codehaus/grails/dist/grails-web-1.0.jar:
/dv/java/codehaus/grails/lib/commons-fileupload-1.1.1.jar:
/dv/java/codehaus/grails/lib/spring-webmvc.jar:
/dv/java/codehaus/grails/lib/xalan.jar:
/dv/java/codehaus/grails/lib/antlr-2.7.6.jar:
/dv/java/codehaus/grails/lib/jdbc2_0-stdext.jar:
/dv/java/codehaus/grails/lib/junit-3.8.2.jar:
/dv/java/codehaus/grails/lib/ant.jar:
/dv/java/codehaus/grails/lib/ant-trax.jar:
/dv/java/codehaus/grails/lib/dom4j-1.6.1.jar:
/dv/java/codehaus/grails/lib/ognl-2.6.9.jar:
/dv/java/codehaus/grails/lib/jetty-plus-6.1.4.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/deploy.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/dt.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/jce.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/plugin.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/sa-jdi.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/charsets.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/classes.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/dt.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/jce.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/jconsole.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/jsse.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/laf.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/ui.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/apple_provider.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/dnsns.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/localedata.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/sunjce_provider.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/sunpkcs11.jar:
/bt/proj/grailstest/out/production/grailstest:
/bt/proj/grailstest/lib
org.codehaus.groovy.tools.GroovyStarter
--main groovy.ui.GroovyMain
--classpath
/bt/proj/grailstest/scripts:
/dv/java/codehaus/grails/lib/ant-junit.jar:
/dv/java/codehaus/grails/lib/log4j-1.2.15.jar:
/dv/java/codehaus/grails/lib/jsp-api-2.0.jar:
/dv/java/codehaus/grails/lib/ehcache-1.2.4.jar:
/dv/java/codehaus/grails/lib/svnkit.jar:
/dv/java/codehaus/grails/lib/bsf-2.3.0.jar:
/dv/java/codehaus/grails/lib/jstl-2.3.jar:
/dv/java/codehaus/grails/lib/xpp3_min-1.1.3.4.O.jar:
/dv/java/codehaus/grails/lib/spring-webflow-2.0-m1.jar:
/dv/java/codehaus/grails/lib/commons-io-1.2.jar:
/dv/java/codehaus/grails/lib/commons-collections-3.2.jar:
/dv/java/codehaus/grails/lib/commons-pool-1.2.jar:
/dv/java/codehaus/grails/lib/standard-2.3.jar:
/dv/java/codehaus/grails/lib/commons-cli-1.0.jar:
/dv/java/codehaus/grails/lib/jasper-compiler-5.5.15.jar:
/dv/java/codehaus/grails/lib/commons-dbcp-1.2.1.jar:
/dv/java/codehaus/grails/dist:
/dv/java/codehaus/grails/lib/serializer.jar:
/dv/java/codehaus/grails/lib/commons-logging-1.1.jar:
/dv/java/codehaus/grails/lib/spring-binding-2.0-m1.jar:
/dv/java/codehaus/grails/lib/ant-nodeps.jar:
/dv/java/codehaus/grails/lib/spring-2.5.1.jar:
/dv/java/codehaus/grails/lib/jetty-naming-6.1.4.jar:
/dv/java/codehaus/grails/lib/cglib-nodep-2.1_3.jar:
/dv/java/codehaus/grails/dist/grails-test-1.0.jar:
/dv/java/codehaus/grails/lib/oro-2.0.8.jar:
/dv/java/codehaus/grails/dist/grails-spring-1.0.jar:
/dv/java/codehaus/grails/lib/jasper-compiler-jdt-5.5.15.jar:
/dv/java/codehaus/grails/lib/groovy-all-1.5.4.jar:
/dv/java/codehaus/grails/dist/grails-gorm-1.0.jar:
/dv/java/codehaus/grails/lib/hsqldb-1.8.0.5.jar:
/dv/java/codehaus/grails/lib/xercesImpl.jar:
/dv/java/codehaus/grails/dist/grails-webflow-1.0.jar:
/dv/java/codehaus/grails/lib/standard-2.4.jar:
/dv/java/codehaus/grails/lib/commons-el-1.0.jar:
/dv/java/codehaus/grails/dist/grails-core-1.0.jar:
/dv/java/codehaus/grails/lib/jetty-util-6.1.4.jar:
/dv/java/codehaus/grails/lib/jaxen-1.1-beta-11.jar:
/dv/java/codehaus/grails/lib/start.jar:
/dv/java/codehaus/grails/lib/ant-launcher.jar:
/dv/java/codehaus/grails/lib/springmodules-sandbox.jar:
/dv/java/codehaus/grails/lib/xstream-1.2.1.jar:
/dv/java/codehaus/grails/lib/ejb3-persistence.jar:
/dv/java/codehaus/grails/lib/sitemesh-2.3.jar:
/dv/java/codehaus/grails/lib:
/dv/java/codehaus/grails/lib/gant-1.1.0_groovy-1.5.2.jar:
/dv/java/codehaus/grails/lib/jasper-runtime-5.5.15.jar:
/dv/java/codehaus/grails/dist/grails-cli-1.0.jar:
/dv/java/codehaus/grails/lib/spring-test.jar:
/dv/java/codehaus/grails/lib/jline-0.9.91.jar:
/dv/java/codehaus/grails/lib/commons-beanutils-1.7.0.jar:
/dv/java/codehaus/grails/dist/grails-crud-1.0.jar:
/dv/java/codehaus/grails/lib/commons-lang-2.1.jar:
/dv/java/codehaus/grails/lib/jstl-2.4.jar:
/dv/java/codehaus/grails/lib/servlet-api-2.5-6.1.4.jar:
/dv/java/codehaus/grails/lib/hibernate-annotations.jar:
/dv/java/codehaus/grails/lib/jetty-6.1.4.jar:
/dv/java/codehaus/grails/lib/hibernate3.jar:
/dv/java/codehaus/grails/lib/jta.jar:
/dv/java/codehaus/grails/lib/commons-validator-1.3.0.jar:
/dv/java/codehaus/grails/dist/grails-web-1.0.jar:
/dv/java/codehaus/grails/lib/commons-fileupload-1.1.1.jar:
/dv/java/codehaus/grails/lib/spring-webmvc.jar:
/dv/java/codehaus/grails/lib/xalan.jar:
/dv/java/codehaus/grails/lib/antlr-2.7.6.jar:
/dv/java/codehaus/grails/lib/jdbc2_0-stdext.jar:
/dv/java/codehaus/grails/lib/junit-3.8.2.jar:
/dv/java/codehaus/grails/lib/ant.jar:
/dv/java/codehaus/grails/lib/ant-trax.jar:
/dv/java/codehaus/grails/lib/dom4j-1.6.1.jar:
/dv/java/codehaus/grails/lib/ognl-2.6.9.jar:
/dv/java/codehaus/grails/lib/jetty-plus-6.1.4.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/deploy.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/dt.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/jce.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/plugin.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/sa-jdi.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/charsets.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/classes.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/dt.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/jce.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/jconsole.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/jsse.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/laf.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/ui.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/apple_provider.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/dnsns.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/localedata.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/sunjce_provider.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/sunpkcs11.jar:
/bt/proj/grailstest/out/production/grailstest:
/bt/proj/grailstest/lib:
--debug
/bt/proj/grailstest/scripts/test.groovy
Here it is for a non Grails app. Again why is it sending the JDK jars to the Groovy classpath?
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/bin/java
-Dgroovy.home=/dv/java/codehaus/groovy
-Dfile.encoding=MacRoman
-classpath
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/deploy.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/dt.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/jce.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/plugin.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/sa-jdi.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/charsets.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/classes.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/dt.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/jce.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/jconsole.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/jsse.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/laf.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/ui.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/apple_provider.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/dnsns.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/localedata.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/sunjce_provider.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/sunpkcs11.jar:
/bt/proj/httptest/out/production/httptest:
/dv/java/codehaus/groovy/embeddable/groovy-all-1.5.4.jar:
/dv/java/jakarta/commons-httpclient-3.0.1/commons-httpclient-3.0.1.jar
org.codehaus.groovy.tools.GroovyStarter
--main
groovy.ui.GroovyMain
--classpath
/bt/proj/httptest:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/deploy.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/dt.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/jce.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/plugin.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/sa-jdi.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/charsets.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/classes.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/dt.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/jce.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/jconsole.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/jsse.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/laf.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/ui.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/apple_provider.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/dnsns.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/localedata.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/sunjce_provider.jar:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/sunpkcs11.jar:
/bt/proj/httptest/out/production/httptest:
/dv/java/codehaus/groovy/embeddable/groovy-all-1.5.4.jar:
/dv/java/jakarta/commons-httpclient-3.0.1/commons-httpclient-3.0.1.jar:
--debug
/bt/proj/httptest/http.groovy
Exactly the same thing occurs for me doing a "Hello, World!" using the latest plugin on a clean install (7.0.2) on Leopard. Basically, this means there is no support for os x. Anyone know of a work-around?
Hi, I basically (for now ) have downgraded the JetGroovy plugin to version 1.0.14201
I posted a short blog here:
http://www.sleberknight.com/blog/sleberkn/date/20080220
Interestingly the new version of the plugin uses groovyStarter while the older version uses GroovyShell. If you want to just grab the downgrade plugin, go get the zip file at:
http://www.sleberknight.com/blog/sleberkn/resource/JetGroovy-1.0.14201.zip
...and then just override the plugin at ~/Library/Application Support/IntelliJIDEA70/Groovy with the contents of the above ZIP file.
Looks like a Mac issue. Ilya, could you please look at this?
Any update on this? I have downgraded to the JetGroovy plugin to version 1.0.14201 and now it works again (thanks Scott!)
People keep saying its fixed in the latest plugin, well I'm using
IDEA 7.0.3
Mac OS X 10.5.2
Groovy 1.5.6
JetGroovy 1.5.16466
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-237)
and using the 1.5 plugin of JetGroovy is not working at all.
Thanks Scott, that has made my IDEA useful again :)
is there a reported bug that we can track on this issue?