3

I just created a Luminus app by running:

lein new luminus foobar

and when I try to run it with foreman like this:

foreman start

the way the docs describe, I get this error:

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

which is also the same error I get from Heroku. The Procfile that the template created contains this:

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

What's going on, how do I fix it?

Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622

2 Answers2

8

My best guess is that you need to build the project with the command lein uberjar. This sequence works:

$ 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
Bruce Adams
  • 443
  • 2
  • 5
2

Regarding Luminus and the Procfile, see this diff.

Fixed upstream but you can fix it in your app by changing your Procfile from:

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

to:

web: java $JVM_OPTS -cp target/uberjar/foobar.jar clojure.main -m foobar.core
David Arenburg
  • 91,361
  • 17
  • 137
  • 196
dviramontes
  • 146
  • 1
  • 5