全新的Luminus应用程序给出错误:无法找到或加载主类clojure.main

时间:2015-06-22 09:16:36

标签: heroku clojure procfile luminus

我刚刚运行:

创建了一个Luminus应用程序
lein new luminus foobar

当我尝试像这样的工头一起运行它时:

foreman start

文档描述的方式,我得到了这个错误:

Error: Could not find or load main class clojure.main

这也是我从Heroku得到的同样的错误。模板创建的Procfile包含:

web: java $JVM_OPTS -cp target/foobar.jar clojure.main -m foobar.core

发生了什么,我该如何解决?

2 个答案:

答案 0 :(得分:7)

我最好的猜测是你需要使用命令lein uberjar来构建项目。这个序列有效:

$ lein new luminus foobar
Retrieving ...
Generating a Luminus project.

$ cd foobar
$ lein uberjar
Retrieving ...
Compiling foobar.session
Compiling foobar.layout
Compiling foobar.handler
Compiling foobar.routes.home
Compiling foobar.core
Compiling foobar.middleware
Created /home/ba/foobar/target/foobar-0.1.0-SNAPSHOT.jar
Created /home/ba/foobar/target/foobar.jar

$ cat Procfile 
web: java $JVM_OPTS -cp target/foobar.jar clojure.main -m foobar.core

$ java $JVM_OPTS -cp target/foobar.jar clojure.main -m foobar.core
2015-Jun-22 06:30:42 -0400 ba INFO [foobar.handler] - 
-=[ foobar started successfully nil ]=-
2015-06-22 06:30:42.998:INFO:oejs.Server:jetty-7.x.y-SNAPSHOT
2015-06-22 06:30:43.028:INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:3000

答案 1 :(得分:2)

关于Luminus和Procfile, 见this diff

修复了上游,但您可以通过更改Procfile来修复它:

    let width = self.view.frame.size.width
    button1.frame = CGRectMake(0, 0, width / 4, 40)
    button2.frame = CGRectMake(width / 4, 0, width / 4, 40)
    button3.frame = CGRectMake((width / 4) * 2, 0, width / 4, 40)
    button4.frame = CGRectMake((width / 4) * 3, 0, width / 4, 40)
    button5.frame = CGRectMake(0, 41, width / 4, 40)
    button6.frame = CGRectMake(width / 4, 41, width / 4, 40)
    button7.frame = CGRectMake((width / 4) * 2, 41, width / 4, 40)
    button8.frame = CGRectMake((width / 4) * 3, 41, width / 4, 40)

    // scrollview frame size
    scrollView.frame = CGRectMake(0, 80, self.view.frame.width, self.view.frame.height)
    scrollView.contentSize.height = self.view.frame.height
    scrollViewHeight = scrollView.frame.size.height

为:

web: java $JVM_OPTS -cp target/foobar.jar clojure.main -m foobar.core