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

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

My Build.scala settings look 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, when deploying, I get the following message:

[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 the error "502 Bad Gateway - nginx / 1.2.0" ...

I think this is because I am using a Mac that 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 the "deployParams" parameter as the Map, but I am completely new to Scala and dont know how. I want to do something like 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 don't understand what to do or what might be wrong with my deployment? Even when creating a brand new Play app without a database connection, it keeps failing.

Any insight on what I might be doing wrong would be greatly appreciated :) Thanks!

+3


source to share


2 answers


You can try the options.

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

      



The first parameter sets the runtime to java 1.7, which is probably your problem. If sbt is using JDK7 then you need to install RUN @cloud framework in java 7.

The second option fixes ExceptionInInitializerError

by disabling browser opening on deployment. In my experience, this error indicates that you are using Java 7 on your machine, because I've only seen this error with Java 7, not Java 6.

+3


source


Also, always remember how to look up the logs for your application, either with the web console or with the bees app: tail command if it fails in a specific specific container (we can't return a non-500 error, and don't want to leak information about your error on the Internet, therefore, it is a common error in this case).



0


source







All Articles