Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[devworkspace] java-spring-petclinic sample cannot connect to mysql database, running in the separate container #20787

Closed
vitaliy-guliy opened this issue Nov 17, 2021 · 3 comments
Assignees
Labels
area/devfile-spec Issues related to Devfile v2 area/samples kind/bug Outline of a bug - must adhere to the bug report template. severity/P2 Has a minor but important impact to the usage or development of the system. sprint/current
Milestone

Comments

@vitaliy-guliy
Copy link
Contributor

vitaliy-guliy commented Nov 17, 2021

Describe the bug

Java-Mysql sample does not work in devworkspace.
The sample tries to connect to mysql by uri jdbc:mysql://localhost/petclinic, but seems the host with mysql is not recognized as localhost.
The same sample works fine on local minikube deployment (and on other dev clusters).

Che version

7.39@latest

Steps to reproduce

On devworkspace:

  1. create workspace using https://github.com/che-samples/java-spring-petclinic/tree/devfilev2
  2. open /projects/java-spring-petclinic/src/main/resources/db/mysql/data.sql, go to first row for table owners and replace values on test (screenshot 1)
  3. navigate to My Workspace view on the right and run prepare-database command
  4. build the sample by running build command from My Workspace view or by opening a terminal in tools container and launching mvn clean install
  5. Use mvn spring-boot:run -Dspring-boot.run.profiles=mysql command to run the samle

Check the output, be sure mysql profile is using (screenshot 2)

  1. At this step, the sample will fail with error
    com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
    (screenshot 3)

Expected behavior

Running sample as on screenshot 4.

Runtime

minikube

Screenshots

  • screenshot 1
    Screenshot from 2021-11-17 15-56-07

  • screenshot 2
    Screenshot from 2021-11-17 16-09-27

  • screenshot 3
    Screenshot from 2021-11-17 16-17-52

  • screenshot 4 (working sample, workspace was created using devfile v1)
    Screenshot from 2021-11-17 16-19-42

Installation method

chectl/next

Environment

Linux

Eclipse Che Logs

No response

Additional context

No response

@vitaliy-guliy vitaliy-guliy added kind/bug Outline of a bug - must adhere to the bug report template. team/plugins severity/P2 Has a minor but important impact to the usage or development of the system. area/samples and removed team/plugins labels Nov 17, 2021
@svor svor added the area/devfile-spec Issues related to Devfile v2 label Nov 17, 2021
@benoitf
Copy link
Contributor

benoitf commented Nov 17, 2021

is that https://github.com/che-samples/java-spring-petclinic/blob/devfilev2/devfile.yaml#L34 changed to internal is changing something ?

@svor
Copy link
Contributor

svor commented Nov 17, 2021

@benoitf the same result:
screenshot-che-eclipse-che apps cluster-ttxw6 ttxw6 sandbox46 opentlc com-2021 11 17-20_55_47

@benoitf
Copy link
Contributor

benoitf commented Nov 23, 2021

Hello,

so I reproduced the problem but the root cause is

Caused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)

It's about a deprecation on TLS
https://www.oracle.com/java/technologies/javase/11-0-11-relnotes.html#JDK-8202343
https://aws.amazon.com/blogs/opensource/tls-1-0-1-1-changes-in-openjdk-and-amazon-corretto/

In main branch, devfile is using a che-java image using Java 11.0.10 while in Universal Developer Image java version is 11.0.12 which has the deprecated TLS removed

Also for MySQL we should update MySQL to a more recent version
current version used in devfile is

bash-4.2$ mysql --version
mysql  Ver 14.14 Distrib 5.7.24, for Linux (x86_64) using  EditLine wrapper

it's from 2018 !
https://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-24.html

As upgrading to a more recent version like 5.7.36, we could also take the opportunity to use a multi-arch image

And maybe use https://hub.docker.com/_/mariadb?tab=tags that is a drop-in replacement of MySQL

or any other solution

@svor svor mentioned this issue Nov 30, 2021
19 tasks
@svor svor changed the title [devworkspace] java-spring-petclinic sample cannot connect to mysql database, running in the neighbor container [devworkspace] java-spring-petclinic sample cannot connect to mysql database, running in the separate container Dec 1, 2021
@svor svor mentioned this issue Dec 20, 2021
15 tasks
@svor svor mentioned this issue Jan 11, 2022
17 tasks
@svor svor mentioned this issue Jan 31, 2022
18 tasks
@svor svor added this to the 7.44 milestone Feb 1, 2022
@svor svor removed the sprint/next label Feb 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/devfile-spec Issues related to Devfile v2 area/samples kind/bug Outline of a bug - must adhere to the bug report template. severity/P2 Has a minor but important impact to the usage or development of the system. sprint/current
Projects
None yet
Development

No branches or pull requests

3 participants