Monday 29 August 2016

CWWKF1219E: The IBM WebSphere Liberty Repository cannot be reached

This one has been bugging me for a day or so: -

docker build -t websphere-liberty:artifactory .

...

Step 6 : RUN installUtility testConnection
 ---> Running in 40c4586b857e
Testing the connection to all configured repositories ...
This process might take several minutes to complete.

Configured Repositories
----------------------------------------------------------------------
Name: IBM WebSphere Liberty Repository (Default Assets Repository)
Status: Failed to connect to the configured repository.
Reason: CWWKF1219E: The IBM WebSphere Liberty Repository cannot be
    reached.
Verify that your computer has network access and firewalls are
    configured correctly, then try the action again. If the connection
    still fails, the repository server might be temporarily unavailable.

The command '/bin/sh -c installUtility testConnection' returned a non-zero code: 33



This occurs when running a WebSphere Liberty profile container within Docker on my Mac.

Initially, I was trying to install a Liberty component - adminCenter - which was returning the same CWWKF1219E exception.

To further diagnose this, I tweaked my Dockerfile: -

FROM websphere-liberty:webProfile7
ADD server.xml /opt/ibm/wlp/usr/servers/defaultServer/
# ADD repositories.properties /opt/ibm/wlp/etc/
# ADD wlpRepo.zip /opt/ibm/wlp/usr/shared/resources/
ADD artifactory.war /opt/ibm/wlp/usr/servers/defaultServer/dropins/
ADD SuperSnoopWeb.war /opt/ibm/wlp/usr/servers/defaultServer/dropins/
ENV LICENSE accept
RUN installUtility testConnection
# RUN installUtility install --acceptLicense adminCenter-1.0


and added the line: -

RUN installUtility testConnection

commenting out the other ADD and RUN lines.

I spent many a happy hour tinkering around with local repositories, hence the lines: -

# ADD repositories.properties /opt/ibm/wlp/etc/
# ADD wlpRepo.zip /opt/ibm/wlp/usr/shared/resources/

I tested Liberty's testConnection utility: -

~/Downloads/wlp/bin/installUtility testConnection

Testing the connection to all configured repositories ...
This process might take several minutes to complete.

Configured Repositories
----------------------------------------------------------------------
Name: IBM WebSphere Liberty Repository (Default Assets Repository)
Status: Successfully connected to the configured repository.


so the actual on-line repository service was obviously A-OK.

Long story short, the problem appeared to be that Liberty within the Docker container wasn't able to reach the internet.

I dug around on Google, and found this: -


which said, in part: -

<snip>
If you are running Docker on OSX using Docker Machine, then the following worked for me:

docker-machine restart

<...wait for it to restart, which takes up to a minute...>

docker-machine env
eval $(docker-machine env)

Then (at least in my experience), if you ping google.com from a container all will be well.

</snip>

I tried this: -

docker-machine stop default
docker-machine start default

and, quelle surprise, testConnection just worked: -

docker build -t websphere-liberty:artifactory .

Sending build context to Docker daemon 137.8 MB
Step 1 : FROM websphere-liberty:webProfile7
 ---> 2594eeac8473
Step 2 : ADD server.xml /opt/ibm/wlp/usr/servers/defaultServer/
 ---> Using cache
 ---> 147f20ffdbe6
Step 3 : ADD artifactory.war /opt/ibm/wlp/usr/servers/defaultServer/dropins/
 ---> Using cache
 ---> b53879baf155
Step 4 : ADD SuperSnoopWeb.war /opt/ibm/wlp/usr/servers/defaultServer/dropins/
 ---> Using cache
 ---> 4e968a92672d
Step 5 : ENV LICENSE accept
 ---> Using cache
 ---> 3dc40c65b753
Step 6 : RUN installUtility testConnection
 ---> Using cache
 ---> 982821eafe3c
Successfully built 982821eafe3c


which is nice :-)

No comments:

Visual Studio Code - Wow 🙀

Why did I not know that I can merely hit [cmd] [p]  to bring up a search box allowing me to search my project e.g. a repo cloned from GitHub...