简体   繁体   中英

Cannot Deploying spring boot application on cloud

I have a create an application using spring boot and i am trying to deploy it on cloud, i have tried cloudfoundary, heroku but not successful.

I am to run it on my local machine, it runs as expected and I am able to access it using web browser. I installed cloudfoundary plugin in eclipse and tried deploying the same spring application but the I get the error in the logs as resource not available 这是我在cloudfoundary上部署时收到的消息

I also tried heroku and it was failing initially because I was using a local jar file in the maven project https://devcenter.heroku.com/articles/local-maven-dependencies

and I added the jar file in the repo folder as explained on heroku website and it was successfully deployed, but when I try to access the webpage i get this error in the logs:

015-08-02T17:20:00.167461+00:00 heroku[router]: at=error code=H14     
desc="No web processes running" method=GET path="/" 
host=ajak6.herokuapp.com request_id=5a817954-071f-48e7-92a8-925bf749e055 
fwd="71.206.239.46" dyno= connect= service= status=503 bytes=

But the same application is accessible on my local machine when I run it as a spring boot application from eclipse.

my spring controller looks like :

@Controller
public class ApplicationController {

@RequestMapping("/")
public String index(){
    return "index";
}

For database I am using AWS RDS and a lightweight ORM framework similar to hibernate. This framework is the local jar I was talking about which is not available on Maven. Please let me know in case you need more details on this. But trust me it is running locally and I can expose the url using ngrok but I am not able to figure out why the deployment is not working. Anyhelp will be great. If you know anyother paas provider where I can upload my project please share.

From your logfile, it looks like Eclipse is generating a complete .war file and pushing that to Cloud Foundry. You will have more success if you generate a regular .jar file, and Spring Boot will embed a servlet container in there.

Check your pom.xml, and remove this line:

<packaging>war</packaging>

I'm assuming Eclipse can handle it from there. If not, go to the directory with your pom.xml, execute mvn package , and do a cf push on the generated .jar file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM