Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"502 Bad Gateway" with CloudBees Play2 Deployment (Java and Scala)

I followed the instructions described here to deploy my Play2 application to CloudBees: https://developer.cloudbees.com/bin/view/RUN/Playframework

My Build.scala settings looks like this:

val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA)
        .settings(cloudBeesSettings :_*)
        .settings(CloudBees.applicationId := Some("application"))
        .settings(CloudBees.username := Some("username"))
        .settings(CloudBees.apiKey := Some("0123456789ABCDEF"))
        .settings(CloudBees.apiSecret := Some("88888889999999$999999998888888="))
        .settings(CloudBees.host := "https://api.cloudbees.com/api")
        .settings(
          // Add your own project settings here  
        )

However, I get the following message when deploying:

[info] Deploying application-1.0-SNAPSHOT to Run@Cloud/username/application
........................uploaded 25%
........................uploaded 50%
........................uploaded 75%
........................upload completed
deploying application to server(s)...
....[info] Application available at http://application.username.cloudbees.net
[error] {file:/Users/user/dev/play2/Application/application/}Application/*:cloudbees-deploy: java.lang.ExceptionInInitializerError
[error] Total time: 74 s, completed Feb 3, 2013 7:44:43 PM

And when I visit http://application.username.cloudbees.net, I get a "502 Bad Gateway - nginx/1.2.0" error...

I'm thinking this is because I'm using a Mac, which has Java 1.7, and CloudBees is expecting 1.6...? From the sbt-cloudbees-play-plugin project source, I can see where I can set a "deployParams" option as a Map, but I'm completely new to Scala and am unsure how to do so. I want to do something like in Build.scala, but I keep getting errors:

.settings(CloudBees.deployParams += ("java_version" -> "1.7"))

The java_version parameter is described here: https://developer.cloudbees.com/bin/view/RUN/JVMVersion

You can see the source of the project here: https://github.com/CloudBees-community/sbt-cloudbees-play-plugin/blob/master/src/main/scala/cloudbees.scala

I'm at a loss at what to do or what could be wrong with my deployment? Even when creating a brand new Play application with no database connections it continues to fail.

Any insight into what I may be doing wrong would be greatly appreciated :) Thanks!

like image 395
ossys Avatar asked May 06 '26 19:05

ossys


1 Answers

You can try the options.

CloudBees.deployParams := Map("runtime.java_version" -> "1.7"),
CloudBees.openOnUpload := false,

The first option sets the runtime to java 1.7 which is probably your issue. If sbt is using JDK7 then you will need to set the RUN@cloud platform to java 7.

The second option fixes the ExceptionInInitializerError by disabling the browser opening on deploy. In my experience this error points to Java 7 being used on your computer because I've only seen this error with Java 7 and not Java 6.

like image 162
Ivan Meredith Avatar answered May 09 '26 01:05

Ivan Meredith



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!