Fork me on GitHub
#aws
<
2020-04-01
>
jjttjj20:04:29

I'm attempting to deploy an uberjar to elastic beanstalk for the first time. I'm using the preconfigured Java platform. I have a main class compiled in my jar and working properly on my local machine, ie I can just do

java -jar MyProject.jar
And it starts up properly (locally). I have uploaded this jar to my beanstalk app. But when I visit the URL I just get a 502 Bad Gateway. the web.log is showing
-------------------------------------
/var/log/web-1.log
-------------------------------------
Clojure 1.6.0
user=>
I'm not seeing clojure 1.6 at all in my deps tree. Any tips on how I can start to debug this? Is there anything else I need to do to prepare the jar?

hiredman22:04:33

I bet I know

hiredman22:04:03

a jar often has a thing called a manifest in it

hiredman22:04:21

and in the manifest it might have a Main-Class specified

hiredman22:04:39

java -jar looks for the Main-Class in the manifest and runs that

hiredman22:04:05

it looks like your jar is specifying clojure.main as the Main-Class, which just starts the clojure repl

hiredman22:04:18

which is why you get the repl starting output in the log there

hiredman22:04:03

so however you are building your jar isn't setting the Main-Class attribute to whatever your main class is

jjttjj23:04:23

My manifest.mf in the jar looks like this

Manifest-Version: 1.0
Built-By: depstar
Build-Jdk: 13.0.1
Multi-Release: true
Main-Class: main
where the main namespace is indeed the correct main class (yeah I know horrible name and single segment namespaces are not a good practice... that shouldn't be the issue though right?)

jjttjj23:04:11

I think I might have to do additional config related stuff for beanstalk instead of just using the regular jar

hiredman23:04:46

I would double check that the beanstalk jar is the same one you are looking at locally, because that looks like a jar launched with a main class of clojure.main

Alex Miller (Clojure team)00:04:03

it would say clojure.main then

hiredman23:04:37

or look back over whatever tutorial you are looking at (I assume you are working from some tutorial because you are using clojure 1.6.0)

jjttjj23:04:47

that's the thing though I'm not using clojure 1.6, and it doesn't appear in my deps tree via clj -Stree

hiredman23:04:01

you should check what java version you are using locally and in beanstalk

hiredman23:04:16

the multi-release thing could trip you up

jjttjj23:04:34

Using 1.13 locally but I also have it working on another server (via the jar) on 1.8 with no issues

jjttjj23:04:47

beanstalk is 1.8 I believe