fabric8-quickstarts / spring-boot-camel

a quickstart showing how to use spring boot and camel together with Kubernetes or OpenShift
Apache License 2.0
17 stars 81 forks source link

spring-boot:run succeeds but fabric8:run fails (Cannot find image) #115

Open patmoore opened 7 years ago

patmoore commented 7 years ago

On Mac. ActiveMQ is running on docker.

mvn spring-boot:run is successful BUT mvn fabric8:run FAILS.

mvn spring-boot:run:

a7fe4: startup date [Thu Nov 10 11:22:47 PST 2016]; root of context hierarchy 11:22:51.747 [main] INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest) 11:22:51.748 [main] INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) 11:22:51.792 [main] INFO o.s.w.s.h.SimpleUrlHandlerMapping - Mapped URL path [/webjars/] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 11:22:51.792 [main] INFO o.s.w.s.h.SimpleUrlHandlerMapping - Mapped URL path [/] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 11:22:51.843 [main] INFO o.s.w.s.h.SimpleUrlHandlerMapping - Mapped URL path [//favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 11:22:51.970 [main] INFO o.a.c.i.c.DefaultTypeConverter - Loaded 193 type converters 11:22:52.988 [main] INFO o.s.j.e.a.AnnotationMBeanExporter - Registering beans for JMX exposure on startup 11:22:52.995 [main] INFO o.s.b.a.e.jmx.EndpointMBeanExporter - Registering beans for JMX exposure on startup 11:22:52.999 [main] INFO o.s.b.c.e.AnnotationConfigEmbeddedWebApplicationContext - Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@55a1cafa: startup date [Thu Nov 10 11:22:52 PST 2016]; parent: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3e0a7fe4 11:22:53.041 [main] INFO o.s.b.f.s.DefaultListableBeanFactory - Overriding bean definition for bean 'handlerExceptionResolver' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration; factoryMethodName=handlerExceptionResolver; initMethodName=null; destroyMethodName=(inferred); defined in org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=endpointWebMvcChildContextConfiguration; factoryMethodName=compositeHandlerExceptionResolver; initMethodName=null; destroyMethodName=(inferred); defined in org.springframework.boot.actuate.autoconfigure.EndpointWebMvcChildContextConfiguration] 11:22:53.100 [main] INFO o.s.b.c.e.t.TomcatEmbeddedServletContainer - Tomcat initialized with port(s): 8081 (http) 11:22:53.101 [main] INFO o.a.catalina.core.StandardService - Starting service Tomcat 11:22:53.101 [main] INFO o.a.catalina.core.StandardEngine - Starting Servlet Engine: Apache Tomcat/8.5.5 11:22:53.108 [localhost-startStop-1] INFO o.a.c.c.C.[Tomcat-1].[localhost].[/] - Initializing Spring embedded WebApplicationContext 11:22:53.109 [localhost-startStop-1] INFO o.s.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 110 ms 11:22:53.116 [localhost-startStop-1] INFO o.s.b.w.s.ServletRegistrationBean - Mapping servlet: 'dispatcherServlet' to [/] 11:22:53.193 [main] INFO o.s.b.a.e.mvc.EndpointHandlerMapping - Mapped "{[/health || /health.json],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(java.security.Principal) 11:22:53.212 [main] INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/error]}" onto public java.util.Map<java.lang.String, java.lang.Object> org.springframework.boot.actuate.endpoint.mvc.ManagementErrorEndpoint.invoke() 11:22:53.220 [main] INFO o.s.w.s.h.SimpleUrlHandlerMapping - Mapped URL path [/webjars/] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 11:22:53.220 [main] INFO o.s.w.s.h.SimpleUrlHandlerMapping - Mapped URL path [/*] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 11:22:53.234 [main] INFO o.s.w.s.m.m.a.RequestMappingHandlerAdapter - Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@55a1cafa: startup date [Thu Nov 10 11:22:52 PST 2016]; parent: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3e0a7fe4 11:22:53.302 [main] INFO o.a.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-8081"] 11:22:53.316 [main] INFO o.a.coyote.http11.Http11NioProtocol - Starting ProtocolHandler [http-nio-8081] 11:22:53.331 [main] INFO o.a.tomcat.util.net.NioSelectorPool - Using a shared selector for servlet write/read 11:22:53.354 [main] INFO o.s.b.c.e.t.TomcatEmbeddedServletContainer - Tomcat started on port(s): 8081 (http) 11:22:53.360 [main] INFO o.s.c.s.DefaultLifecycleProcessor - Starting beans in phase 0 11:22:53.371 [main] INFO o.s.b.a.e.jmx.EndpointMBeanExporter - Located managed bean 'healthEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=healthEndpoint] 11:22:53.397 [main] INFO o.s.c.s.DefaultLifecycleProcessor - Starting beans in phase 2147483647 11:22:53.412 [main] INFO o.a.c.spring.boot.RoutesCollector - Loading additional Camel XML routes from: classpath:camel/.xml 11:22:53.412 [main] INFO o.a.c.spring.boot.RoutesCollector - Loading additional Camel XML rests from: classpath:camel-rest/*.xml 11:22:53.412 [main] INFO o.a.c.spring.boot.RoutesCollector - Starting CamelMainRunController to ensure the main thread keeps running 11:22:53.416 [CamelMainRunController] INFO o.a.camel.spring.SpringCamelContext - Apache Camel 2.18.0 (CamelContext: camel) is starting 11:22:53.418 [CamelMainRunController] INFO o.a.c.m.ManagedManagementStrategy - JMX is enabled 11:22:53.420 [main] INFO o.a.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-8080"] 11:22:53.420 [main] INFO o.a.coyote.http11.Http11NioProtocol - Starting ProtocolHandler [http-nio-8080] 11:22:53.420 [main] INFO o.a.tomcat.util.net.NioSelectorPool - Using a shared selector for servlet write/read 11:22:53.422 [main] INFO o.s.b.c.e.t.TomcatEmbeddedServletContainer - Tomcat started on port(s): 8080 (http) 11:22:53.441 [main] INFO i.f.q.camel.amq.Application - Started Application in 6.373 seconds (JVM running for 14.334) 11:22:53.543 [CamelMainRunController] INFO o.a.c.i.DefaultRuntimeEndpointRegistry - Runtime endpoint registry is in extended mode gathering usage statistics of all incoming and outgoing endpoints (cache limit: 1000) 11:22:53.855 [CamelMainRunController] INFO o.a.c.i.DefaultStreamCachingStrategy - StreamCaching in use with spool directory: /var/folders/vq/vyk626jn4dvfgrczzzb4ljkm0000gn/T/camel/camel-tmp-c8f883c3-176c-408f-8f81-58722a7b1b7e and rules: [Spool > 128K body size] 11:22:53.944 [CamelMainRunController] INFO o.a.camel.builder.xml.XPathBuilder - Created default XPathFactory com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl@2f72409d 11:22:53.969 [CamelMainRunController] INFO o.a.camel.spring.SpringCamelContext - Route: generate-order-route started and consuming from: timer://order?period=3000 11:22:53.998 [CamelMainRunController] INFO o.a.camel.spring.SpringCamelContext - Route: jms-cbr-route started and consuming from: amq://incomingOrders 11:22:53.999 [CamelMainRunController] INFO o.a.camel.spring.SpringCamelContext - Total 2 routes, of which 2 are started. 11:22:54.001 [CamelMainRunController] INFO o.a.camel.spring.SpringCamelContext - Apache Camel 2.18.0 (CamelContext: camel) started in 0.584 seconds 11:22:55.028 [Camel (camel) thread #10 - timer://order] INFO generate-order-route - Generating order order1.xml 11:22:55.145 [Camel (camel) thread #8 - JmsConsumer[incomingOrders]] INFO jms-cbr-route - Sending order order1.xml to another country 11:22:55.145 [Camel (camel) thread #8 - JmsConsumer[incomingOrders]] INFO jms-cbr-route - Done processing order1.xml 11:22:58.009 [Camel (camel) thread #10 - timer://order] INFO generate-order-route - Generating order order2.xml 11:22:58.026 [Camel (camel) thread #1 - JmsConsumer[incomingOrders]] INFO jms-cbr-route - Sending order order2.xml to the US 11:22:58.028 [Camel (camel) thread #1 - JmsConsumer[incomingOrders]] INFO jms-cbr-route - Done processing order2.xml 11:23:01.008 [Camel (camel) thread #10 - timer://order] INFO generate-order-route - Generating order order3.xml 11:23:01.024 [Camel (camel) thread #5 - JmsConsumer[incomingOrders]] INFO jms-cbr-route - Sending order order3.xml to the US 11:23:01.025 [Camel (camel) thread #5 - JmsConsumer[incomingOrders]] INFO jms-cbr-route - Done processing order3.xml ....

BUT mvn fabric8:run fails:

[INFO] Installing /Users/patmoore/side-projects/java/fabric8/fabric8-quickstarts/spring-boot-camel-amq/pom.xml to /Users/patmoore/.m2/repository/io/fabric8/quickstarts/spring-boot-camel-amq/1.0-SNAPSHOT/spring-boot-camel-amq-1.0-SNAPSHOT.pom [INFO] Installing /Users/patmoore/side-projects/java/fabric8/fabric8-quickstarts/spring-boot-camel-amq/target/classes/META-INF/fabric8/openshift.yml to /Users/patmoore/.m2/repository/io/fabric8/quickstarts/spring-boot-camel-amq/1.0-SNAPSHOT/spring-boot-camel-amq-1.0-SNAPSHOT-openshift.yml [INFO] Installing /Users/patmoore/side-projects/java/fabric8/fabric8-quickstarts/spring-boot-camel-amq/target/classes/META-INF/fabric8/openshift.json to /Users/patmoore/.m2/repository/io/fabric8/quickstarts/spring-boot-camel-amq/1.0-SNAPSHOT/spring-boot-camel-amq-1.0-SNAPSHOT-openshift.json [INFO] Installing /Users/patmoore/side-projects/java/fabric8/fabric8-quickstarts/spring-boot-camel-amq/target/classes/META-INF/fabric8/kubernetes.yml to /Users/patmoore/.m2/repository/io/fabric8/quickstarts/spring-boot-camel-amq/1.0-SNAPSHOT/spring-boot-camel-amq-1.0-SNAPSHOT-kubernetes.yml [INFO] Installing /Users/patmoore/side-projects/java/fabric8/fabric8-quickstarts/spring-boot-camel-amq/target/classes/META-INF/fabric8/kubernetes.json to /Users/patmoore/.m2/repository/io/fabric8/quickstarts/spring-boot-camel-amq/1.0-SNAPSHOT/spring-boot-camel-amq-1.0-SNAPSHOT-kubernetes.json [INFO] [INFO] <<< fabric8-maven-plugin:3.1.92:run (default-cli) < install @ spring-boot-camel-amq <<< [INFO] [INFO] --- fabric8-maven-plugin:3.1.92:run (default-cli) @ spring-boot-camel-amq --- [INFO] F8: Using Kubernetes at https://192.168.99.100:8443/ in namespace default with manifest /Users/patmoore/side-projects/java/fabric8/fabric8-quickstarts/spring-boot-camel-amq/target/classes/META-INF/fabric8/kubernetes.yml [INFO] Using namespace: default [INFO] Updating a Service from kubernetes.yml [INFO] Updated Service: target/fabric8/applyJson/default/service-spring-boot-camel-amq-1.json [INFO] Updating Deployment from kubernetes.yml [INFO] Updated Deployment: target/fabric8/applyJson/default/deployment-spring-boot-camel-amq-1.json [INFO] F8: HINT: Use the command kubectl get pods -w to watch your pods start up [INFO] F8: Scaling Deployment default/spring-boot-camel-amq to replicas: 1 [INFO] F8: Watching pods with selector LabelSelector(matchExpressions=[], matchLabels={project=spring-boot-camel-amq, provider=fabric8, group=io.fabric8.quickstarts}, additionalProperties={}) waiting for a running pod... [INFO] F8:[NEW] spring-boot-camel-amq-3986059896-xto44 status: Pending [INFO] F8:[NEW] spring-boot-camel-amq-3986059896-xto44 status: Pending [INFO] F8:[NEW] spring-boot-camel-amq-3986059896-xto44 status: Pending [INFO] F8:[NEW] spring-boot-camel-amq-3986059896-xto44 status: Pending

kubectl describe pod spring-boot-camel-amq-3986059896-xto44 Name: spring-boot-camel-amq-3986059896-xto44 Namespace: default Node: minikube/192.168.99.100 Start Time: Thu, 10 Nov 2016 10:59:30 -0800 Labels: group=io.fabric8.quickstarts pod-template-hash=3986059896 project=spring-boot-camel-amq provider=fabric8 version=1.0-SNAPSHOT Status: Pending IP: 172.17.0.12 Controllers: ReplicaSet/spring-boot-camel-amq-3986059896 Containers: spring-boot: Container ID:
Image: quickstarts/spring-boot-camel-amq:snapshot-161110-105909-0023 Image ID:
Ports: 8080/TCP, 9779/TCP, 8778/TCP Limits: cpu: 1 memory: 256Mi Requests: cpu: 200m memory: 256Mi State: Waiting Reason: ImagePullBackOff Ready: False Restart Count: 0 Liveness: http-get http://:8081/health delay=180s timeout=1s period=10s #success=1 #failure=3 Readiness: http-get http://:8081/health delay=10s timeout=1s period=10s #success=1 #failure=3 Environment Variables: ACTIVEMQ_SERVICE_NAME: message-broker KUBERNETES_NAMESPACE: default (v1:metadata.namespace) Conditions: Type Status Initialized True Ready False PodScheduled True Volumes: default-token-rjcrw: Type: Secret (a volume populated by a Secret) SecretName: default-token-rjcrw QoS Tier: Burstable Events: FirstSeen LastSeen Count From SubobjectPath Type Reason Message


16m 16m 1 {default-scheduler } Normal Scheduled Successfully assigned spring-boot-camel-amq-3986059896-xto44 to minikube 16m 5m 7 {kubelet minikube} spec.containers{spring-boot} Normal Pulling pulling image "quickstarts/spring-boot-camel-amq:snapshot-161110-105909-0023" 16m 5m 7 {kubelet minikube} spec.containers{spring-boot} Warning Failed Failed to pull image "quickstarts/spring-boot-camel-amq:snapshot-161110-105909-0023": Error: image quickstarts/spring-boot-camel-amq not found 16m 5m 7 {kubelet minikube} Warning FailedSync Error syncing pod, skipping: failed to "StartContainer" for "spring-boot" with ErrImagePull: "Error: image quickstarts/spring-boot-camel-amq not found"

16m 14s 66 {kubelet minikube} spec.containers{spring-boot} Normal BackOff Back-off pulling image "quickstarts/spring-boot-camel-amq:snapshot-161110-105909-0023" 16m 14s 66 {kubelet minikube} Warning FailedSync Error syncing pod, skipping: failed to "StartContainer" for "spring-boot" with ImagePullBackOff: "Back-off pulling image \"quickstarts/spring-boot-camel-amq:snapshot-161110-105909-0023\""`

rhuss commented 7 years ago

Have you build the image against minikube's docker daemon ? E.g. did you an eval $(minikube docker-env) before ?

Minikube can't find the image (so it has been built with a different docker daemon), so it trie to pull it from Docker Hub where it obviously can't find it.

patmoore commented 7 years ago

This answer did work. Thanks. the README should be changed.

What do you mean "different docker daemon" ? I did the mvn clean install

FYI - now error is :

Invalid bean definition with name 'jmsConnectionFactory' defined in class path resource [spring/amq.xml]: Could not resolve placeholder 'message-broker.service.host' in string value "tcp://${${activemq.service.name}.service.host}:${${activemq.service.name}.service.port}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'message-broker.service.host' in string value "tcp://${${activemq.service.name}.service.host}:${${activemq.service.name}.service.port}"

so presumedly I have to figure out how to set up the environment. manually? Or is there another way?

davsclaus commented 7 years ago

@patmoore a PR to update the readme file is welcome