我正在尝试使用postgresql将clojure网络应用上传到Google应用引擎。
但我上传wep app时遇到问题。
这是我看到的教程 http://flowa.fi/blog/2014/04/25/clojure-gae-howto.html
https://cloud.google.com/solutions/setup-postgres
操作系统:window7
我做的过程如下:
从我的应用中制作战争文件
提取war文件并上传到Google应用引擎
将postgresql配置为在Google应用引擎引用中运行良好 https://cloud.google.com/solutions/setup-postgres
使用
appcfg update。
如上所述成功上传
但是当我访问网站http://tmxkwkfgka.appspot.com时。本网站发生错误
Error: Server Error
The server encountered an error and could not complete your request.
Please try again in 30 seconds.
当我使用命令
将web上传到本地的appengine时dev_appserver .
它在当地运作良好。
google app引擎日志错误消息如下:
W 13:56:18.403
/
java.lang.NullPointerException
at com.google.appengine.runtime.Request.process-7fd2ef9e4add08a2(Request.java)
at java.util.Hashtable.put(Hashtable.java:522)
at java.util.Properties.setProperty(Properties.java:161)
at org.postgresql.Driver.loadDefaultProperties(Driver.java:121)
at org.postgresql.Driver.access$000(Driver.java:47)
at org.postgresql.Driver$1.run(Driver.java:88)
at java.security.AccessController.doPrivileged(AccessController.java:62)
at org.postgresql.Driver.getDefaultProperties(Driver.java:85)
at org.postgresql.Driver.connect(Driver.java:231)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:187)
at clojure.java.jdbc$get_connection.invoke(jdbc.clj:177)
at clojure.java.jdbc$with_connection_STAR_.invoke(jdbc.clj:300)
at picture_gallery.models.db$get_gallery_previews.invoke(db.clj:44)
at picture_gallery.routes.gallery$show_galleries.invoke(gallery.clj:36)
at picture_gallery.routes.home$home.invoke(home.clj:9)
at picture_gallery.routes.home$fn__153.invoke(home.clj:12)
at compojure.core$make_route$fn__390.invoke(core.clj:94)
at compojure.core$if_route$fn__378.invoke(core.clj:40)
at compojure.core$if_method$fn__371.invoke(core.clj:25)
at compojure.core$routing$fn__396.invoke(core.clj:107)
at clojure.core$some.invoke(core.clj:2515)
at compojure.core$routing.doInvoke(core.clj:107)
at clojure.lang.RestFn.applyTo(RestFn.java:139)
at clojure.core$apply.invoke(core.clj:626)
at compojure.core$routes$fn__400.invoke(core.clj:112)
at compojure.core$routing$fn__396.invoke(core.clj:107)
at clojure.core$some.invoke(core.clj:2515)
at compojure.core$routing.doInvoke(core.clj:107)
at clojure.lang.RestFn.applyTo(RestFn.java:139)
at clojure.core$apply.invoke(core.clj:626)
at compojure.core$routes$fn__400.invoke(core.clj:112)
at noir.util.middleware$wrap_request_map$fn__3756.invoke(middleware.clj:44)
at ring.middleware.keyword_params$wrap_keyword_params$fn__733.invoke(keyword_params.clj:32)
at ring.middleware.nested_params$wrap_nested_params$fn__775.invoke(nested_params.clj:70)
at ring.middleware.params$wrap_params$fn__706.invoke(params.clj:58)
at hiccup.middleware$wrap_base_url$fn__683.invoke(middleware.clj:12)
at ring.middleware.multipart_params$wrap_multipart_params$fn__812.invoke(multipart_params.clj:107)
at noir.util.middleware$wrap_access_rules$fn__3770.invoke(middleware.clj:139)
at noir.validation$wrap_noir_validation$fn__2891.invoke(validation.clj:135)
at noir.cookies$noir_cookies$fn__2922.invoke(cookies.clj:66)
at ring.middleware.cookies$wrap_cookies$fn__1690.invoke(cookies.clj:171)
at noir.session$noir_flash$fn__2159.invoke(session.clj:141)
at ring.middleware.flash$wrap_flash$fn__1797.invoke(flash.clj:31)
at noir.session$noir_session$fn__2149.invoke(session.clj:96)
at ring.middleware.session$wrap_session$fn__1784.invoke(session.clj:85)
at picture_gallery.servlet$_service$fn__298.invoke(servlet.clj:1)
at ring.util.servlet$make_service_method$fn__52.invoke(servlet.clj:126)
at picture_gallery.servlet$_service.invoke(servlet.clj:1)
at picture_gallery.servlet.service(Unknown Source)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
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 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 org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:437)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:444)
at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:256)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:308)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:300)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:441)
at java.lang.Thread.run(Thread.java:745)
我认为它与postgresql db有关。但我不知道如何解决它。这是发生错误的代码的一部分。
;db.clj 44 line
(defn get-gallery-previews []
(with-db
sql/with-query-results
res
["select * from
(select *, row_number() over (partition by userid) as row_number from images)
as rows where row_number = 1"]
(doall res)))
;with-db macro
(defmacro with-db [f & body]
`(sql/with-connection ~db (~f ~@body)))
(def db
{:subprotocol "postgresql"
:subname "//104.196.51.134/gallery"
:user "postgres"
:password "dhodua"
})
答案 0 :(得分:0)
我同意它可能与套接字相关。一旦尝试在连接失败后使用null db对象,就会看到NullPointerException,这不会自行抛出任何错误。您可能会在日志中的其他位置看到有关连接的详细信息。
要使用套接字,请确保您的应用已启用结算,并且每日预算未设置为零(默认情况下应自动无限制):
<强>配额强>
https://cloud.google.com/appengine/docs/quotas?hl=en
结算设置
https://cloud.google.com/appengine/pricing#billing_settings