slagyr / gaeshi

Google App Engine library for Clojure
MIT License
39 stars 4 forks source link

Code from sample app fails on AppEngine but runs in server mode #13

Closed jconti closed 11 years ago

jconti commented 11 years ago

I made a little site based on the sample app (http://john-conti.appspot.com). It works great running on a local server! However, when I deployed it, the post index and specific routes to a post do not work.

After looking at the logs and stack traces (one reproduced below), it looks like the app is unable to see the posts. I verified the hiccup files were in the deployed jar.

I suspect that AppEngine is not happy with the file operations on the included posts. Maybe it doesn't even set the directory correctly:

(def ^{:private true} current-path
  (. (java.io.File. ".") getCanonicalPath))

My questions are:

  1. Is logging the best way to debug this? If not, what else?
  2. If logging is my best shot, what is the way to log from Clojure using Gaeshi?

Thanks! John

/posts
java.lang.NullPointerException
    at java.util.regex.Matcher.getTextLength(Matcher.java:1269)
    at java.util.regex.Matcher.reset(Matcher.java:308)
    at java.util.regex.Matcher.<init>(Matcher.java:228)
    at java.util.regex.Pattern.matcher(Pattern.java:905)
    at clojure.core$re_matcher.invoke(core.clj:4286)
    at chee.string$gsub.invoke(string.clj:11)
    at john_conti.view.view_helpers$get_post_name.invoke(view_helpers.clj:16)
    at john_conti.view.view_helpers$eval1665$iter__1666__1670$fn__1671.invoke(NO_SOURCE_FILE)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:60)
    at clojure.lang.RT.seq(RT.java:473)
    at clojure.core$seq.invoke(core.clj:133)
    at clojure.core$map$fn__4087.invoke(core.clj:2426)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:60)
    at clojure.lang.RT.seq(RT.java:473)
    at clojure.core$seq.invoke(core.clj:133)
    at clojure.core$apply.invoke(core.clj:601)
    at hiccup.core$eval1085$fn__1086.invoke(core.clj:99)
    at clojure.lang.MultiFn.invoke(MultiFn.java:163)
    at clojure.core$map$fn__4087.invoke(core.clj:2434)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:60)
    at clojure.lang.Cons.next(Cons.java:39)
    at clojure.lang.RT.boundedLength(RT.java:1633)
    at clojure.lang.RestFn.applyTo(RestFn.java:130)
    at clojure.core$apply.invoke(core.clj:601)
    at hiccup.core$eval1085$fn__1086.invoke(core.clj:99)
    at clojure.lang.MultiFn.invoke(MultiFn.java:163)
    at clojure.core$map$fn__4087.invoke(core.clj:2432)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:60)
    at clojure.lang.RT.seq(RT.java:473)
    at clojure.core$seq.invoke(core.clj:133)
    at clojure.core$apply.invoke(core.clj:601)
    at hiccup.core$eval1085$fn__1086.invoke(core.clj:99)
    at clojure.lang.MultiFn.invoke(MultiFn.java:163)
    at hiccup.core$render_element.invoke(core.clj:90)
    at hiccup.core$eval1081$fn__1082.invoke(core.clj:96)
    at clojure.lang.MultiFn.invoke(MultiFn.java:163)
    at clojure.core$map$fn__4087.invoke(core.clj:2432)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:60)
    at clojure.lang.RT.seq(RT.java:473)
    at clojure.core$seq.invoke(core.clj:133)
    at clojure.core$apply.invoke(core.clj:601)
    at hiccup.core$eval1085$fn__1086.invoke(core.clj:99)
    at clojure.lang.MultiFn.invoke(MultiFn.java:163)
    at hiccup.core$render_element.invoke(core.clj:90)
    at hiccup.core$eval1081$fn__1082.invoke(core.clj:96)
    at clojure.lang.MultiFn.invoke(MultiFn.java:163)
    at clojure.core$map$fn__4087.invoke(core.clj:2432)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:60)
    at clojure.lang.RT.seq(RT.java:473)
    at clojure.core$seq.invoke(core.clj:133)
    at clojure.core$apply.invoke(core.clj:601)
    at hiccup.core$eval1085$fn__1086.invoke(core.clj:99)
    at clojure.lang.MultiFn.invoke(MultiFn.java:163)
    at hiccup.core$render_element.invoke(core.clj:90)
    at hiccup.core$eval1081$fn__1082.invoke(core.clj:96)
    at clojure.lang.MultiFn.invoke(MultiFn.java:163)
    at clojure.core$map$fn__4087.invoke(core.clj:2432)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:60)
    at clojure.lang.RT.seq(RT.java:473)
    at clojure.core$seq.invoke(core.clj:133)
    at clojure.core$apply.invoke(core.clj:601)
    at hiccup.core$eval1085$fn__1086.invoke(core.clj:99)
    at clojure.lang.MultiFn.invoke(MultiFn.java:163)
    at hiccup.core$render_element.invoke(core.clj:90)
    at hiccup.core$eval1081$fn__1082.invoke(core.clj:96)
    at clojure.lang.MultiFn.invoke(MultiFn.java:163)
    at clojure.core$map$fn__4087.invoke(core.clj:2434)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:60)
    at clojure.lang.Cons.next(Cons.java:39)
    at clojure.lang.RT.boundedLength(RT.java:1633)
    at clojure.lang.RestFn.applyTo(RestFn.java:130)
    at clojure.core$apply.invoke(core.clj:601)
    at hiccup.core$eval1085$fn__1086.invoke(core.clj:99)
    at clojure.lang.MultiFn.invoke(MultiFn.java:163)
    at clojure.lang.Var.invoke(Var.java:415)
    at joodo.views$render.invoke(views.clj:44)
    at joodo.views$render_in_layout.invoke(views.clj:50)
    at joodo.views$render_template.doInvoke(views.clj:77)
    at clojure.lang.RestFn.invoke(RestFn.java:410)
    at john_conti.core$fn__1325.invoke(core.clj:11)
    at compojure.core$if_route$fn__893.invoke(core.clj:39)
    at compojure.core$if_method$fn__886.invoke(core.clj:24)
    at compojure.core$routing$fn__912.invoke(core.clj:98)
    at clojure.core$some.invoke(core.clj:2390)
    at compojure.core$routing.doInvoke(core.clj:98)
    at clojure.lang.RestFn.applyTo(RestFn.java:139)
    at clojure.core$apply.invoke(core.clj:603)
    at compojure.core$routes$fn__916.invoke(core.clj:103)
    at joodo.middleware.view_context$wrap_view_context$fn__1280.invoke(view_context.clj:17)
    at clojure.lang.Var.invoke(Var.java:415)
    at joodo.middleware.request$wrap_bind_request$fn__466.invoke(request.clj:16)
    at ring.middleware.keyword_params$wrap_keyword_params$fn__143.invoke(keyword_params.clj:27)
    at ring.middleware.params$wrap_params$fn__112.invoke(params.clj:76)
    at joodo.middleware.multipart_params$wrap_multipart_params$fn__297.invoke(multipart_params.clj:71)
    at joodo.middleware.flash$wrap_flash$fn__457.invoke(flash.clj:28)
    at joodo.middleware.keyword_cookies$wrap_keyword_cookies$fn__278.invoke(keyword_cookies.clj:19)
    at ring.middleware.cookies$wrap_cookies$fn__238.invoke(cookies.clj:150)
    at joodo.middleware.servlet_session$wrap_servlet_session$fn__445.invoke(servlet_session.clj:66)
    at joodo.kake.servlet$make_service_method$fn__472.invoke(servlet.clj:35)
    at joodo.kake.JoodoServlet.service(JoodoServlet.java:40)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
    at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:125)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:35)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
    at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:266)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
    at com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:76)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:146)
    at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:447)
    at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:454)
    at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:461)
    at com.google.tracing.TraceContext.runInContext(TraceContext.java:703)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:338)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:330)
<continued in next message>
slagyr commented 11 years ago

John,

I've formally deprecated Gaeshi. https://github.com/slagyr/gaeshi/blob/master/README.md#deprecated All the sites I had on GAE using Gaeshi have been moved to AWS using Joodo.

I would think that logging is the best way to debug. But you never know with GAE… which is why I've abandoned it.

I'm sorry for any inconvenience this causes you.

Micah

On Feb 18, 2013, at 10:17 PM, John Conti notifications@github.com wrote:

I made a little site based on the sample app (http://john-conti.appspot.com). It works great running on a local server! However, when I deployed it, the post index and specific routes to a post do not work.

After looking at the logs and stack traces (one reproduced below), it looks like the app is unable to see the posts. I verified the hiccup files were in the deployed jar.

I suspect that AppEngine is not happy with the file operations on the included posts. Maybe it doesn't even set the directory correctly:

(def ^{:private true} current-path (. (java.io.File. ".") getCanonicalPath)) My questions are:

  1. Is logging the best way to debug this? If not, what else?
  2. If logging is my best shot, what is the way to log from Clojure using Gaeshi?

Thanks! John

/posts java.lang.NullPointerException at java.util.regex.Matcher.getTextLength(Matcher.java:1269) at java.util.regex.Matcher.reset(Matcher.java:308) at java.util.regex.Matcher.(Matcher.java:228) at java.util.regex.Pattern.matcher(Pattern.java:905) at clojure.core$re_matcher.invoke(core.clj:4286) at chee.string$gsub.invoke(string.clj:11) at john_conti.view.view_helpers$get_post_name.invoke(view_helpers.clj:16) at john_conti.view.view_helpers$eval1665$iter16661670$fn1671.invoke(NO_SOURCE_FILE) at clojure.lang.LazySeq.sval(LazySeq.java:42) at clojure.lang.LazySeq.seq(LazySeq.java:60) at clojure.lang.RT.seq(RT.java:473) at clojure.core$seq.invoke(core.clj:133) at clojure.core$map$fn4087.invoke(core.clj:2426) at clojure.lang.LazySeq.sval(LazySeq.java:42) at clojure.lang.LazySeq.seq(LazySeq.java:60) at clojure.lang.RT.seq(RT.java:473) at clojure.core$seq.invoke(core.clj:133) at clojure.core$apply.invoke(core.clj:601) at hiccup.core$eval1085$fn1086.invoke(core.clj:99) at clojure.lang.MultiFn.invoke(MultiFn.java:163) at clojure.core$map$fn4087.invoke(core.clj:2434) at clojure.lang.LazySeq.sval(LazySeq.java:42) at clojure.lang.LazySeq.seq(LazySeq.java:60) at clojure.lang.Cons.next(Cons.java:39) at clojure.lang.RT.boundedLength(RT.java:1633) at clojure.lang.RestFn.applyTo(RestFn.java:130) at clojure.core$apply.invoke(core.clj:601) at hiccup.core$eval1085$fn1086.invoke(core.clj:99) at clojure.lang.MultiFn.invoke(MultiFn.java:163) at clojure.core$map$fn4087.invoke(core.clj:2432) at clojure.lang.LazySeq.sval(LazySeq.java:42) at clojure.lang.LazySeq.seq(LazySeq.java:60) at clojure.lang.RT.seq(RT.java:473) at clojure.core$seq.invoke(core.clj:133) at clojure.core$apply.invoke(core.clj:601) at hiccup.core$eval1085$fn1086.invoke(core.clj:99) at clojure.lang.MultiFn.invoke(MultiFn.java:163) at hiccup.core$render_element.invoke(core.clj:90) at hiccup.core$eval1081$fn1082.invoke(core.clj:96) at clojure.lang.MultiFn.invoke(MultiFn.java:163) at clojure.core$map$fn4087.invoke(core.clj:2432) at clojure.lang.LazySeq.sval(LazySeq.java:42) at clojure.lang.LazySeq.seq(LazySeq.java:60) at clojure.lang.RT.seq(RT.java:473) at clojure.core$seq.invoke(core.clj:133) at clojure.core$apply.invoke(core.clj:601) at hiccup.core$eval1085$fn__1086.invoke(core.clj:99) at clojure.lang.MultiFn.invoke(MultiFn.java:163) at hiccup.core$render_element.invoke(core.clj:90) at hiccup.core$eval1081$fn1082.invoke(core.clj:96) at clojure.lang.MultiFn.invoke(MultiFn.java:163) at clojure.core$map$fn4087.invoke(core.clj:2432) at clojure.lang.LazySeq.sval(LazySeq.java:42) at clojure.lang.LazySeq.seq(LazySeq.java:60) at clojure.lang.RT.seq(RT.java:473) at clojure.core$seq.invoke(core.clj:133) at clojure.core$apply.invoke(core.clj:601) at hiccup.core$eval1085$fn1086.invoke(core.clj:99) at clojure.lang.MultiFn.invoke(MultiFn.java:163) at hiccup.core$render_element.invoke(core.clj:90) at hiccup.core$eval1081$fn1082.invoke(core.clj:96) at clojure.lang.MultiFn.invoke(MultiFn.java:163) at clojure.core$map$fn4087.invoke(core.clj:2432) at clojure.lang.LazySeq.sval(LazySeq.java:42) at clojure.lang.LazySeq.seq(LazySeq.java:60) at clojure.lang.RT.seq(RT.java:473) at clojure.core$seq.invoke(core.clj:133) at clojure.core$apply.invoke(core.clj:601) at hiccup.core$eval1085$fn1086.invoke(core.clj:99) at clojure.lang.MultiFn.invoke(MultiFn.java:163) at hiccup.core$render_element.invoke(core.clj:90) at hiccup.core$eval1081$fn1082.invoke(core.clj:96) at clojure.lang.MultiFn.invoke(MultiFn.java:163) at clojure.core$map$fn4087.invoke(core.clj:2434) at clojure.lang.LazySeq.sval(LazySeq.java:42) at clojure.lang.LazySeq.seq(LazySeq.java:60) at clojure.lang.Cons.next(Cons.java:39) at clojure.lang.RT.boundedLength(RT.java:1633) at clojure.lang.RestFn.applyTo(RestFn.java:130) at clojure.core$apply.invoke(core.clj:601) at hiccup.core$eval1085$fn1086.invoke(core.clj:99) at clojure.lang.MultiFn.invoke(MultiFn.java:163) at clojure.lang.Var.invoke(Var.java:415) at joodo.views$render.invoke(views.clj:44) at joodo.views$render_in_layout.invoke(views.clj:50) at joodo.views$render_template.doInvoke(views.clj:77) at clojure.lang.RestFn.invoke(RestFn.java:410) at john_conti.core$fn1325.invoke(core.clj:11) at compojure.core$if_route$fn893.invoke(core.clj:39) at compojure.core$if_method$fn886.invoke(core.clj:24) at compojure.core$routing$fn912.invoke(core.clj:98) at clojure.core$some.invoke(core.clj:2390) at compojure.core$routing.doInvoke(core.clj:98) at clojure.lang.RestFn.applyTo(RestFn.java:139) at clojure.core$apply.invoke(core.clj:603) at compojure.core$routes$fn916.invoke(core.clj:103) at joodo.middleware.view_context$wrap_view_context$fn__1280.invoke(view_context.clj:17) at clojure.lang.Var.invoke(Var.java:415) at joodo.middleware.request$wrap_bind_request$fn466.invoke(request.clj:16) at ring.middleware.keyword_params$wrap_keyword_params$fn143.invoke(keyword_params.clj:27) at ring.middleware.params$wrap_params$fn112.invoke(params.clj:76) at joodo.middleware.multipart_params$wrap_multipart_params$fn297.invoke(multipart_params.clj:71) at joodo.middleware.flash$wrap_flash$fn457.invoke(flash.clj:28) at joodo.middleware.keyword_cookies$wrap_keyword_cookies$fn278.invoke(keyword_cookies.clj:19) at ring.middleware.cookies$wrap_cookies$fn238.invoke(cookies.clj:150) at joodo.middleware.servlet_session$wrap_servlet_session$fn__445.invoke(servlet_session.clj:66) at joodo.kake.servlet$make_service_method$fn__472.invoke(servlet.clj:35) at joodo.kake.JoodoServlet.service(JoodoServlet.java:40) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166) at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:125) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:35) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:266) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923) at com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:76) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:146) at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:447) at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:454) at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:461) at com.google.tracing.TraceContext.runInContext(TraceContext.java:703) at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:338) at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:330)

— Reply to this email directly or view it on GitHub.
jconti commented 11 years ago

Totally understood. Thanks for the software, I am enjoying it. Now off to AWS.

Thanks, John

PS: Is Heroku usable with Joodo?

slagyr commented 11 years ago

Yeah… Heroku's cedar stack can run Joodo apps. We've got a few Joodo apps running on Heroku for free. It's easier than AWS to get started.

Here's a gist that show how easy it is. Watch out for the old version.

https://gist.github.com/slagyr/1411111

Micah

On Feb 19, 2013, at 1:50 PM, John Conti notifications@github.com wrote:

Totally understood. Thanks for the software, I am enjoying it. Now off to AWS.

Thanks, John

PS: Is Heroku usable with Joodo?

— Reply to this email directly or view it on GitHub.

jconti commented 11 years ago

Is there an option for lein 2?

bash-3.2$ lein plugin install joodo/lein-joodo "0.6.0-SNAPSHOT"
lein plugin install joodo/lein-joodo "0.6.0-SNAPSHOT"
The plugin task has been removed.

Please see the upgrade guide for instructions on how to use the user profile to
specify plugins instead: https://github.com/technomancy/leiningen/wiki/Upgrading
bash-3.2$ 
slagyr commented 11 years ago

That gist is quite old. The current version of Joodo is 1.1.2

https://clojars.org/joodo

Yeah it supports lein2.

Also see http://joodoweb.com/

Micah

On Feb 19, 2013, at 9:39 PM, John Conti notifications@github.com wrote:

Is there an option for lein 2?

bash-3.2$ lein plugin install joodo/lein-joodo "0.6.0-SNAPSHOT" lein plugin install joodo/lein-joodo "0.6.0-SNAPSHOT" The plugin task has been removed.

Please see the upgrade guide for instructions on how to use the user profile to specify plugins instead: https://github.com/technomancy/leiningen/wiki/Upgrading bash-3.2$ — Reply to this email directly or view it on GitHub.

jconti commented 11 years ago

Haha. Now I understand "watch out for the old version!" Thanks.

slagyr commented 11 years ago

Yeah… sorry for being vague. I think I got a phone call right as I finished that email.

Micah

On Feb 20, 2013, at 9:08 AM, John Conti notifications@github.com wrote:

Haha. Now I understand "watch out for the old version!" Thanks.

— Reply to this email directly or view it on GitHub.