Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (29.3k points)

I am running the code within the Bluemix build & Deploy pipeline, NOT inside the Liberty Profile app server (the application works fine there), the problem lies on the BUILD Stage of the Pipeline (mvn clean install) while running my Unit Tests, here's the error message

Building new Hibernate SessionFactory 2015-04-11 15:04:49 [main] ERROR o.h.util.JDBCExceptionReporter - Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

The Unit Test classes can't connect to the database.

My code doesn't have anything special, you can create any standard JDBC Connection in a JUnit Test class and try to establish a connection with the db, but if you want to easily confirm this connectivity limitation, here's how you can test this without any Java code:

Create a Liberty Profile app with some Starter Code

Create and bind the "ClearDB MySQL" service to it

In the App Overview page, expand the ClearDB box by clicking on "Show Credentials" and copy the hostname (e.g., us-cdbr-test-west-07.cleardb.net).

Add GIT, back to the App Overview, click on EDIT CODE, Click on "Build & Deploy", click on the configuration icon of the "BUILD Stage", select "Configure Stage" and add the following code to the command box:

code:

REMOTEHOST=us-cdbr-test-west-07.cleardb.net

REMOTEPORT=3306

TIMEOUT=1

if nc -w $TIMEOUT -z $REMOTEHOST $REMOTEPORT; then

    echo "I was able to connect to ${REMOTEHOST}:${REMOTEPORT}"

else

    echo "Connection to ${REMOTEHOST}:${REMOTEPORT} failed; exit code from netcat was $?"

fi

Start the BUILD Stage and check if this message shows up:

[86d18f86-4ade-4e02-8282-171dc9757272] $ /bin/bash /tmp/hudson5506792757013948518.sh

Connection to us-cdbr-test-west-07.cleardb.net:3306 failed; exit code from netcat was 1

Please let me know if there's a way to configure the pipeline so it can communicate with ClearDB.

1 Answer

0 votes
by (50.2k points)

The error occurs due to lack of some updates

There has been an update to the pipeline service in Bluemix, which has fixed this bug. Connections to the "ClearDB" service should now be working.

I hope your code running well right now after this update.

Browse Categories

...