You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fineract.apache.org by "Adam Saghy (Jira)" <ji...@apache.org> on 2020/01/31 16:13:00 UTC

[jira] [Comment Edited] (FINERACT-730) Fix failing gradle task bootRun & can't run simple Spring Boot java -jar (without Tomcat)

    [ https://issues.apache.org/jira/browse/FINERACT-730?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17027616#comment-17027616 ] 

Adam Saghy edited comment on FINERACT-730 at 1/31/20 4:12 PM:
--------------------------------------------------------------

{quote}[~vorburger] : 
 Uh, yeah - that's what this bug is about... thanks for confirming the problem! :P
{quote}
You welcome! :)  

The main issue here the below from the gradle:
{code:java}
// if (!(project.hasProperty('env') && project.getProperty('env') == 'dev')) {
sourceSets {
    main {
        java {
            exclude '**/Server*'
            exclude '**/MariaDB4j*'
            exclude '**/EmbeddedTomcatWithSSLConfiguration.java'
        }
    }
{code}
This one is excluding the ServerApplication and ServerMariaDB4JApplication from the generated sources if we are not using the dev profile, so the error message is true, there was no main class which can be run.

 

After to fix that the next error:
{code:java}
// Caused by: org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
{code}
This one is trickier. I had to exclude the 

 
{code:java}
exclude = org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration.class{code}
 

I am assuming the added extra tomcat and the spring boot one were conflicting somehow...

After I have got a bunch of NoClassDef error for different kind of tomcat classes, so I changed direction, excluded the tomcat from gradle.

 

The bootRun started to work, but now i started to get:
{code:java}
trustAnchors parameter must be non-empty{code}
 

As the jks were on the right place, i am assuming it has something to do, i am not using anymore the tomcat 7.X (which was used before), rather the tomcat 8.5.x which is coming with the Spring Boot.

---------------------------------------------------------------------------------------------------------------------------------------------
 On a fork of the 1.4.0, 
 I am a little bit closer. We have a version which is able to run with Spring Boot (we had to remove the uniquely configured tomcat and just let the Spring Boot include its own embedded one), but now i am unable to connect to the MariaDB4J... seems it is initializing as it should:
{code:java}
16:58:29.410 [main] INFO  ch.vorburger.exec.ManagedProcess - Starting Program [repos/fineract/fineract-provider/build/db/bin/bin/mysqld, --no-defaults, --console, --skip-grant-tables, --max_allowed_packet=64M, --basedir=repos/fineract/fineract-provider/build/db/bin, --datadir=repos/fineract/fineract-provider/build/db/data, --port=52086, --socket=/private/var/folders/b9/yc_ybbc53cz0tyxq1byshktm0000gn/T/MariaDB4j.52086.sock] (in working directory repos/fineract/fineract-provider/build/db/bin)
16:58:29.410 [main] INFO  ch.vorburger.exec.ManagedProcess - Thread will wait for "mysqld: ready for connections." to appear in Console output of process Program [repos/fineract/fineract-provider/build/db/bin/bin/mysqld, --no-defaults, --console, --skip-grant-tables, --max_allowed_packet=64M, --basedir=repos/fineract/fineract-provider/build/db/bin, --datadir=repos/fineract/fineract-provider/build/db/data, --port=52086, --socket=/private/var/folders/b9/yc_ybbc53cz0tyxq1byshktm0000gn/T/MariaDB4j.52086.sock] (in working directory repos/fineract/fineract-provider/build/db/bin) for max. 30000ms
16:58:29.416 [Exec Stream Pumper] INFO  ch.vorburger.exec.ManagedProcess - mysqld: dyld: warning, unknown environment variable: DYLD_FALLBACK_LIBRARY_PATH 
16:58:29.540 [Exec Stream Pumper] INFO  ch.vorburger.exec.ManagedProcess - mysqld: 2020-01-31 16:58:29 4480974272 [Note] /repos/fineract/fineract-provider/build/db/bin/bin/mysqld (mysqld 10.2.11-MariaDB) starting as process 7738 ...
{code}
But i am unable to connect:
{code:java}
16:58:29.893 [main] INFO  o.a.f.i.c.b.d.DataSourceConfiguration - Created new DataSource; url=jdbc:mysql://localhost:3306/mifosplatform-tenants

16:58:29.992 [main] DEBUG o.a.f.i.c.s.TenantDatabaseUpgradeService - Initiated liquibase tenants_db, mysql
16:58:29.992 [main] DEBUG o.a.f.i.c.s.TenantDatabaseUpgradeService - Initiated tenants_db, mysql
16:58:29.995 [main] DEBUG o.a.f.i.c.s.TenantDatabaseUpgradeService - Start on list database org.apache.tomcat.jdbc.pool.DataSource@5d957cf0{ConnectionPool[defaultAutoCommit=null; defaultReadOnly=null; defaultTransactionIsolation=-1; defaultCatalog=null; driverClassName=com.mysql.jdbc.Driver; maxActive=100; maxIdle=100; minIdle=10; initialSize=3; maxWait=30000; testOnBorrow=true; testOnReturn=true; timeBetweenEvictionRunsMillis=60000; numTestsPerEvictionRun=0; minEvictableIdleTimeMillis=60000; testWhileIdle=true; testOnConnect=false; password=********; url=jdbc:mysql://localhost:3306/mifosplatform-tenants; username=root; validationQuery=SELECT 1; validationQueryTimeout=-1; validatorClassName=null; validationInterval=3000; accessToUnderlyingConnectionAllowed=true; removeAbandoned=false; removeAbandonedTimeout=60; logAbandoned=true; connectionProperties=null; initSQL=null; jdbcInterceptors=org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer;org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport; jmxEnabled=true; fairQueue=true; useEquals=true; abandonWhenPercentageFull=0; maxAge=0; useLock=false; dataSource=null; dataSourceJNDI=null; suspectTimeout=60; alternateUsernameAllowed=false; commitOnReturn=false; rollbackOnReturn=false; useDisposableConnectionFacade=true; logValidationErrors=false; propagateInterruptState=false; ignoreExceptionOnPreLoad=false; useStatementFacade=true; }Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.Jan 31, 2020 4:58:30 PM org.apache.tomcat.jdbc.pool.ConnectionPool initSEVERE: Unable to create initial connections of pool.com.mysql.cj.jdbc.exceptions.CommunicationsException: 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. at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174)

{code}
[~vorburger]: Have you faced such an issue?  I am using with default settings (localhost, 3306 port, etc.). I am kindly asking you to take a look on it and if you have any advice, i would be more than welcome!

 


was (Author: adamsaghy):
{quote}[~vorburger] : 
Uh, yeah - that's what this bug is about... thanks for confirming the problem! :P
{quote}
You welcome! :)  

The main issue here the below from the gradle:
{code:java}
// if (!(project.hasProperty('env') && project.getProperty('env') == 'dev')) {
sourceSets {
    main {
        java {
            exclude '**/Server*'
            exclude '**/MariaDB4j*'
            exclude '**/EmbeddedTomcatWithSSLConfiguration.java'
        }
    }
{code}
This one is excluding the ServerApplication and ServerMariaDB4JApplication from the generated sources if we are not using the dev profile, so the error message is true, there was no main class which can be run.

 

After to fix that the next error:
{code:java}
// Caused by: org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
{code}
This one is trickier. I had to exclude the 

 
{code:java}
exclude = org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration.class{code}
 

I am assuming the added extra tomcat and the spring boot one were conflicting somehow...

After I have got a bunch of NoClassDef error for different kind of tomcat classes, so I changed direction, excluded the tomcat from gradle.

 

The bootRun started to work, but now i started to get:


{code:java}
trustAnchors parameter must be non-empty{code}
 

As the jks were on the right place, i am assuming it has something to do, i am not using anymore the tomcat 7.X (which was used before), rather the tomcat 8.5.x which is coming with the Spring Boot.

---------------------------------------------------------------------------------------------------------------------------------------------
On a fork of the 1.4.0, 
I am a little bit closer. We have a version which is able to run with Spring Boot (we had to remove the uniquely configured tomcat and just let the Spring Boot include its own embedded one), but now i am unable to connect to the MariaDB4J... seems it is initializing as it should:


{code:java}
16:58:29.410 [main] INFO  ch.vorburger.exec.ManagedProcess - Starting Program [repos/fineract/fineract-provider/build/db/bin/bin/mysqld, --no-defaults, --console, --skip-grant-tables, --max_allowed_packet=64M, --basedir=repos/fineract/fineract-provider/build/db/bin, --datadir=repos/fineract/fineract-provider/build/db/data, --port=52086, --socket=/private/var/folders/b9/yc_ybbc53cz0tyxq1byshktm0000gn/T/MariaDB4j.52086.sock] (in working directory repos/fineract/fineract-provider/build/db/bin)
16:58:29.410 [main] INFO  ch.vorburger.exec.ManagedProcess - Thread will wait for "mysqld: ready for connections." to appear in Console output of process Program [repos/fineract/fineract-provider/build/db/bin/bin/mysqld, --no-defaults, --console, --skip-grant-tables, --max_allowed_packet=64M, --basedir=repos/fineract/fineract-provider/build/db/bin, --datadir=repos/fineract/fineract-provider/build/db/data, --port=52086, --socket=/private/var/folders/b9/yc_ybbc53cz0tyxq1byshktm0000gn/T/MariaDB4j.52086.sock] (in working directory repos/fineract/fineract-provider/build/db/bin) for max. 30000ms
16:58:29.416 [Exec Stream Pumper] INFO  ch.vorburger.exec.ManagedProcess - mysqld: dyld: warning, unknown environment variable: DYLD_FALLBACK_LIBRARY_PATH 
16:58:29.540 [Exec Stream Pumper] INFO  ch.vorburger.exec.ManagedProcess - mysqld: 2020-01-31 16:58:29 4480974272 [Note] /repos/fineract/fineract-provider/build/db/bin/bin/mysqld (mysqld 10.2.11-MariaDB) starting as process 7738 ...
{code}
But i am unable to connect:
{code:java}
16:58:29.893 [main] INFO  o.a.f.i.c.b.d.DataSourceConfiguration - Created new DataSource; url=jdbc:mysql://localhost:3306/mifosplatform-tenants

16:58:29.992 [main] DEBUG o.a.f.i.c.s.TenantDatabaseUpgradeService - Initiated liquibase tenants_db, mysql
16:58:29.992 [main] DEBUG o.a.f.i.c.s.TenantDatabaseUpgradeService - Initiated tenants_db, mysql
16:58:29.995 [main] DEBUG o.a.f.i.c.s.TenantDatabaseUpgradeService - Start on list database org.apache.tomcat.jdbc.pool.DataSource@5d957cf0{ConnectionPool[defaultAutoCommit=null; defaultReadOnly=null; defaultTransactionIsolation=-1; defaultCatalog=null; driverClassName=com.mysql.jdbc.Driver; maxActive=100; maxIdle=100; minIdle=10; initialSize=3; maxWait=30000; testOnBorrow=true; testOnReturn=true; timeBetweenEvictionRunsMillis=60000; numTestsPerEvictionRun=0; minEvictableIdleTimeMillis=60000; testWhileIdle=true; testOnConnect=false; password=********; url=jdbc:mysql://localhost:3306/mifosplatform-tenants; username=root; validationQuery=SELECT 1; validationQueryTimeout=-1; validatorClassName=null; validationInterval=3000; accessToUnderlyingConnectionAllowed=true; removeAbandoned=false; removeAbandonedTimeout=60; logAbandoned=true; connectionProperties=null; initSQL=null; jdbcInterceptors=org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer;org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport; jmxEnabled=true; fairQueue=true; useEquals=true; abandonWhenPercentageFull=0; maxAge=0; useLock=false; dataSource=null; dataSourceJNDI=null; suspectTimeout=60; alternateUsernameAllowed=false; commitOnReturn=false; rollbackOnReturn=false; useDisposableConnectionFacade=true; logValidationErrors=false; propagateInterruptState=false; ignoreExceptionOnPreLoad=false; useStatementFacade=true; }Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.Jan 31, 2020 4:58:30 PM org.apache.tomcat.jdbc.pool.ConnectionPool initSEVERE: Unable to create initial connections of pool.com.mysql.cj.jdbc.exceptions.CommunicationsException: 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. at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174)

{code}
[~vorburger]: Have you faced such an issue?  I am using with default settings (localhost, 3306 port, etc.). Is it okay?

 

> Fix failing gradle task bootRun & can't run simple Spring Boot java -jar (without Tomcat)
> -----------------------------------------------------------------------------------------
>
>                 Key: FINERACT-730
>                 URL: https://issues.apache.org/jira/browse/FINERACT-730
>             Project: Apache Fineract
>          Issue Type: Bug
>          Components: Build, System
>    Affects Versions: 1.3.0
>            Reporter: Courage Angeh
>            Priority: Critical
>              Labels: build
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Running all gradle task: rat, build, bootRun; produces the following error
> *...*
> {{_:bootRun_}}
> {{_Error: Could not find or load main class org.apache.fineract.ServerWithMariaDB4jApplication_}}
> {{_:bootRun FAILED_}}{{_FAILURE: Build failed with an exception._}}{{_* What went wrong:_}}
> {{_Execution failed for task ':bootRun'._}}
> {{_> Process 'command '/usr/lib/jvm/java-8-oracle/bin/java'' finished with non-zero exit value 1_}}{{_* Try:_}}
> {{_Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output._}}{{_BUILD FAILED_}}
>  
> More information can be found on the following threads:
> [https://lists.apache.org/thread.html/1f01897413545729420c66355d3211d625ebbd245a98407220783bfc@%3Cdev.fineract.apache.org%3E]
> https://lists.apache.org/thread.html/f4cb9364504a13f71ea7654082274c7ff80c48b19ff76e8cadf3cc7f@%3Cdev.fineract.apache.org%3E



--
This message was sent by Atlassian Jira
(v8.3.4#803005)