{"id":633,"date":"2009-06-15T22:28:29","date_gmt":"2009-06-16T02:28:29","guid":{"rendered":"http:\/\/www.dr-chuck.com\/wordpress\/?p=633"},"modified":"2011-12-17T12:30:40","modified_gmt":"2011-12-17T16:30:40","slug":"initial-hacking-of-java-app-engine-on-macintosh","status":"publish","type":"post","link":"https:\/\/www.dr-chuck.com\/csev-blog\/2009\/06\/initial-hacking-of-java-app-engine-on-macintosh\/","title":{"rendered":"Initial Hacking of Java App Engine on Macintosh"},"content":{"rendered":"<p>\nI started building my first Java App Engine Application.  I added the plug in to Eclipse and created my first application.  Make *sure* to uncheck &#8220;Use Google Web Toolkit&#8221; unless you really want it.  If you are just making a simple servlet &#8211; you probably don&#8217;t want GWT.<\/p>\n<p>\nOther than that, it is amazingly simple.   When I skimmed the documentation it appeared that not much changed except for the addition of WEB-INF\/appengine-web.xml file &#8211; and that was pretty much it.  The rest is pretty much pure servlet.  Sweet.<\/p>\n<p>\nWhen you use the Run, option it runs Jetty which puts your application at \/ (i.e. not \/servletname).  Somehow, there is no way to stop Jetty when you need to recompile a class and want a full re-deploy.  Now I don&#8217;t know how well Jetty does with hot-deploy &#8211; maybe you just recompile.   But for us Tomcat refugees we want to restart once in a while.<\/p>\n<p>\nHere is how I do it with my Mac:<\/p>\n<pre>\nps -ef | grep geronimo | grep -v grep | awk '{print \"kill \" $2}' | sh -x\n<\/pre>\n<p>\nThen just run your app again from Eclipse.<\/p>\n<p>\nThe next thing that went wrong is something strange with the Mac Java VM and the harsh security confines of the App Engine &#8211; HMAC signing using a native library on the Mac &#8211; so you get this sweet traceback:<\/p>\n<pre>\njava.security.AccessControlException: access denied (java.lang.RuntimePermission loadLibrary.keychain)\nat java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)\nat com.google.appengine.tools.development.DevAppServerFactory\nat com.apple.crypto.provider.HmacCore.(HmacCore.java:26)\nat javax.crypto.Mac.init(DashoA12275)\nat net.oauth.signature.HMAC_SHA1.computeSignature(HMAC_SHA1.java:74)\n<\/pre>\n<p>\nNow this is *not* a problem on a deployed Java Application on the Google production environment &#8211; but it makes testing kind of less fun.  So the workaround is make the following setting:<\/p>\n<p>\nEclipse -> Propject -> Properties -> Run\/Debug Settings -> select your target -> Edit -> Arguments -> VM Arguments<\/p>\n<pre>\n-D--enable_all_permissions=true\n<\/pre>\n<p>\nNow you might get in trouble because you end up with something working on your mac that fails on the GAE production because it bypasses the Java policies &#8211; but at least you can HMAC on your Macintosh.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I started building my first Java App Engine Application. I added the plug in to Eclipse and created my first application. Make *sure* to uncheck &#8220;Use Google Web Toolkit&#8221; unless you really want it. If you are just making a simple servlet &#8211; you probably don&#8217;t want GWT. Other than that, it is amazingly simple. [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-633","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/633","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/comments?post=633"}],"version-history":[{"count":1,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/633\/revisions"}],"predecessor-version":[{"id":2740,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/633\/revisions\/2740"}],"wp:attachment":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/media?parent=633"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/categories?post=633"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/tags?post=633"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}