Search code examples
javamavenjdbcjasper-reportsmysql-connector

Application context load breaks down when adding a single dependency to POM


EDIT: Originally the question was on "compilation breakes down", but it's more accurate to say "on application contex load"

I'm working on an billing system. As part of the next iteration, I need to create an invoice document.

We're making this with Jasper Reports. The "design" of the document was made and approved with Jasperstudio (we will load the .jasper compiled file).

The problem comes when I add the jasperreports dependency (no new classes nor new code anywhere).

When I run my cucumber test for the creation of the invoice I got this during the autowiring of one of my Spring repositories:

Internal Exception: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost/my_database

I do depend directly from mysql-connector-java (6.0.6) and I had no problems before this.

I assume it's a dependency problem, but I can't find it.

This is my dependency tree

[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building Billing-Server 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ billing-server ---
[INFO] com.company:billing-server:war:0.0.1-SNAPSHOT
[INFO] +- org.springframework:spring-webmvc:jar:4.3.8.RELEASE:compile
[INFO] |  +- (org.springframework:spring-aop:jar:4.3.8.RELEASE:compile - omitted for duplicate)
[INFO] |  +- org.springframework:spring-beans:jar:4.3.8.RELEASE:compile
[INFO] |  |  \- (org.springframework:spring-core:jar:4.3.8.RELEASE:compile - omitted for duplicate)
[INFO] |  +- (org.springframework:spring-context:jar:4.3.8.RELEASE:compile - omitted for duplicate)
[INFO] |  +- (org.springframework:spring-core:jar:4.3.8.RELEASE:compile - omitted for duplicate)
[INFO] |  +- org.springframework:spring-expression:jar:4.3.8.RELEASE:compile
[INFO] |  |  \- (org.springframework:spring-core:jar:4.3.8.RELEASE:compile - omitted for duplicate)
[INFO] |  \- org.springframework:spring-web:jar:4.3.8.RELEASE:compile
[INFO] |     +- (org.springframework:spring-aop:jar:4.3.8.RELEASE:compile - omitted for duplicate)
[INFO] |     +- (org.springframework:spring-beans:jar:4.3.8.RELEASE:compile - omitted for duplicate)
[INFO] |     +- (org.springframework:spring-context:jar:4.3.8.RELEASE:compile - omitted for duplicate)
[INFO] |     \- (org.springframework:spring-core:jar:4.3.8.RELEASE:compile - omitted for duplicate)
[INFO] +- org.springframework.data:spring-data-jpa:jar:1.9.1.RELEASE:compile
[INFO] |  +- org.springframework.data:spring-data-commons:jar:1.11.1.RELEASE:compile
[INFO] |  |  +- (org.springframework:spring-core:jar:4.1.8.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  |  +- (org.springframework:spring-beans:jar:4.1.8.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  |  +- (org.slf4j:slf4j-api:jar:1.7.13:compile - omitted for duplicate)
[INFO] |  |  \- (org.slf4j:jcl-over-slf4j:jar:1.7.13:runtime - omitted for duplicate)
[INFO] |  +- org.springframework:spring-orm:jar:4.1.8.RELEASE:compile
[INFO] |  |  +- (org.springframework:spring-beans:jar:4.1.8.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  |  +- (org.springframework:spring-core:jar:4.1.8.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  |  +- org.springframework:spring-jdbc:jar:4.1.8.RELEASE:compile
[INFO] |  |  |  +- (org.springframework:spring-beans:jar:4.1.8.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  |  |  +- (org.springframework:spring-core:jar:4.1.8.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  |  |  \- (org.springframework:spring-tx:jar:4.1.8.RELEASE:compile - omitted for duplicate)
[INFO] |  |  \- (org.springframework:spring-tx:jar:4.1.8.RELEASE:compile - omitted for duplicate)
[INFO] |  +- (org.springframework:spring-context:jar:4.1.8.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  +- (org.springframework:spring-aop:jar:4.1.8.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  +- org.springframework:spring-tx:jar:4.1.8.RELEASE:compile
[INFO] |  |  +- (org.springframework:spring-beans:jar:4.1.8.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  |  \- (org.springframework:spring-core:jar:4.1.8.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  +- (org.springframework:spring-beans:jar:4.1.8.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  +- (org.springframework:spring-core:jar:4.1.8.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  +- (org.aspectj:aspectjrt:jar:1.8.7:compile - omitted for conflict with 1.8.13)
[INFO] |  +- org.slf4j:slf4j-api:jar:1.7.13:compile
[INFO] |  \- org.slf4j:jcl-over-slf4j:jar:1.7.13:runtime
[INFO] |     \- (org.slf4j:slf4j-api:jar:1.7.13:runtime - omitted for duplicate)
[INFO] +- org.springframework.security:spring-security-core:jar:4.0.1.RELEASE:compile
[INFO] |  +- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  +- (org.springframework:spring-aop:jar:4.1.6.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  +- (org.springframework:spring-beans:jar:4.1.6.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  +- (org.springframework:spring-context:jar:4.1.6.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  +- (org.springframework:spring-core:jar:4.1.6.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  \- (org.springframework:spring-expression:jar:4.1.6.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] +- org.springframework.security:spring-security-config:jar:4.0.1.RELEASE:compile
[INFO] |  +- (aopalliance:aopalliance:jar:1.0:compile - omitted for duplicate)
[INFO] |  +- (org.springframework.security:spring-security-core:jar:4.0.1.RELEASE:compile - omitted for duplicate)
[INFO] |  +- (org.springframework:spring-aop:jar:4.1.6.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  +- (org.springframework:spring-beans:jar:4.1.6.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  +- (org.springframework:spring-context:jar:4.1.6.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  \- (org.springframework:spring-core:jar:4.1.6.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] +- org.springframework.security:spring-security-web:jar:4.0.1.RELEASE:compile
[INFO] |  +- (aopalliance:aopalliance:jar:1.0:compile - omitted for duplicate)
[INFO] |  +- (org.springframework.security:spring-security-core:jar:4.0.1.RELEASE:compile - omitted for duplicate)
[INFO] |  +- (org.springframework:spring-beans:jar:4.1.6.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  +- (org.springframework:spring-context:jar:4.1.6.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  +- (org.springframework:spring-core:jar:4.1.6.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  +- (org.springframework:spring-expression:jar:4.1.6.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  \- (org.springframework:spring-web:jar:4.1.6.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] +- org.eclipse.persistence:eclipselink:jar:2.6.4:compile
[INFO] |  +- org.eclipse.persistence:javax.persistence:jar:2.1.1:compile
[INFO] |  +- org.eclipse.persistence:commonj.sdo:jar:2.1.1:compile
[INFO] |  +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] |  \- org.glassfish:javax.json:jar:1.0.4:compile
[INFO] +- commons-validator:commons-validator:jar:1.6:compile
[INFO] |  +- commons-beanutils:commons-beanutils:jar:1.9.2:compile
[INFO] |  |  +- (commons-logging:commons-logging:jar:1.1.1:compile - omitted for conflict with 1.2)
[INFO] |  |  \- (commons-collections:commons-collections:jar:3.2.1:compile - omitted for conflict with 3.2.2)
[INFO] |  +- commons-digester:commons-digester:jar:1.8.1:compile
[INFO] |  +- commons-logging:commons-logging:jar:1.2:compile
[INFO] |  \- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] +- com.sun.mail:javax.mail:jar:1.6.1:compile
[INFO] |  \- javax.activation:activation:jar:1.1:compile
[INFO] +- org.springframework.batch:spring-batch-core:jar:3.0.7.RELEASE:compile
[INFO] |  +- com.ibm.jbatch:com.ibm.jbatch-tck-spi:jar:1.0:compile
[INFO] |  |  \- javax.batch:javax.batch-api:jar:1.0:compile
[INFO] |  +- com.thoughtworks.xstream:xstream:jar:1.4.7:compile
[INFO] |  |  +- xmlpull:xmlpull:jar:1.1.3.1:compile
[INFO] |  |  \- xpp3:xpp3_min:jar:1.1.4c:compile
[INFO] |  +- org.codehaus.jettison:jettison:jar:1.2:compile
[INFO] |  +- org.springframework.batch:spring-batch-infrastructure:jar:3.0.7.RELEASE:compile
[INFO] |  |  \- org.springframework.retry:spring-retry:jar:1.1.0.RELEASE:compile
[INFO] |  |     \- (org.springframework:spring-context:jar:4.0.3.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  +- (org.springframework:spring-aop:jar:4.0.5.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  +- (org.springframework:spring-beans:jar:4.0.5.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  +- (org.springframework:spring-context:jar:4.0.5.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  +- (org.springframework:spring-core:jar:4.0.5.RELEASE:compile - omitted for conflict with 4.3.8.RELEASE)
[INFO] |  \- (org.springframework:spring-tx:jar:4.0.5.RELEASE:compile - omitted for conflict with 4.1.8.RELEASE)
[INFO] +- net.sf.jasperreports:jasperreports:jar:6.5.1:compile
[INFO] |  +- (commons-beanutils:commons-beanutils:jar:1.9.3:compile - omitted for conflict with 1.9.2)
[INFO] |  +- (commons-collections:commons-collections:jar:3.2.2:compile - omitted for duplicate)
[INFO] |  +- (commons-digester:commons-digester:jar:2.1:compile - omitted for conflict with 1.8.1)
[INFO] |  +- (commons-logging:commons-logging:jar:1.1.1:compile - omitted for conflict with 1.2)
[INFO] |  +- com.lowagie:itext:jar:2.1.7.js6:compile
[INFO] |  |  \- org.bouncycastle:bcprov-jdk15on:jar:1.52:compile
[INFO] |  +- org.jfree:jcommon:jar:1.0.23:compile
[INFO] |  +- org.jfree:jfreechart:jar:1.0.19:compile
[INFO] |  |  \- (org.jfree:jcommon:jar:1.0.23:compile - omitted for duplicate)
[INFO] |  +- org.eclipse.jdt.core.compiler:ecj:jar:4.4.2:compile
[INFO] |  +- org.codehaus.castor:castor-xml:jar:1.3.3:compile
[INFO] |  |  +- org.codehaus.castor:castor-core:jar:1.3.3:compile
[INFO] |  |  |  +- (commons-logging:commons-logging:jar:1.1.1:compile - omitted for conflict with 1.2)
[INFO] |  |  |  \- (commons-lang:commons-lang:jar:2.6:compile - omitted for duplicate)
[INFO] |  |  +- (commons-logging:commons-logging:jar:1.1.1:compile - omitted for conflict with 1.2)
[INFO] |  |  +- commons-lang:commons-lang:jar:2.6:compile
[INFO] |  |  +- (commons-collections:commons-collections:jar:3.2.1:compile - omitted for conflict with 3.2.2)
[INFO] |  |  +- javax.inject:javax.inject:jar:1:compile
[INFO] |  |  +- stax:stax:jar:1.2.0:compile
[INFO] |  |  |  \- stax:stax-api:jar:1.0.1:compile
[INFO] |  |  \- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-core:jar:2.1.4:compile
[INFO] |  +- (com.fasterxml.jackson.core:jackson-databind:jar:2.1.4:compile - omitted for conflict with 2.9.3)
[INFO] |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.1.4:compile
[INFO] |  +- org.apache.lucene:lucene-core:jar:4.5.1:compile
[INFO] |  +- org.apache.lucene:lucene-analyzers-common:jar:4.5.1:compile
[INFO] |  |  \- (org.apache.lucene:lucene-core:jar:4.5.1:compile - omitted for duplicate)
[INFO] |  +- org.apache.lucene:lucene-queryparser:jar:4.5.1:compile
[INFO] |  |  +- (org.apache.lucene:lucene-core:jar:4.5.1:compile - omitted for duplicate)
[INFO] |  |  +- org.apache.lucene:lucene-queries:jar:4.5.1:compile
[INFO] |  |  |  \- (org.apache.lucene:lucene-core:jar:4.5.1:compile - omitted for duplicate)
[INFO] |  |  \- org.apache.lucene:lucene-sandbox:jar:4.5.1:compile
[INFO] |  |     +- (org.apache.lucene:lucene-core:jar:4.5.1:compile - omitted for duplicate)
[INFO] |  |     \- jakarta-regexp:jakarta-regexp:jar:1.4:compile
[INFO] |  +- org.olap4j:olap4j:jar:0.9.7.309-JS-3:compile
[INFO] |  +- com.google.zxing:core:jar:3.2.1:compile
[INFO] |  \- com.ibm.icu:icu4j:jar:57.1:compile
[INFO] +- org.springframework:spring-aop:jar:4.3.8.RELEASE:compile
[INFO] |  +- (org.springframework:spring-beans:jar:4.3.8.RELEASE:compile - omitted for duplicate)
[INFO] |  \- (org.springframework:spring-core:jar:4.3.8.RELEASE:compile - omitted for duplicate)
[INFO] +- org.aspectj:aspectjrt:jar:1.8.13:compile
[INFO] +- org.aspectj:aspectjweaver:jar:1.8.13:compile
[INFO] +- javax.servlet:javax.servlet-api:jar:4.0.0-b06:provided
[INFO] +- mysql:mysql-connector-java:jar:6.0.6:compile
[INFO] +- ch.qos.logback:logback-classic:jar:1.2.3:test
[INFO] |  +- ch.qos.logback:logback-core:jar:1.2.3:test
[INFO] |  \- (org.slf4j:slf4j-api:jar:1.7.25:test - omitted for conflict with 1.7.13)
[INFO] +- org.springframework:spring-core:jar:4.3.8.RELEASE:compile
[INFO] |  \- (commons-logging:commons-logging:jar:1.2:compile - omitted for duplicate)
[INFO] +- org.springframework:spring-context:jar:4.3.8.RELEASE:compile
[INFO] |  +- (org.springframework:spring-aop:jar:4.3.8.RELEASE:compile - omitted for duplicate)
[INFO] |  +- (org.springframework:spring-beans:jar:4.3.8.RELEASE:compile - omitted for duplicate)
[INFO] |  +- (org.springframework:spring-core:jar:4.3.8.RELEASE:compile - omitted for duplicate)
[INFO] |  \- (org.springframework:spring-expression:jar:4.3.8.RELEASE:compile - omitted for duplicate)
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.3:compile
[INFO] |  +- (com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile - omitted for conflict with 2.1.4)
[INFO] |  \- (com.fasterxml.jackson.core:jackson-core:jar:2.9.3:compile - omitted for conflict with 2.1.4)
[INFO] +- org.exparity:hamcrest-date:jar:2.0.4:test
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.springframework:spring-test:jar:4.3.8.RELEASE:test
[INFO] |  \- (org.springframework:spring-core:jar:4.3.8.RELEASE:test - omitted for duplicate)
[INFO] +- junit:junit:jar:4.12:test
[INFO] |  \- (org.hamcrest:hamcrest-core:jar:1.3:test - omitted for duplicate)
[INFO] +- io.cucumber:cucumber-java:jar:2.1.0:test
[INFO] |  \- io.cucumber:cucumber-core:jar:2.1.0:test
[INFO] |     +- info.cukes:cucumber-html:jar:0.2.6:test
[INFO] |     +- io.cucumber:cucumber-jvm-deps:jar:1.0.6:test
[INFO] |     +- io.cucumber:gherkin:jar:5.0.0:test
[INFO] |     \- io.cucumber:tag-expressions:jar:1.0.1:test
[INFO] +- io.cucumber:cucumber-junit:jar:2.1.0:test
[INFO] |  +- (io.cucumber:cucumber-core:jar:2.1.0:test - omitted for duplicate)
[INFO] |  \- (junit:junit:jar:4.12:test - omitted for duplicate)
[INFO] +- info.cukes:cucumber-spring:jar:1.2.5:test
[INFO] |  \- info.cukes:cucumber-java:jar:1.2.5:test
[INFO] |     \- info.cukes:cucumber-core:jar:1.2.5:test
[INFO] |        +- (info.cukes:cucumber-html:jar:0.2.3:test - omitted for conflict with 0.2.6)
[INFO] |        +- info.cukes:cucumber-jvm-deps:jar:1.0.5:test
[INFO] |        \- info.cukes:gherkin:jar:2.12.2:test
[INFO] \- org.mockito:mockito-core:jar:2.13.0:test
[INFO]    +- net.bytebuddy:byte-buddy:jar:1.7.9:test
[INFO]    +- net.bytebuddy:byte-buddy-agent:jar:1.7.9:test
[INFO]    \- org.objenesis:objenesis:jar:2.6:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.933 s
[INFO] Finished at: 2018-03-01T21:57:35-06:00
[INFO] Final Memory: 18M/244M
[INFO] ------------------------------------------------------------------------

any hint would be appreciated.


Solution

  • The problem is solved by moving the dependency down below in the POM.

    My guess is that jasperreports does some kind of initialization and needs all dependencies to be already there. But I can't figure out why it might be doing this.

    Can anyone explain?