编辑:最初的问题是关于“编译失败”,但更准确地说“在应用程序上下文加载”
我正在研究计费系统。作为下一次迭代的一部分,我需要创建一个发票文档。
我们正在与Jasper Reports合作。使用Jasperstudio制作并批准了文档的“设计”(我们将加载.jasper编译的文件)。
当我添加jasperreports依赖项(没有新类或任何新代码)时,问题就来了。
当我运行我的黄瓜测试以创建发票时,我在我的一个Spring存储库的自动装配期间得到了这个:
Internal Exception: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost/my_database
我确实直接从mysql-connector-java(6.0.6)依赖,在此之前我没有遇到任何问题。
我认为这是一个依赖性问题,但我找不到它。
这是我的依赖树
[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] ------------------------------------------------------------------------
任何暗示将不胜感激。
通过在POM中向下移动依赖项来解决该问题。
我的猜测是jasperreports进行某种初始化并且需要所有依赖项已经存在。但我无法弄清楚为什么会这样做。
谁能解释一下?