Web applications Heroku/Clojure部署上的端口错误

Web applications Heroku/Clojure部署上的端口错误,web-applications,deployment,clojure,heroku,Web Applications,Deployment,Clojure,Heroku,这是我的一个后续问题。正如那篇文章中所描述的,我能够将我的应用程序推送到Heroku的主应用程序上,这样就部署了它 但当我尝试转到我的应用程序的URL时,我得到了以下错误。这是一个奇怪的端口错误,但我认为在Heroku上部署Clojure应用程序时,我无法控制这些细节。我觉得我的设置很简单。我能做些什么来解决这个错误吗 Procfile web: lein run -m http.handler web:leinrun-mhttp.handler http.handler ... (de

这是我的一个后续问题。正如那篇文章中所描述的,我能够将我的应用程序推送到Heroku的主应用程序上,这样就部署了它

但当我尝试转到我的应用程序的URL时,我得到了以下错误。这是一个奇怪的端口错误,但我认为在Heroku上部署Clojure应用程序时,我无法控制这些细节。我觉得我的设置很简单。我能做些什么来解决这个错误吗

Procfile

web: lein run -m http.handler web:leinrun-mhttp.handler http.handler

... (def app (handler/site main)) 2011-12-31T04:10:02+00:00 app[web.1]: Listening for transport dt_socket at address: 41208 2011-12-31T04:10:03+00:00 heroku[web.1]: Stopping process with SIGKILL 2011-12-31T04:10:03+00:00 heroku[web.1]: Error R11 (Bad bind) -> Process bound to port 41208, should be 55032 (see environment variable PORT) 2011-12-31T04:10:04+00:00 heroku[web.1]: State changed from starting to crashed 2011-12-31T04:10:05+00:00 heroku[web.1]: Process exited 2011-12-31T04:20:08+00:00 heroku[web.1]: State changed from crashed to created 2011-12-31T04:20:08+00:00 heroku[web.1]: State changed from created to starting 2011-12-31T04:20:12+00:00 heroku[web.1]: Starting process with command `lein run -m http.handler` 2011-12-31T04:20:16+00:00 app[web.1]: Listening for transport dt_socket at address: 49151 2011-12-31T04:20:16+00:00 heroku[web.1]: Error R11 (Bad bind) -> Process bound to port 49151, should be 39092 (see environment variable PORT) 2011-12-31T04:20:16+00:00 heroku[web.1]: Stopping process with SIGKILL 2011-12-31T04:20:17+00:00 heroku[web.1]: State changed from starting to crashed 2011-12-31T04:20:18+00:00 heroku[web.1]: Process exited 2011-12-31T04:31:13+00:00 heroku[web.1]: State changed from crashed to created 2011-12-31T04:31:13+00:00 heroku[web.1]: State changed from created to starting 2011-12-31T04:31:16+00:00 heroku[web.1]: Starting process with command `lein run -m http.handler` 2011-12-31T04:31:20+00:00 app[web.1]: Listening for transport dt_socket at address: 44321 2011-12-31T04:31:20+00:00 heroku[web.1]: Error R11 (Bad bind) -> Process bound to port 44321, should be 17211 (see environment variable PORT) 2011-12-31T04:31:20+00:00 heroku[web.1]: Stopping process with SIGKILL 2011-12-31T04:31:22+00:00 heroku[web.1]: State changed from starting to crashed 2011-12-31T04:31:22+00:00 heroku[web.1]: Process exited 2011-12-31T04:44:59+00:00 heroku[web.1]: State changed from crashed to created 2011-12-31T04:44:59+00:00 heroku[web.1]: State changed from created to starting 2011-12-31T04:45:02+00:00 heroku[web.1]: Starting process with command `lein run -m http.handler` 2011-12-31T04:45:05+00:00 app[web.1]: Listening for transport dt_socket at address: 37500 2011-12-31T04:45:06+00:00 heroku[web.1]: Error R11 (Bad bind) -> Process bound to port 37500, should be 14046 (see environment variable PORT) 2011-12-31T04:45:06+00:00 heroku[web.1]: Stopping process with SIGKILL 2011-12-31T04:45:07+00:00 heroku[web.1]: State changed from starting to crashed 2011-12-31T04:45:07+00:00 heroku[web.1]: Process exited 2011-12-31T04:49:22+00:00 heroku[router]: Error H10 (App crashed) -> GET bkeeping.herokuapp.com/ dyno= queue= wait= service= status=503 bytes= 2011-12-31T04:49:31+00:00 heroku[router]: Error H10 (App crashed) -> GET bkeeping.herokuapp.com/favicon.ico dyno= queue= wait= service= status=503 bytes= ... (def应用程序(处理程序/现场主) 错误

... (def app (handler/site main)) 2011-12-31T04:10:02+00:00 app[web.1]: Listening for transport dt_socket at address: 41208 2011-12-31T04:10:03+00:00 heroku[web.1]: Stopping process with SIGKILL 2011-12-31T04:10:03+00:00 heroku[web.1]: Error R11 (Bad bind) -> Process bound to port 41208, should be 55032 (see environment variable PORT) 2011-12-31T04:10:04+00:00 heroku[web.1]: State changed from starting to crashed 2011-12-31T04:10:05+00:00 heroku[web.1]: Process exited 2011-12-31T04:20:08+00:00 heroku[web.1]: State changed from crashed to created 2011-12-31T04:20:08+00:00 heroku[web.1]: State changed from created to starting 2011-12-31T04:20:12+00:00 heroku[web.1]: Starting process with command `lein run -m http.handler` 2011-12-31T04:20:16+00:00 app[web.1]: Listening for transport dt_socket at address: 49151 2011-12-31T04:20:16+00:00 heroku[web.1]: Error R11 (Bad bind) -> Process bound to port 49151, should be 39092 (see environment variable PORT) 2011-12-31T04:20:16+00:00 heroku[web.1]: Stopping process with SIGKILL 2011-12-31T04:20:17+00:00 heroku[web.1]: State changed from starting to crashed 2011-12-31T04:20:18+00:00 heroku[web.1]: Process exited 2011-12-31T04:31:13+00:00 heroku[web.1]: State changed from crashed to created 2011-12-31T04:31:13+00:00 heroku[web.1]: State changed from created to starting 2011-12-31T04:31:16+00:00 heroku[web.1]: Starting process with command `lein run -m http.handler` 2011-12-31T04:31:20+00:00 app[web.1]: Listening for transport dt_socket at address: 44321 2011-12-31T04:31:20+00:00 heroku[web.1]: Error R11 (Bad bind) -> Process bound to port 44321, should be 17211 (see environment variable PORT) 2011-12-31T04:31:20+00:00 heroku[web.1]: Stopping process with SIGKILL 2011-12-31T04:31:22+00:00 heroku[web.1]: State changed from starting to crashed 2011-12-31T04:31:22+00:00 heroku[web.1]: Process exited 2011-12-31T04:44:59+00:00 heroku[web.1]: State changed from crashed to created 2011-12-31T04:44:59+00:00 heroku[web.1]: State changed from created to starting 2011-12-31T04:45:02+00:00 heroku[web.1]: Starting process with command `lein run -m http.handler` 2011-12-31T04:45:05+00:00 app[web.1]: Listening for transport dt_socket at address: 37500 2011-12-31T04:45:06+00:00 heroku[web.1]: Error R11 (Bad bind) -> Process bound to port 37500, should be 14046 (see environment variable PORT) 2011-12-31T04:45:06+00:00 heroku[web.1]: Stopping process with SIGKILL 2011-12-31T04:45:07+00:00 heroku[web.1]: State changed from starting to crashed 2011-12-31T04:45:07+00:00 heroku[web.1]: Process exited 2011-12-31T04:49:22+00:00 heroku[router]: Error H10 (App crashed) -> GET bkeeping.herokuapp.com/ dyno= queue= wait= service= status=503 bytes= 2011-12-31T04:49:31+00:00 heroku[router]: Error H10 (App crashed) -> GET bkeeping.herokuapp.com/favicon.ico dyno= queue= wait= service= status=503 bytes= 2011-12-31T04:10:02+00:00应用程序[web.1]:侦听地址为41208的传输dt_插座 2011-12-31T04:10:03+00:00 heroku[web.1]:使用SIGKILL停止进程2011-12-31T04:10:03+00:00 heroku[web.1]:错误R11(绑定错误)->绑定到端口41208的进程应为55032(请参阅环境变量port) 2011-12-31T04:10:04+00:00 heroku[web.1]:状态从开始更改为崩溃 2011-12-31T04:10:05+00:00 heroku[web.1]:进程已退出 2011-12-31T04:20:08+00:00 heroku[web.1]:状态从崩溃更改为创建2011-12-31T04:20:08+00:00 heroku[web.1]:状态从创建更改为启动2011-12-31T04:20:12+00:00 heroku[web.1]:使用命令'lein run-m http.handler'启动进程` 2011-12-31T04:20:16+00:00应用程序[web.1]:侦听地址为49151的传输dt_套接字2011-12-31T04:20:16+00:00 heroku[web.1]:错误R11(绑定错误)->绑定到端口49151的进程应为39092(请参阅环境变量port) 2011-12-31T04:20:16+00:00 heroku[web.1]:使用SIGKILL停止进程 2011-12-31T04:20:17+00:00 heroku[web.1]:状态从开始变为崩溃 2011-12-31T04:20:18+00:00 heroku[web.1]:进程已退出 2011-12-31T04:31:13+00:00 heroku[web.1]:状态从崩溃更改为创建 2011-12-31T04:31:13+00:00 heroku[web.1]:状态从创建更改为开始 2011-12-31T04:31:16+00:00 heroku[web.1]:使用命令'lein run-m http.handler启动进程` 2011-12-31T04:31:20+00:00应用程序[web.1]:侦听地址为44321的传输dt_插座 2011-12-31T04:31:20+00:00 heroku[web.1]:错误R11(绑定错误)->绑定到端口44321的进程应为17211(请参阅环境变量port) 2011-12-31T04:31:20+00:00 heroku[web.1]:使用SIGKILL停止进程 2011-12-31T04:31:22+00:00 heroku[web.1]:状态从开始更改为崩溃 2011-12-31T04:31:22+00:00 heroku[web.1]:进程已退出 2011-12-31T04:44:59+00:00 heroku[web.1]:状态从崩溃更改为创建 2011-12-31T04:44:59+00:00 heroku[web.1]:状态从创建更改为启动 2011-12-31T04:45:02+00:00 heroku[web.1]:使用命令'lein run-m http.handler启动进程` 2011-12-31T04:45:05+00:00应用程序[web.1]:监听地址为37500的传输dt_插座 2011-12-31T04:45:06+00:00 heroku[web.1]:错误R11(绑定错误)->绑定到端口37500的进程应为14046(请参阅环境变量port) 2011-12-31T04:45:06+00:00 heroku[web.1]:使用SIGKILL停止进程 2011-12-31T04:45:07+00:00 heroku[web.1]:状态从开始更改为崩溃 2011-12-31T04:45:07+00:00 heroku[web.1]:进程已退出 2011-12-31T04:49:22+00:00 heroku[路由器]:错误H10(应用程序崩溃)->获取bkeeping.herokuapp.com/dyno=queue=wait=service=status=503字节= 2011-12-31T04:49:31+00:00 heroku[路由器]:错误H10(应用程序崩溃)->获取bkeeping.herokuapp.com/favicon.ico dyno=queue=wait=service=status=503字节= 似乎有一个问题。但是,在Compojure/Ring/Jetty部署中,我认为我无法控制端口分配。我错了吗?Webnoir会改变这种行为吗


谢谢

请确保您的处理程序绑定到正确的端口

Heroku通过环境变量
$port
提供端口号,因此在
http.handler

(let [port (Integer/parseInt (System/getenv "PORT"))]
  (run-jetty app {:port port}))

确保处理程序绑定到正确的端口

Heroku通过环境变量
$port
提供端口号,因此在
http.handler

(let [port (Integer/parseInt (System/getenv "PORT"))]
  (run-jetty app {:port port}))

虽然我得到了一些非常好的提示,但我最终还是没能克服。原来my project.clj有一个包含以下JDPA配置的defproject:

:jvm-opts ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n"] :jvm opts[“-agentlib:jdwp=transport=dt_socket,server=y,suspend=n”]
我早该注意到的。但它只是在本地工作,所以我不想质疑它。希望这能帮助其他遇到同样障碍的人

虽然我得到了一些非常好的提示,但我最终还是没能克服。原来my project.clj有一个包含以下JDPA配置的defproject:

:jvm-opts ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n"] :jvm opts[“-agentlib:jdwp=transport=dt_socket,server=y,suspend=n”]
我早该注意到的。但它只是在本地工作,所以我不想质疑它。希望这能帮助其他遇到同样障碍的人

确实是这样,我遇到了一个类似的问题,通过将端口设置为
(System/getenv“port”)
而不是手动设置的端口,很快就解决了。谢谢您的反馈。我修改了我的密码以便在端口中通过。但我还是很高兴。如果需要,我可以抛出更多代码。但是我的proc文件看起来是一样的。我正在用git-push-heroku:master将我的自定义分支推送到heroku。我看不到你的代码有什么错误。你能用主处理程序和procfile把这个项目放到网上吗?您可以删除任何其他代码,只需留下一个Hello World,我很乐意试一试。确实是这样,我遇到了一个类似的问题,通过将端口设置为
(System/getenv“port”)
而不是手动设置的端口,很快就解决了。谢谢您的反馈。我修改了我的密码以便在端口中通过。但我还是很高兴。如果n,我可以抛出更多代码