Che: Java-MySQL devfile built app does not work

Created on 20 Jul 2019  路  12Comments  路  Source: eclipse/che

Describe the bug

The current java-mysql devfile and sample project build and run successfully, but on attempting to do any database operations in the app, an exception is thrown:

2019-07-20 01:40:58.181 ERROR 274 --- [nio-8080-exec-4] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet] with root cause

java.sql.SQLSyntaxErrorException: Table 'petclinic.owners' doesn't exist
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) ~[mysql-connector-java-8.0.16.jar!/:8.0.16]
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) ~[mysql-connector-java-8.0.16.jar!/:8.0.16]
        at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) ~[mysql-connector-java-8.0.16.jar!/:8.0.16]
        at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:955) ~[mysql-connector-java-8.0.16.jar!/:8.0.16]
        at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1005) ~[mysql-connector-java-8.0.16.jar!/:8.0.16]
        at 
[...]

Che version

  • [ ] latest
  • [x] nightly
  • [ ] other: please specify

Steps to reproduce

  1. Create workspace: [che-url]/#/load-factory?url=https://raw.githubusercontent.com/eclipse/che-devfile-registry/master/devfiles/java-mysql/devfile.yaml
  2. Use the maven build task
  3. Use the run webapp task
  4. Navigate to e.g. "Find owners" and attempt to "find" an owner

Expected behavior

Webapp should connect to database as expected

Additional context

arelanguages kinbug severitP1 statuin-progress tealanguages

All 12 comments

The problem is that the "petclinic" database has to be exist with all tables for the app to work but it doesn't. To create it I added a new command to execute sql script (the script is already prepared in the project) which creates "petclinic" database and all necessary tables, but I got a problem when tried to execute mysql command in mysql container, the problem is described here: https://github.com/eclipse/che/issues/13416

Putting P1 as this affect the default stacks we are embedding

@sparkoo could you please clarify when did you get that error. Is it still reproducible with this PR: https://github.com/eclipse/che-devfile-registry/pull/51?

@svor I get this error when running run webapp task. Your PR don't fix it for me. It's the same. I ran prepare database and maven build first.

@sparkoo I can't reproduce this problem.
As I see @amisevsk also tested this devfile with my changes and he didn't find any problems https://github.com/eclipse/che-devfile-registry/pull/51#pullrequestreview-266609816.

I've just checked and everything works fine.
Screenshot from 2019-07-29 09-35-15

I'm going to close this issue since https://github.com/eclipse/che-devfile-registry/pull/51 was merged.

@svor I've tested again. It works on minishift, but is still failing on minikube for me. How do you run Che here?

@sparkoo I tested it on minishift

@sparkoo I'm going to check it on minikube

It works on Minikube on my side as well: https://youtu.be/vGqQDdcEd5U
Minikube version: v1.2.0
eclipse/che-server:nightly
eclipse/che-theia:7.0.0-next

Was this page helpful?
0 / 5 - 0 ratings