gravitee-io / issues

Gravitee.io - API Platform - Issues
64 stars 26 forks source link

gravitee-repository-jdbc #1182

Closed BlackTurtle123 closed 6 years ago

BlackTurtle123 commented 6 years ago

I tryed to download and built https://github.com/gravitee-io/gravitee-repository-jdbc. I am doing a paper about different api management tools and we would need to connect it to a mariadbd/mysql. Without this plugin this can't be done I understand correctly?

Expected Behavior

Being able to built or download a built plugin

Current Behavior

Can't built plugin

Possible Solution

Missing stuff on the public repo

Steps to Reproduce (for bugs)

  1. Download git
  2. mvn compile

Context

Connecting MariaDB with gravitee.

Your Environment

Latest plugin download from this git repo.

NicolasGeraud commented 6 years ago

hi @BlackTurtle123 please share the mvn output

BlackTurtle123 commented 6 years ago

[INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Gravitee.io APIM - Repository - JDBC 1.14.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [WARNING] The POM for io.gravitee.repository:gravitee-repository-test:jar:tests:1.14.1-SNAPSHOT is missing, no dependency information available [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.480 s [INFO] Finished at: 2018-03-30T14:56:01+02:00 [INFO] Final Memory: 11M/303M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal on project gravitee-repository-jdbc: Could not resolve dependencies for project io.gravitee.repository:gravitee-repository-jdbc:jar:1.14.0-SNAPSHOT: Failure to find io.gravitee.repository:gravitee-repository-test:jar:tests:1.14.1-SNAPSHOT in https://nexus.dsquare.be/repository/public was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

brasseld commented 6 years ago

Hi @BlackTurtle123

Next version of Gravitee.io will come with native JDBC support (well tested with MariaDB).

I would advise you to wait for 1.15.0 which is scheduled for next week (wednesday).

Regards,

NicolasGeraud commented 6 years ago

@BlackTurtle123 because it's a snapshot, you have to enable oss repository

you can put this in your maven settings :

<profiles>
  <profile>
     <id>allow-snapshots</id>
        <activation><activeByDefault>true</activeByDefault></activation>
     <repositories>
       <repository>
         <id>snapshots-repo</id>
         <url>https://oss.sonatype.org/content/repositories/snapshots</url>
         <releases><enabled>false</enabled></releases>
         <snapshots><enabled>true</enabled></snapshots>
       </repository>
     </repositories>
   </profile>
</profiles>
BlackTurtle123 commented 6 years ago

Thanks both! To add it in short, I can just wait till wednesday for it to be built into Gravitee? Thanks for the info both :D

brasseld commented 6 years ago

Hi @BlackTurtle123 ,

JDBC repository is now available as part of our release. https://download.gravitee.io/graviteeio-apim/plugins/repositories/gravitee-repository-jdbc/

BlackTurtle123 commented 6 years ago

Are the different options also documented somewhere? On the git repo it says: ... And mine is giving me an error that my jdbcurl or datasource isn't filled in. 10:15:40.556 [gravitee] [] ERROR com.zaxxer.hikari.HikariConfig - gravitee-jdbc-pool-1 - dataSource or dataSourceClassName or jdbcUrl is required. 10:15:40.558 [gravitee] [] WARN o.s.c.a.AnnotationConfigApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdbcManagementRepositoryConfiguration': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: dataSource or dataSourceClassName or jdbcUrl is required. 10:15:40.560 [gravitee] [] ERROR i.g.p.c.i.PluginContextFactoryImpl - Unable to refresh plugin context org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdbcManagementRepositoryConfiguration': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: dataSource or dataSourceClassName or jdbcUrl is required.

brasseld commented 6 years ago

Hi @BlackTurtle123

Please have a look to : https://docs.gravitee.io/apim_installguide_repositories_jdbc.html

BlackTurtle123 commented 6 years ago

Yeah did found that one already. Thanks. Do I need to add the correct driver manually to gravitee? If I have it correct I should add it to the lib folder? (besides the jdbc) Caused by: java.sql.SQLException: No suitable driver at java.sql.DriverManager.getDriver(Unknown Source) at com.zaxxer.hikari.util.DriverDataSource.<init>(DriverDataSource.java:103)

brasseld commented 6 years ago

As per the documentation:

put your java driver under the plugins/ext/repository-jdbc folder in both the management-api and the gateway home directory.

BlackTurtle123 commented 6 years ago

Well thanks, is this error related to an error on my side or safe to ignore?

All tables are made correctly into my mariadb, but it seems that neither parts of the application can put in data.

org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: (conn=9) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"events" ("id", "created_at", "type", "payload", "parent_id", "updated_at" ) val' at line 1 at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:231) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:649) at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:870) at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:894) at io.gravitee.repository.jdbc.management.JdbcEventRepository.create(JdbcEventRepository.java:118) at io.gravitee.repository.jdbc.management.JdbcEventRepository.create(JdbcEventRepository.java:47) at io.gravitee.gateway.services.monitoring.MonitoringService.doStart(MonitoringService.java:100) at io.gravitee.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:32) at io.gravitee.gateway.services.impl.ServiceManagerImpl.doStart(ServiceManagerImpl.java:60) at io.gravitee.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:32) at io.gravitee.common.node.AbstractNode.doStart(AbstractNode.java:53) at io.gravitee.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:32) at io.gravitee.gateway.standalone.Container.start(Container.java:108) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at io.gravitee.gateway.standalone.boostrap.Bootstrap.start(Bootstrap.java:162) at io.gravitee.gateway.standalone.boostrap.Bootstrap.main(Bootstrap.java:171)

aelamrani commented 6 years ago

Hi @BlackTurtle123

For now, the connector is tested and works with PostgreSQL and MySQL.

could you please create an other issue for MariaDB support please?

BlackTurtle123 commented 6 years ago

@aelamrani okay will do, thought this connector was also working/tested with MariaDB. If this isn't the case, I will see if I can use other datastores.

Hi @BlackTurtle123

Next version of Gravitee.io will come with native JDBC support (well tested with MariaDB).

I would advise you to wait for 1.15.0 which is scheduled for next week (wednesday).

Regards,

brasseld commented 6 years ago

Seems that it was an error of mine, sorry for that !