Search code examples
syndesis

Syndesis build error: Cannot access cluster for detecting mode


When trying to build syndesis I got this error that prevents me to build the images:

[INFO] --- fabric8-maven-plugin:3.5.38:build (build) @ meta ---
[INFO] F8: Using OpenShift build with strategy S2I
[WARNING] F8: Cannot access cluster for detecting mode: Failure executing: GET at: https://192.168.42.178:8443/. Message: Unauthorized! Token may have expired! Please log-in again. Unauthorized.
[INFO] F8: Running generator spring-boot
[INFO] F8: spring-boot: Using Docker image fabric8/s2i-java:2.1 as base / builder
[WARNING] F8: Cannot access cluster for detecting mode: Failure executing: GET at: https://192.168.42.178:8443/. Message: Unauthorized! Token may have expired! Please log-in again. Unauthorized.
[ERROR] F8: Failed to execute the build [io.fabric8.kubernetes.client.DefaultKubernetesClient cannot be cast to 
io.fabric8.openshift.client.OpenShiftClient]
   ...
[ERROR] Failed to execute goal io.fabric8:fabric8-maven-plugin:3.5.38:build (build) on project meta: Failed to execute the build: io.fabric8.kubernetes.client.DefaultKubernetesClient cannot be cast to io.fabric8.openshift.client.OpenShiftClient -> [Help 1]
    ...

Command used to build syndesis: syndesis build -i -f --clean-cache -c


Solution

  • This is because you are logged out from the "oc" command. If you try to use it you will get errors like this one:

    $ oc get pods
    error: the server doesn't have a resource type "pods"
    

    To fix it, you have to login again:

    $ oc login
    Authentication required for https://192.168.42.178:8443 (openshift)
    Username: developer
    Password: 
    Login successful.
    
    You have access to the following projects and can switch between them with 'oc project <projectname>':
    
        myproject
      * syndesis
    
    Using project "syndesis".
    

    If command "oc" is not recognized, you have to setup the environment first:

    $ eval $(minishift oc-env)