Thursday, December 31, 2015

Spring Cloud, Cloud Foundry

I returned to part 6 and part 7 of Building Cloud Native Apps with Spring with the idea of deploying the app into my local Cloud Foundry instance instead of IBM Bluemix.

I have to say that once you have got through the ordeal of setting up Cloud Foundry locally, it is a lot less trouble to work with than Bluemix.  I skipped over gobs of instructions about checking things into github, writing little shell scripts and navigating around doing things in the Bluemix web GUI.

All I needed to do to get this working was to register Eureka as a CF service:
cf cups ocr-eureka -p '{"uri": "http://ocr-eureka.bosh-lite.com/eureka/"}'
 and then make the changes described to the application.yml files.

I had a problem with the Hystrix app.  It was giving me a big stack trace about Tomcat failing to start.  This turned out to be the error that was causing the problem:

    java.lang.NoSuchMethodError: javax.servlet.ServletContext.addServlet(Ljava/lang/String;Ljavax/servlet/Servlet;)Ljavax/servlet/ServletRegistration$Dynamic;

I found some discussion of this at Getting NoSuchMethodError: javax.servlet.ServletContext.addServlet in Spring Boot while running a Spring MVC application.  Checking the dependencies, I found that Turbine had a dependency on servlet-api 2.5.  I tried excluding that in the Hystrix POM:


and that fixed the problem.

Deploying an app into CF seems really slow.  It's doing some big downloads every time (Open Jdk JRE 1.8.0_65, Open JDK Like Memory Calculator 2.0.1_RELEASE, Spring Auto Reconfiguration 1.10.0_RELEASE).  I feel like it would be hard to work this way.  Wondering if there's a way to speed this up?

No comments:

Post a Comment