I'm working on a project based on spring-boot 1.2.5.
When I execute my tests with the maven install script, they are passed with sucess. But when i try to execute my tests with JUnit in eclipse, i have the following issue:
java.lang.SecurityException: class "org.hamcrest.Matchers"'s signer information does not match signer information of other classes in the same package at java.lang.ClassLoader.checkCerts(ClassLoader.java:895) at java.lang.ClassLoader.preDefineClass(ClassLoader.java:665) at java.lang.ClassLoader.defineClass(ClassLoader.java:758) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:455) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:367) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at net.aptea.sba.tests.controllers.TestClientController.listClient(TestClientController.java:24) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:73) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:73) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:224) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:83) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:68) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:163) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
I think it's a problem of dependancy inside spring boot framework:
So i added this following lines in my pom.xml:
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.9.5</version>
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</exclusion>
</exclusions>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</exclusion>
</exclusions>
<scope>test</scope>
</dependency>
mvn dependency:tree result:
[INFO] net.aptea.sba:sba-web:war:0
[INFO] +- net.aptea.sba:sba-metier-dao:jar:0:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.2.5.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-aop:jar:1.2.5.RELEASE:compile
[INFO] | | | +- org.aspectj:aspectjrt:jar:1.8.6:compile
[INFO] | | | \- org.aspectj:aspectjweaver:jar:1.8.6:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.2.5.RELEASE:compile
[INFO] | | | +- org.springframework:spring-jdbc:jar:4.1.7.RELEASE:compile
[INFO] | | | +- org.apache.tomcat:tomcat-jdbc:jar:8.0.23:compile
[INFO] | | | | \- org.apache.tomcat:tomcat-juli:jar:8.0.23:compile
[INFO] | | | \- org.springframework:spring-tx:jar:4.1.7.RELEASE:compile
[INFO] | | +- org.hibernate:hibernate-entitymanager:jar:4.3.10.Final:compile
[INFO] | | | +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
[INFO] | | | +- org.hibernate:hibernate-core:jar:4.3.10.Final:compile
[INFO] | | | | +- antlr:antlr:jar:2.7.7:compile
[INFO] | | | | \- org.jboss:jandex:jar:1.1.0.Final:compile
[INFO] | | | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | | | \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] | | | +- org.hibernate.common:hibernate-commons-annotations:jar:4.0.5.Final:compile
[INFO] | | | +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] | | | \- org.javassist:javassist:jar:3.18.1-GA:compile
[INFO] | | +- javax.transaction:javax.transaction-api:jar:1.2:compile
[INFO] | | +- org.springframework:spring-orm:jar:4.1.7.RELEASE:compile
[INFO] | | +- org.springframework.data:spring-data-jpa:jar:1.7.3.RELEASE:compile
[INFO] | | | +- org.springframework.data:spring-data-commons:jar:1.9.3.RELEASE:compile
[INFO] | | | \- org.slf4j:jcl-over-slf4j:jar:1.7.12:compile
[INFO] | | \- org.springframework:spring-aspects:jar:4.1.7.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-security:jar:1.2.5.RELEASE:compile
[INFO] | | +- org.springframework:spring-beans:jar:4.1.7.RELEASE:compile
[INFO] | | +- org.springframework:spring-context:jar:4.1.7.RELEASE:compile
[INFO] | | +- org.springframework:spring-expression:jar:4.1.7.RELEASE:compile
[INFO] | | +- org.springframework.security:spring-security-config:jar:3.2.7.RELEASE:compile
[INFO] | | | +- aopalliance:aopalliance:jar:1.0:compile
[INFO] | | | \- org.springframework.security:spring-security-core:jar:3.2.7.RELEASE:compile
[INFO] | | +- org.springframework.security:spring-security-web:jar:3.2.7.RELEASE:compile
[INFO] | | \- org.springframework:spring-aop:jar:4.1.7.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-mail:jar:1.2.5.RELEASE:compile
[INFO] | | +- org.springframework:spring-context-support:jar:4.1.7.RELEASE:compile
[INFO] | | \- com.sun.mail:javax.mail:jar:1.5.4:compile
[INFO] | | \- javax.activation:activation:jar:1.1:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.6.2:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.6.0:compile
[INFO] | | \- com.fasterxml.jackson.core:jackson-core:jar:2.6.2:compile
[INFO] | +- org.postgresql:postgresql:jar:9.4-1202-jdbc42:compile
[INFO] | +- com.dropbox.core:dropbox-core-sdk:jar:1.8.1:compile
[INFO] | +- org.apache.pdfbox:pdfbox:jar:1.8.10:compile
[INFO] | | +- org.apache.pdfbox:fontbox:jar:1.8.10:compile
[INFO] | | +- org.apache.pdfbox:jempbox:jar:1.8.10:compile
[INFO] | | \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] | +- com.lowagie:itext:jar:2.1.7:compile
[INFO] | | +- bouncycastle:bcmail-jdk14:jar:138:compile
[INFO] | | +- bouncycastle:bcprov-jdk14:jar:138:compile
[INFO] | | \- org.bouncycastle:bctsp-jdk14:jar:1.38:compile
[INFO] | | +- org.bouncycastle:bcprov-jdk14:jar:1.38:compile
[INFO] | | \- org.bouncycastle:bcmail-jdk14:jar:1.38:compile
[INFO] | +- org.jfree:jfreechart:jar:1.0.19:compile
[INFO] | | \- org.jfree:jcommon:jar:1.0.23:compile
[INFO] | +- com.googlecode.juniversalchardet:juniversalchardet:jar:1.0.3:compile
[INFO] | +- com.microsoft.ews-java-api:ews-java-api:jar:2.0:compile
[INFO] | | +- org.apache.httpcomponents:httpclient:jar:4.4.1:compile
[INFO] | | +- org.apache.httpcomponents:httpcore:jar:4.4.1:compile
[INFO] | | +- org.apache.commons:commons-lang3:jar:3.4:compile
[INFO] | | \- joda-time:joda-time:jar:2.8:compile
[INFO] | \- commons-codec:commons-codec:jar:1.9:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.2.5.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:1.2.5.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot:jar:1.2.5.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.2.5.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:1.2.5.RELEASE:compile
[INFO] | | | +- org.slf4j:jul-to-slf4j:jar:1.7.12:compile
[INFO] | | | +- org.slf4j:log4j-over-slf4j:jar:1.7.12:compile
[INFO] | | | \- ch.qos.logback:logback-classic:jar:1.1.3:compile
[INFO] | | | \- ch.qos.logback:logback-core:jar:1.1.3:compile
[INFO] | | \- org.yaml:snakeyaml:jar:1.14:compile
[INFO] | +- org.hibernate:hibernate-validator:jar:5.1.3.Final:compile
[INFO] | | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile
[INFO] | | \- com.fasterxml:classmate:jar:1.0.0:compile
[INFO] | +- org.springframework:spring-core:jar:4.1.7.RELEASE:compile
[INFO] | +- org.springframework:spring-web:jar:4.1.7.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:4.1.7.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-jersey:jar:1.2.5.RELEASE:compile
[INFO] | +- org.glassfish.jersey.core:jersey-server:jar:2.14:compile
[INFO] | | +- org.glassfish.jersey.core:jersey-common:jar:2.14:compile
[INFO] | | | +- org.glassfish.jersey.bundles.repackaged:jersey-guava:jar:2.14:compile
[INFO] | | | \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile
[INFO] | | +- org.glassfish.jersey.core:jersey-client:jar:2.14:compile
[INFO] | | +- javax.ws.rs:javax.ws.rs-api:jar:2.0.1:compile
[INFO] | | +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO] | | +- org.glassfish.hk2:hk2-api:jar:2.4.0-b06:compile
[INFO] | | | +- org.glassfish.hk2:hk2-utils:jar:2.4.0-b06:compile
[INFO] | | | \- org.glassfish.hk2.external:aopalliance-repackaged:jar:2.4.0-b06:compile
[INFO] | | +- org.glassfish.hk2.external:javax.inject:jar:2.4.0-b06:compile
[INFO] | | \- org.glassfish.hk2:hk2-locator:jar:2.4.0-b06:compile
[INFO] | +- org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.14:compile
[INFO] | +- org.glassfish.jersey.containers:jersey-container-servlet:jar:2.14:compile
[INFO] | +- org.glassfish.jersey.ext:jersey-bean-validation:jar:2.14:compile
[INFO] | +- org.glassfish.jersey.ext:jersey-spring3:jar:2.14:compile
[INFO] | | +- org.glassfish.hk2:hk2:jar:2.4.0-b06:compile
[INFO] | | | +- org.glassfish.hk2:config-types:jar:2.4.0-b06:compile
[INFO] | | | +- org.glassfish.hk2:core:jar:2.4.0-b06:compile
[INFO] | | | +- org.glassfish.hk2:hk2-config:jar:2.4.0-b06:compile
[INFO] | | | | +- org.jvnet:tiger-types:jar:1.4:compile
[INFO] | | | | \- org.glassfish.hk2.external:bean-validator:jar:2.4.0-b06:compile
[INFO] | | | +- org.glassfish.hk2:hk2-runlevel:jar:2.4.0-b06:compile
[INFO] | | | \- org.glassfish.hk2:class-model:jar:2.4.0-b06:compile
[INFO] | | | \- org.glassfish.hk2.external:asm-all-repackaged:jar:2.4.0-b06:compile
[INFO] | | \- org.glassfish.hk2:spring-bridge:jar:2.4.0-b06:compile
[INFO] | \- org.glassfish.jersey.media:jersey-media-json-jackson:jar:2.14:compile
[INFO] | +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.3.2:compile
[INFO] | \- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.3.2:compile
[INFO] | \- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.3.2:compile
[INFO] +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.2.5.RELEASE:provided
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.0.23:provided
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.0.23:provided
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-logging-juli:jar:8.0.23:provided
[INFO] | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.0.23:provided
[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:1.2.5.RELEASE:compile
[INFO] | \- org.springframework.boot:spring-boot-actuator:jar:1.2.5.RELEASE:compile
[INFO] +- org.mockito:mockito-core:jar:1.9.5:test
[INFO] | \- org.objenesis:objenesis:jar:1.0:test
[INFO] +- junit:junit:jar:4.12:test
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.2.5.RELEASE:test
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] | +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] | \- org.springframework:spring-test:jar:4.1.7.RELEASE:test
[INFO] \- com.jayway.jsonpath:json-path:jar:1.1.0:test
[INFO] +- net.minidev:json-smart:jar:2.0:test
[INFO] | \- net.minidev:asm:jar:1.0:test
[INFO] | \- asm:asm:jar:3.3.1:test
[INFO] \- org.slf4j:slf4j-api:jar:1.7.7:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.927 s
[INFO] Finished at: 2016-03-29T17:46:31+02:00
[INFO] Final Memory: 25M/275M
[INFO] -----------------------------
But i'm not able to solve this issue.
Do you have an idea of how to solve this problem ? Thank you for your advises.
Ravi N.
spring-boot-starter-test
instead of individual jars. – M. Deinummvn dependency:tree
. – M. Deinum