Sanjay Sharma’s Weblog

April 9, 2009

GAE+Groovlets – local+remote with Eclipse plugin

Filed under: Java world — Tags: , , — indoos @ 8:19 am

After trying GAE for Java using core GAE SDK, went ahead to try Grails+GAE- sorry doesn’t work yet.

However, Groovy+GAE does work as explained in little tutorial. However, only production env works while development doesn’t ;)

Local deployment does not work due to groovy.security.GroovyCodeSourcePermission /groovy/shell) problem

Started trying Google Plugin for Eclipse got Groovlets+GAE working on local as well as remote environment.

Here are the steps-

GAE+Groovy+Eclipse

GAE+Groovy+Eclipse

  • Changed build.groovy file to use war folder instead of deploy folder {webinf = “war/WEB-INF” instead of webinf = “deploy/WEB-INF”}
  • Changed /.settings/com.google.appengine.eclipse.core.prefs to include groovy-all-1.6.1.jar in filesCopiedToWebInfLib

#Thu Apr 09 10:24:45 IST 2009
eclipse.preferences.version=1
filesCopiedToWebInfLib=appengine-api-1.0-sdk-1.2.0.jar|datanucleus-appengine-1.0.0.final.jar|datanucleus-core-1.1.0.jar|datanucleus-jpa-1.1.0.jar|geronimo-jpa_3.0_spec-1.1.1.jar|geronimo-jta_1.1_spec-1.1.1.jar|jdo2-api-2.3-SNAPSHOT.jar|groovy-all-1.6.1.jar|

  • The project can now be run locally using Run As >> Web Application without any groovy permission issues
  • The project can be deployed to Remote GAE using the cute little Deploy button provided by Google Eclipse Plugin {the button below Eclipse Menu bar-> Project menu in the above image}
About these ads

9 Comments »

  1. Tried your tip but unfortunately still getting (groovy.security.GroovyCodeSourcePermission /groovy/shell)

    could you please post a zip with working example?

    Comment by thevery — April 9, 2009 @ 10:55 am

  2. thevery: > I have send you a zip of the project ion your email

    Comment by indoos — April 9, 2009 @ 12:29 pm

  3. Thanks for the post, I’m optimistic this is a solution for me, but I can’t quite get it to work just yet. I’ve tried reducing this to the simplest steps just to get a groovlet to compile. So here’s what I have done, still the same error.

    Start Eclipse (google plugin is installed)
    Create new web application project.
    quit Eclipse, open shell
    cd $MYPROJECTDIR
    echo ‘|groovy-all-1.6.1.jar’ >> ./.settings/com.google.appengine.eclipse.core.prefs
    cp $GROOVY_HOME/embeddable/groovy-all-1.6.1.jar web/WEB-INF/lib
    mkdir web/WEB-INF/groovy
    cp $GROOVY_GAE_TEMPLATE/deploy/WEB-INF/groovy/hello.groovy web/WEB-INF/groovy

    Then make web/WEB-INF/web.xml look like this(sans header):

    GroovyServlet
    groovy.servlet.GroovyServlet

    GroovyServlet
    *.groovy

    I did not have eclipse include groovy support via the groovy plugin, though I’m wondering if I need to deactivate it. Anyhow, I restart Eclipse and have it refresh all the directories, but still the same error. Could I trouble you for a copy of that jar file as well please? Do you see anything in my method that is missing? Thanks for taking the time to write this post.

    Comment by Matt — April 9, 2009 @ 7:15 pm

  4. zip can be downloaded here:

    http://tinyurl.com/cb7zpg

    Comment by thevery — April 9, 2009 @ 9:15 pm

  5. I started with a fresh new eclipse google project and the same problem occurred.
    Tried with the copy of the posted zip and it worked. Found out that I had tried to use Google standalone SDK in between as the selected SDK. Removed it and changed it back to use eclipse’s google plugin sdk. Restarted eclipse, had to add groovy-all.jar again in lib as well as com.google.appengine.eclipse.core.prefs, and then it started working again. Could not find any difference between appengine-tools-api.jar though!!
    Not sure how it is working – but it works!!

    Comment by indoos — April 10, 2009 @ 6:31 am

  6. Just add groovy-all-1.6.1.jar into classpath in eclipse, I works now.

    Thank!

    Comment by Mark — April 11, 2009 @ 4:03 am

  7. dears,I met the same error as your:access denied (groovy.security.GroovyCodeSourcePermission /groovy/shell)
    So I downloaded the thevery’s zip file,and try it in my elipse,it’s OK.
    I compared thevery’s source code wiht my source code.I found there is also a differenc in .classpath.
    I changed a sentence in my .classpath from to

    ,
    just like .classpath in thevery’s source code.My source code is OK!!!
    You can try it!

    Comment by huweihong — April 16, 2009 @ 5:01 am

  8. from classpathentry kind=”lib” path=”groovy-all-1.6.1.jar”
    to
    classpathentry kind=”lib” path=”war/WEB-INF/lib/groovy-all-1.6.1.jar”

    and add a line:
    classpathentry exported=”true” kind=”con” path=”GROOVY_SUPPORT”

    Comment by huweihong — April 16, 2009 @ 5:03 am

  9. […] GroovyCodeSourcePermission 错误,大概是权限问题。后来找到 http://indoos.wordpress.com/2009/04/09/gaegroovy-localnremote-with-eclipse-plugin/ 说到本地的 gae 环境不能使 groovy […]

    Pingback by 本地 gae 上用 groovy 出现 groovy.util.ScriptException | 流浪汗 — May 4, 2009 @ 12:45 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The WordPress Classic Theme. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 42 other followers

%d bloggers like this: