NoSuchMethodError in appium - java

i got java.lang.NoSuchMethodError after setting up my first appium project
the code is simple, it fails at this line:
driver = new AppiumDriver(new URL("http://x.x.x.x:4723/wd/hub"), capabilities);
The trace is:
java.lang.NoSuchMethodError: com.google.common.base.Joiner$MapJoiner.appendTo(Ljava/lang/StringBuilder;Ljava/lang/Iterable;)Ljava/lang/StringBuilder;
at com.google.common.net.MediaType.toString(MediaType.java:674)
at org.openqa.selenium.remote.http.JsonHttpCommandCodec.encode(JsonHttpCommandCodec.java:197)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:152)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:572)
my pom.xml is:
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>LATEST</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
<scope>test</scope>
</dependency>
<!-- Includes the Sauce JUnit helper libraries
<dependency>
<groupId>com.saucelabs</groupId>
<artifactId>sauce_junit</artifactId>
<version>1.0.18</version>
<scope>test</scope>
</dependency>-->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
</dependency>
</dependencies>
i've google it, and some say that i use an older guava.jar, but i decomplie guava-15.0.jar and find the Joiner.appendTo(StringBuilder, Iterable) exist, why it always showing this error?
#Before
public void setUp() throws Exception {
// set up appium
final File classpathRoot = new File(System.getProperty("user.dir"));
final File appDir = new File(classpathRoot, "../../../apps/ContactManager");
final File app = new File(appDir, "ContactManager.apk");
final DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("deviceName", "Android Emulator");
capabilities.setCapability("platformVersion", "4.4");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("appPackage",
"com.example.android.contactmanager");
capabilities.setCapability("appActivity", ".ContactManager");
driver = new AndroidDriver(new URL("http://x.x.x.x:4723/wd/hub"),
capabilities);
}
also after running command "mvn -U clean test", i can see this error
Tests in error:
addContact(com.saucelabs.appium.AndroidContactsTest):com.google.common.base.Joiner$MapJoiner.appendTo(Ljava/lang/StringBuilder;Ljava/lang/Iterable;)Ljava/lang/StringBuilder;
addContact(com.saucelabs.appium.AndroidContactsTest)
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0
There's only one test case whose name is addContact, why it keep showing Test run: 2? through debugging, i found it happens when running this sentence "driver.quit()", after removeing this method, it shows Test run: 1
The dependency tree is list below, i don't see anything about MapJoiner except guava-17.0, actually i can find MapJoiner.appendTo(Stringbuilder, iterate<>) in this jar file
[INFO] com.lvntest.appium:sauce_appium_junit:jar:0.0.1-SNAPSHOT
[INFO] +- junit:junit:jar:4.11:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.seleniumhq.selenium:selenium-java:jar:2.43.1:test
[INFO] | +- org.seleniumhq.selenium:selenium-chrome-driver:jar:2.43.1:test
[INFO] | | \- org.seleniumhq.selenium:selenium-remote-driver:jar:2.43.1:test
[INFO] | | +- cglib:cglib-nodep:jar:2.1_3:test
[INFO] | | \- org.seleniumhq.selenium:selenium-api:jar:2.43.1:test
[INFO] | +- org.seleniumhq.selenium:selenium-htmlunit-driver:jar:2.43.1:test
[INFO] | | \- net.sourceforge.htmlunit:htmlunit:jar:2.15:test
[INFO] | | +- xalan:xalan:jar:2.7.1:test
[INFO] | | | \- xalan:serializer:jar:2.7.1:test
[INFO] | | +- commons-collections:commons-collections:jar:3.2.1:test
[INFO] | | +- org.apache.commons:commons-lang3:jar:3.3.2:test
[INFO] | | +- org.apache.httpcomponents:httpmime:jar:4.3.3:test
[INFO] | | +- net.sourceforge.htmlunit:htmlunit-core-js:jar:2.15:test
[INFO] | | +- xerces:xercesImpl:jar:2.11.0:test
[INFO] | | | \- xml-apis:xml-apis:jar:1.4.01:test
[INFO] | | +- net.sourceforge.nekohtml:nekohtml:jar:1.9.21:test
[INFO] | | +- net.sourceforge.cssparser:cssparser:jar:0.9.14:test
[INFO] | | | \- org.w3c.css:sac:jar:1.3:test
[INFO] | | \- org.eclipse.jetty:jetty-websocket:jar:8.1.15.v20140411:test
[INFO] | | +- org.eclipse.jetty:jetty-util:jar:8.1.15.v20140411:test
[INFO] | | +- org.eclipse.jetty:jetty-io:jar:8.1.15.v20140411:test
[INFO] | | \- org.eclipse.jetty:jetty-http:jar:8.1.15.v20140411:test
[INFO] | +- org.seleniumhq.selenium:selenium-firefox-driver:jar:2.43.1:test
[INFO] | | +- commons-io:commons-io:jar:2.4:test
[INFO] | | \- org.apache.commons:commons-exec:jar:1.1:test
[INFO] | +- org.seleniumhq.selenium:selenium-ie-driver:jar:2.43.1:test
[INFO] | | +- net.java.dev.jna:jna:jar:3.4.0:test
[INFO] | | \- net.java.dev.jna:platform:jar:3.4.0:test
[INFO] | +- org.seleniumhq.selenium:selenium-safari-driver:jar:2.43.1:test
[INFO] | +- org.seleniumhq.selenium:selenium-support:jar:2.43.1:test
[INFO] | \- org.webbitserver:webbit:jar:0.4.15:test
[INFO] | \- io.netty:netty:jar:3.5.5.Final:test
[INFO] +- io.appium:java-client:jar:2.0.0:compile
[INFO] | +- org.apache.httpcomponents:httpclient:jar:4.3.3:compile
[INFO] | | +- org.apache.httpcomponents:httpcore:jar:4.3.2:compile
[INFO] | | +- commons-logging:commons-logging:jar:1.1.3:compile
[INFO] | | \- commons-codec:commons-codec:jar:1.6:compile
[INFO] | +- com.google.guava:guava:jar:17.0:compile
[INFO] | +- cglib:cglib:jar:3.1:compile
[INFO] | | \- org.ow2.asm:asm:jar:4.2:compile
[INFO] | \- org.reflections:reflections:jar:0.9.8:compile
[INFO] | +- javassist:javassist:jar:3.12.1.GA:compile
[INFO] | \- dom4j:dom4j:jar:1.6.1:compile
[INFO] +- com.googlecode.json-simple:json-simple:jar:1.1.1:test
[INFO] +- commons-lang:commons-lang:jar:2.6:test
[INFO] +- com.saucelabs:sauce_junit:jar:2.1.10:compile
[INFO] | +- com.saucelabs:sauce_java_common:jar:2.1.10:compile
[INFO] | \- com.saucelabs:saucerest:jar:1.0.22:compile
[INFO] | \- org.json:json:jar:20090211:compile
[INFO] \- com.google.code.gson:gson:jar:2.3:compile

Which version of selenium are you using ?
Edit your pom.xml in one of the following ways..
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>LATEST</version>
</dependency>
For the above dependency use AndroidDriver() in place of AppiumDriver() or use the following with AppiumDriver()
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.42.2</version>
</dependency>
Cheers

This is selenium and appium versions mismatch. Even latest versions of both can result in such an error. You can find latest matching versions below:
'io.appium:java-client:5.0.1'
'org.seleniumhq.selenium:selenium-java:3.4.0'
Feel free to edit this answer with newest matching versions.

Related

Cucumber run test: Exception in thread "main" java.util.NoSuchElementException

Hi im trying to run a test with cucumber, but when i try to run anytest, with IntellJ, show me this error:
Exception in thread "main" java.util.NoSuchElementException
at java.base/java.util.ArrayList$Itr.next(ArrayList.java:1000)
at java.base/java.util.Collections.max(Collections.java:713)
at io.cucumber.core.feature.FeatureParser.parseResource(FeatureParser.java:46)
at java.base/java.util.function.BiFunction.lambda$andThen$0(BiFunction.java:70)
my POM:
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>messages</artifactId>
<version>21.0.1</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-spring</artifactId>
<version>${cucumber.version}</version>
<exclusions>
<exclusion>
<groupId>io.cucumber</groupId>
<artifactId>messages</artifactId>
</exclusion>
<exclusion>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-gherkin-messages</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
<exclusions>
<exclusion>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId>
</exclusion>
<exclusion>
<groupId>io.cucumber</groupId>
<artifactId>messages</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<artifactId>cucumber-java</artifactId>
<groupId>io.cucumber</groupId>
<exclusions>
<exclusion>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-gherkin</artifactId>
</exclusion>
<exclusion>
<groupId>io.cucumber</groupId>
<artifactId>messages</artifactId>
</exclusion>
</exclusions>
<version>${cucumber.version}</version>
</dependency>
If anyone can help me, i really appreciate it
Your dependencies are inconsistent. You are explicitly excluding transitive dependencies of Cucumber and explicitly including others. You shouldn't do that, Cucumber needs those to function.
I would strongly urge you to invest time in learning how to use Maven (or Gradle) beyond a superficial level. Understanding these tools and the concepts involved can make your life much easier.
For example:
If you want to use Cucumber with JUnit 5 and annotation based step definitions you would declare this minimal set of dependencies in a Maven pom.xml file.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.9.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-bom</artifactId>
<version>7.10.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit-platform-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-suite</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
By telling Maven what your dependencies are Maven can calculate your transitive dependencies i.e: the dependencies of your dependencies.
This has many advantages. One example would be using the mvn dependency:tree -Dverbose command to will list all dependencies and their transitive dependencies.
$ mvn dependency:tree -Dverbose
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< cucumber:cucumber-java-skeleton >-------------------
[INFO] Building Cucumber-Java Skeleton 0.0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # cucumber-java-skeleton ---
[INFO] cucumber:cucumber-java-skeleton:jar:0.0.1
[INFO] +- io.cucumber:cucumber-java:jar:7.10.1:test
[INFO] | +- io.cucumber:cucumber-core:jar:7.10.1:test
[INFO] | | +- io.cucumber:cucumber-gherkin:jar:7.10.1:test
[INFO] | | | \- (io.cucumber:cucumber-plugin:jar:7.10.1:test - omitted for duplicate)
[INFO] | | +- io.cucumber:cucumber-gherkin-messages:jar:7.10.1:test
[INFO] | | | +- io.cucumber:gherkin:jar:25.0.2:test
[INFO] | | | | \- (io.cucumber:messages:jar:19.1.4:test - omitted for duplicate)
[INFO] | | | \- (io.cucumber:cucumber-gherkin:jar:7.10.1:test - omitted for duplicate)
[INFO] | | +- io.cucumber:messages:jar:19.1.4:test
[INFO] | | +- io.cucumber:tag-expressions:jar:4.1.0:test
[INFO] | | +- io.cucumber:cucumber-expressions:jar:16.1.1:test
[INFO] | | | \- (org.apiguardian:apiguardian-api:jar:1.1.2:test - omitted for duplicate)
[INFO] | | +- io.cucumber:datatable:jar:7.10.1:test
[INFO] | | | \- (org.apiguardian:apiguardian-api:jar:1.1.2:test - omitted for duplicate)
[INFO] | | +- io.cucumber:cucumber-plugin:jar:7.10.1:test
[INFO] | | | \- (org.apiguardian:apiguardian-api:jar:1.1.2:test - omitted for duplicate)
[INFO] | | +- io.cucumber:docstring:jar:7.10.1:test
[INFO] | | | \- (org.apiguardian:apiguardian-api:jar:1.1.2:test - omitted for duplicate)
[INFO] | | +- io.cucumber:html-formatter:jar:20.2.0:test
[INFO] | | | \- (io.cucumber:messages:jar:19.1.4:test - omitted for duplicate)
[INFO] | | +- io.cucumber:ci-environment:jar:9.1.0:test
[INFO] | | \- (org.apiguardian:apiguardian-api:jar:1.1.2:test - omitted for duplicate)
[INFO] | \- org.apiguardian:apiguardian-api:jar:1.1.2:test
[INFO] +- io.cucumber:cucumber-junit-platform-engine:jar:7.10.1:test
[INFO] | +- (io.cucumber:cucumber-core:jar:7.10.1:test - omitted for duplicate)
[INFO] | \- org.junit.platform:junit-platform-engine:jar:1.9.1:test
[INFO] | +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO] | +- org.junit.platform:junit-platform-commons:jar:1.9.1:test
[INFO] | | \- (org.apiguardian:apiguardian-api:jar:1.1.2:test - omitted for duplicate)
[INFO] | \- (org.apiguardian:apiguardian-api:jar:1.1.2:test - omitted for duplicate)
[INFO] +- org.junit.platform:junit-platform-suite:jar:1.9.1:test
[INFO] | +- org.junit.platform:junit-platform-suite-api:jar:1.9.1:test
[INFO] | | +- (org.junit.platform:junit-platform-commons:jar:1.9.1:test - omitted for duplicate)
[INFO] | | \- (org.apiguardian:apiguardian-api:jar:1.1.2:test - omitted for duplicate)
[INFO] | \- org.junit.platform:junit-platform-suite-engine:jar:1.9.1:test
[INFO] | +- (org.junit.platform:junit-platform-engine:jar:1.9.1:test - omitted for duplicate)
[INFO] | +- (org.junit.platform:junit-platform-suite-api:jar:1.9.1:test - omitted for duplicate)
[INFO] | +- (org.apiguardian:apiguardian-api:jar:1.1.2:test - omitted for duplicate)
[INFO] | \- org.junit.platform:junit-platform-suite-commons:jar:1.9.1:test
[INFO] | +- org.junit.platform:junit-platform-launcher:jar:1.9.1:test
[INFO] | | +- (org.junit.platform:junit-platform-engine:jar:1.9.1:test - omitted for duplicate)
[INFO] | | \- (org.apiguardian:apiguardian-api:jar:1.1.2:test - omitted for duplicate)
[INFO] | +- (org.apiguardian:apiguardian-api:jar:1.1.2:test - omitted for duplicate)
[INFO] | +- (org.junit.platform:junit-platform-engine:jar:1.9.1:test - omitted for duplicate)
[INFO] | \- (org.junit.platform:junit-platform-suite-api:jar:1.9.1:test - omitted for duplicate)
[INFO] \- org.junit.jupiter:junit-jupiter:jar:5.9.1:test
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.9.1:test
[INFO] | +- (org.opentest4j:opentest4j:jar:1.2.0:test - omitted for duplicate)
[INFO] | +- (org.junit.platform:junit-platform-commons:jar:1.9.1:test - omitted for duplicate)
[INFO] | \- (org.apiguardian:apiguardian-api:jar:1.1.2:test - omitted for duplicate)
[INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.9.1:test
[INFO] | +- (org.junit.jupiter:junit-jupiter-api:jar:5.9.1:test - omitted for duplicate)
[INFO] | \- (org.apiguardian:apiguardian-api:jar:1.1.2:test - omitted for duplicate)
[INFO] \- org.junit.jupiter:junit-jupiter-engine:jar:5.9.1:test
[INFO] +- (org.junit.platform:junit-platform-engine:jar:1.9.1:test - omitted for duplicate)
[INFO] +- (org.junit.jupiter:junit-jupiter-api:jar:5.9.1:test - omitted for duplicate)
[INFO] \- (org.apiguardian:apiguardian-api:jar:1.1.2:test - omitted for duplicate)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.933 s
[INFO] Finished at: 2022-12-28T16:33:23+01:00
[INFO] ------------------------------------------------------------------------
Note: If you see a transitive dependency listed as "omitted for duplicate" and you have also included it in your pom.xml, this inclusion isn't needed. Maven will download it for you.
Also if you are looking to make a fresh start, you could also use the cucumber-java-skeleton to start with a working project.

Unexpected transitive dependency version

Setting up a clean Maven project with spring boot for testing with JUnit 4 and 5 I end up with these dependencies:
<properties>
<junit-jupiter.version>5.5.2</junit-jupiter.version>
<spring-framework.version>5.2.0.RELEASE</spring-framework.version>
<spring-boot.version>2.2.0.RELEASE</spring-boot.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring-framework.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-swing</artifactId>
<version>11</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter.version}</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit-jupiter.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>${junit-jupiter.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-jupiter.version}</version>
</dependency>
</dependencies>
This results in the following dependency tree:
[INFO] ch.sahits.test:junit55:jar:1.0-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.2.0.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:2.2.0.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot:jar:2.2.0.RELEASE:compile
[INFO] | | | \- org.springframework:spring-context:jar:5.2.0.RELEASE:compile
[INFO] | | | +- org.springframework:spring-aop:jar:5.2.0.RELEASE:compile
[INFO] | | | +- org.springframework:spring-beans:jar:5.2.0.RELEASE:compile
[INFO] | | | \- org.springframework:spring-expression:jar:5.2.0.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:2.2.0.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:2.2.0.RELEASE:compile
[INFO] | | | +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] | | | | \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] | | | +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.12.1:compile
[INFO] | | | | \- org.apache.logging.log4j:log4j-api:jar:2.12.1:compile
[INFO] | | | \- org.slf4j:jul-to-slf4j:jar:1.7.28:compile
[INFO] | | +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] | | \- org.yaml:snakeyaml:jar:1.25:runtime
[INFO] | +- org.springframework.boot:spring-boot-test:jar:2.2.0.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.2.0.RELEASE:compile
[INFO] | +- com.jayway.jsonpath:json-path:jar:2.4.0:compile
[INFO] | | +- net.minidev:json-smart:jar:2.3:compile
[INFO] | | | \- net.minidev:accessors-smart:jar:1.2:compile
[INFO] | | | \- org.ow2.asm:asm:jar:5.0.4:compile
[INFO] | | \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] | +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.2:compile
[INFO] | | \- jakarta.activation:jakarta.activation-api:jar:1.2.1:compile
[INFO] | +- org.junit.jupiter:junit-jupiter:jar:5.5.2:compile
[INFO] | +- org.mockito:mockito-junit-jupiter:jar:3.1.0:compile
[INFO] | +- org.assertj:assertj-core:jar:3.13.2:compile
[INFO] | +- org.hamcrest:hamcrest:jar:2.1:compile
[INFO] | +- org.mockito:mockito-core:jar:3.1.0:compile
[INFO] | | +- net.bytebuddy:byte-buddy:jar:1.9.10:compile
[INFO] | | +- net.bytebuddy:byte-buddy-agent:jar:1.9.10:compile
[INFO] | | \- org.objenesis:objenesis:jar:2.6:compile
[INFO] | +- org.skyscreamer:jsonassert:jar:1.5.0:compile
[INFO] | | \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:compile
[INFO] | +- org.springframework:spring-test:jar:5.2.0.RELEASE:compile
[INFO] | \- org.xmlunit:xmlunit-core:jar:2.6.3:compile
[INFO] +- org.springframework:spring-core:jar:5.2.0.RELEASE:compile
[INFO] | \- org.springframework:spring-jcl:jar:5.2.0.RELEASE:compile
[INFO] +- org.openjfx:javafx-controls:jar:11:compile
[INFO] | +- org.openjfx:javafx-controls:jar:linux:11:compile
[INFO] | \- org.openjfx:javafx-graphics:jar:11:compile
[INFO] | +- org.openjfx:javafx-graphics:jar:linux:11:compile
[INFO] | \- org.openjfx:javafx-base:jar:11:compile
[INFO] | \- org.openjfx:javafx-base:jar:linux:11:compile
[INFO] +- org.openjfx:javafx-swing:jar:11:compile
[INFO] | \- org.openjfx:javafx-swing:jar:linux:11:compile
[INFO] +- junit:junit:jar:4.12:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.5.2:compile
[INFO] | +- org.apiguardian:apiguardian-api:jar:1.1.0:compile
[INFO] | \- org.junit.platform:junit-platform-engine:jar:1.5.2:compile
[INFO] +- org.junit.platform:junit-platform-launcher:jar:1.2.0:compile
[INFO] +- org.junit.vintage:junit-vintage-engine:jar:5.5.2:compile
[INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.5.2:compile
[INFO] \- org.junit.jupiter:junit-jupiter-api:jar:5.5.2:compile
[INFO] +- org.opentest4j:opentest4j:jar:1.2.0:compile
[INFO] \- org.junit.platform:junit-platform-commons:jar:1.5.2:compile
On a different module/project I do have these dependencies:
<dependencies>
<!-- Module dependencies -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>OpenPatricianUtilities</artifactId>
</dependency>
<dependency>
<groupId>ch.sahits.game</groupId>
<artifactId>GameEvent</artifactId>
</dependency>
<dependency>
<groupId>ch.sahits.game</groupId>
<artifactId>MarvinFXEssentials</artifactId>
<scope>test</scope>
</dependency>
<!-- Spring Framework -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
</dependency>
<!-- Other libraries -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ch.sahits</groupId>
<artifactId>sahitsUtil</artifactId>
</dependency>
<!-- Test -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.sahits.game</groupId>
<artifactId>OpenPatricianData</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.sahits.game</groupId>
<artifactId>OpenPatricianTestUtilities</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Resulting in this dependency tree:
[INFO] ch.sahits.game:OpenPatricianModel:jar:1.1.0-SNAPSHOT
[INFO] +- ch.sahits.game:OpenPatricianUtilities:jar:1.1.0-SNAPSHOT:compile
[INFO] | +- org.springframework:spring-context:jar:5.2.0.RELEASE:compile
[INFO] | | +- org.springframework:spring-aop:jar:5.2.0.RELEASE:compile
[INFO] | | \- org.springframework:spring-expression:jar:5.2.0.RELEASE:compile
[INFO] | +- org.springframework:spring-beans:jar:5.2.0.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-logging:jar:2.2.0.RELEASE:compile
[INFO] | | +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] | | | \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] | | +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.12.1:compile
[INFO] | | | \- org.apache.logging.log4j:log4j-api:jar:2.12.1:compile
[INFO] | | \- org.slf4j:jul-to-slf4j:jar:1.7.28:compile
[INFO] | +- org.openjfx:javafx-controls:jar:11:compile
[INFO] | | +- org.openjfx:javafx-controls:jar:linux:11:compile
[INFO] | | \- org.openjfx:javafx-graphics:jar:11:compile
[INFO] | | +- org.openjfx:javafx-graphics:jar:linux:11:compile
[INFO] | | \- org.openjfx:javafx-base:jar:11:compile
[INFO] | | \- org.openjfx:javafx-base:jar:linux:11:compile
[INFO] | +- commons-io:commons-io:jar:2.6:compile
[INFO] | +- com.thoughtworks.xstream:xstream:jar:1.4.11:compile
[INFO] | | +- xmlpull:xmlpull:jar:1.1.3.1:compile
[INFO] | | \- xpp3:xpp3_min:jar:1.1.4c:compile
[INFO] | +- javax.xml.bind:jaxb-api:jar:2.3.1:compile
[INFO] | \- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] +- ch.sahits.game:GameEvent:jar:1.1.0-SNAPSHOT:compile
[INFO] +- ch.sahits.game:MarvinFXEssentials:jar:1.1.0-SNAPSHOT:test
[INFO] | +- junit:junit:jar:4.12:test
[INFO] | | \- org.hamcrest:hamcrest-core:jar:2.1:test
[INFO] | \- org.openjfx:javafx-fxml:jar:11:test
[INFO] | \- org.openjfx:javafx-fxml:jar:linux:11:test
[INFO] +- org.springframework.boot:spring-boot:jar:2.2.0.RELEASE:compile
[INFO] | \- org.springframework:spring-core:jar:5.2.0.RELEASE:compile
[INFO] | \- org.springframework:spring-jcl:jar:5.2.0.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-autoconfigure:jar:2.2.0.RELEASE:compile
[INFO] +- org.springframework:spring-oxm:jar:5.2.0.RELEASE:compile
[INFO] +- org.glassfish.jaxb:jaxb-runtime:jar:2.3.1:compile
[INFO] | +- org.glassfish.jaxb:txw2:jar:2.3.2:compile
[INFO] | +- com.sun.istack:istack-commons-runtime:jar:3.0.7:compile
[INFO] | +- org.jvnet.staxex:stax-ex:jar:1.8:compile
[INFO] | +- com.sun.xml.fastinfoset:FastInfoset:jar:1.2.15:compile
[INFO] | \- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] +- com.google.guava:guava:jar:24.1-jre:compile
[INFO] | +- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] | +- org.checkerframework:checker-compat-qual:jar:2.0.0:compile
[INFO] | +- com.google.errorprone:error_prone_annotations:jar:2.1.3:compile
[INFO] | +- com.google.j2objc:j2objc-annotations:jar:1.1:compile
[INFO] | \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile
[INFO] +- org.projectlombok:lombok:jar:1.18.10:provided
[INFO] +- ch.sahits:sahitsUtil:jar:1.3.3:compile
[INFO] | +- org.apache.commons:commons-lang3:jar:3.9:compile
[INFO] | +- org.mockito:mockito-junit-jupiter:jar:3.1.0:compile
[INFO] | \- commons-cli:commons-cli:jar:1.4:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.2.0.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:2.2.0.RELEASE:test
[INFO] | | +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:test
[INFO] | | \- org.yaml:snakeyaml:jar:1.25:test
[INFO] | +- org.springframework.boot:spring-boot-test:jar:2.2.0.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.2.0.RELEASE:test
[INFO] | +- com.jayway.jsonpath:json-path:jar:2.4.0:test
[INFO] | | +- net.minidev:json-smart:jar:2.3:test
[INFO] | | | \- net.minidev:accessors-smart:jar:1.2:test
[INFO] | | | \- org.ow2.asm:asm:jar:5.0.4:test
[INFO] | | \- org.slf4j:slf4j-api:jar:1.7.28:compile
[INFO] | +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.2:test
[INFO] | | \- jakarta.activation:jakarta.activation-api:jar:1.2.1:test
[INFO] | +- org.junit.jupiter:junit-jupiter:jar:5.5.2:test
[INFO] | +- org.junit.vintage:junit-vintage-engine:jar:5.5.2:test
[INFO] | | +- org.apiguardian:apiguardian-api:jar:1.1.0:test
[INFO] | | \- org.junit.platform:junit-platform-engine:jar:1.5.2:test
[INFO] | +- org.assertj:assertj-core:jar:3.13.2:test
[INFO] | +- org.hamcrest:hamcrest:jar:2.1:test
[INFO] | +- org.mockito:mockito-core:jar:3.1.0:compile
[INFO] | | +- net.bytebuddy:byte-buddy:jar:1.10.1:compile
[INFO] | | +- net.bytebuddy:byte-buddy-agent:jar:1.10.1:compile
[INFO] | | \- org.objenesis:objenesis:jar:2.6:compile
[INFO] | +- org.skyscreamer:jsonassert:jar:1.5.0:test
[INFO] | | \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] | +- org.springframework:spring-test:jar:5.2.0.RELEASE:test
[INFO] | \- org.xmlunit:xmlunit-core:jar:2.6.3:test
[INFO] +- ch.sahits.game:OpenPatricianData:jar:1.1.0-SNAPSHOT:test
[INFO] \- ch.sahits.game:OpenPatricianTestUtilities:jar:1.1.0-SNAPSHOT:test
[INFO] +- org.openjfx:javafx-swing:jar:11:test
[INFO] | \- org.openjfx:javafx-swing:jar:linux:11:test
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.5.2:test
[INFO] +- org.junit.platform:junit-platform-launcher:jar:1.5.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.5.2:test
[INFO] \- org.junit.jupiter:junit-jupiter-api:jar:5.5.2:test
[INFO] +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO] \- org.junit.platform:junit-platform-commons:jar:1.5.2:test
Both define Mockito in version 3.1.0 through the spring-boot-starter-test. However the the porject junit55 has a byte-buddy dependency of version 1.9.10 while OpenPatricianModel has it in version 1.10.1. This dependency is not explicity defined in the project.
How is it possible that I have different dependency of byte-buddy on OpenPatricianModel and how can I find out, where it comes from.
The byte-buddy dependencies are being pulled in transitively by at least one more dependency than org.springframework.boot:spring-boot-starter-test. You can see that by the scope of byte-buddy in the dependency tree of your OpenPatricianModel. Note that the scope is compile and not test.
The best way to find out which dependency is pulling it in is to add exclusions of the byte-buddy dependencies in your declaration of the spring-boot-starter-test. Something like:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
</exclusion>
<exclusion>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-agent</artifactId>
</exclusion>
</exclusions>
</dependency>
Then, by running mvn dependency:tree again you should be able to see which other dependency is pulling in byte-buddy. Note that there could be more than one, in which case you will have to do the same exercise again.

How to migrate existing Spring project to Spring Boot

I'm trying to migrate existing Spring project to Spring Boot.
In project already used Spring Data JPA/Hibernate and simple DAO with JDBC (PostgreSQL used).
In few states I found that all that I need to migrate on Spring boot, is:
Add necessary dependencies
Add entry point #SpringBootApplication
profit, that's all.
1) Dependencies:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring.boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.4</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>2.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>1.4.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
<version>1.4.7.RELEASE</version>
</dependency>
With dependencyManagment section I have error:
Exception in thread "main" java.lang.NoSuchMethodError: org.springframework.data.repository.config.RepositoryConfigurationSource.getAttribute(Ljava/lang/String;)Ljava/util/Optional;
at org.springframework.data.jpa.repository.config.JpaRepositoryConfigExtension.postProcess(JpaRepositoryConfigExtension.java:125)
at org.springframework.data.repository.config.RepositoryConfigurationDelegate.registerRepositoriesIn(RepositoryConfigurationDelegate.java:127)
at org.springframework.data.repository.config.RepositoryBeanDefinitionRegistrarSupport.registerBeanDefinitions(RepositoryBeanDefinitionRegistrarSupport.java:83)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:359)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:143)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:116)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:320)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:228)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:272)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:92)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:525)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
at ru.testproject.BootConfiguration.main(BootConfiguration.java:26)
And without it:
Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is java.lang.NoClassDefFoundError: org/eclipse/jetty/util/DeprecationWarning
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
at ru.testproject.BootConfiguration.main(BootConfiguration.java:26)
Caused by: java.lang.NoClassDefFoundError: org/eclipse/jetty/util/DeprecationWarning
at org.eclipse.jetty.servlet.ServletContextHandler.<init>(ServletContextHandler.java:159)
at org.eclipse.jetty.webapp.WebAppContext.<init>(WebAppContext.java:289)
at org.eclipse.jetty.webapp.WebAppContext.<init>(WebAppContext.java:211)
at org.springframework.boot.context.embedded.jetty.JettyEmbeddedWebAppContext.<init>(JettyEmbeddedWebAppContext.java:28)
at org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory.getEmbeddedServletContainer(JettyEmbeddedServletContainerFactory.java:170)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:164)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134)
... 8 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.util.DeprecationWarning
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
2) entry point (I'm also tried to Import configuration classes, commented):
#SpringBootApplication
//#Import({DatabaseConfig.class, WebMvcConfig.class, WebAppConfig.class, WebSecurityConfig.class, WebServiceConfig.class})
public class BootConfiguration extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(BootConfiguration.class, args);
// SpringApplication.run(new Class<?>[] {BootConfiguration.class, DatabaseConfig.class, WebMvcConfig.class, WebAppConfig.class, WebSecurityConfig.class, WebServiceConfig.class}, args);
}
#Bean
public JettyEmbeddedServletContainerFactory jettyEmbeddedServletContainerFactory() {
JettyEmbeddedServletContainerFactory jettyContainer =
new JettyEmbeddedServletContainerFactory();
jettyContainer.setPort(9000);
jettyContainer.setContextPath("");
return jettyContainer;
}
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(BootConfiguration.class);
}
}
And configuration:
#Configuration
#EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
#EnableJpaRepositories(basePackages = {
"ru.testproject.hibernate"
})
#EnableTransactionManagement
#PropertySource("classpath:application.properties")
public class DatabaseConfig implements TransactionManagementConfigurer {
#Bean
public DataSource dataSource() {
if (DB_TYPE_POSTGRESQL.equalsIgnoreCase(dbType)) {
return postresqlDataSource();
} else {
return h2DataSource();
}
}
#Bean
public PlatformTransactionManager annotationDrivenTransactionManager() {
return new JpaTransactionManager();
}
}
I have no idea what I'm doing wrong. What do I need to do to start spring boot application with existing Jetty server configuration?
UPDATE
I've modified the main pom:
<parent>
<groupId>ru.testproject</groupId>
<artifactId>test</artifactId>
<version>1.0.1</version>
</parent>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring.boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
...
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
<!-- <version>${spring.boot.version}</version> -->
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</exclusion>
<exclusion>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate-version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate-version}</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>4.2.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>4.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>4.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- Version 5.0.4 because ${spring.version} context fails with CandidateComponentsIndexLoader error (it introduced in 5.0.0 version) -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.0.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<!-- Jetty embedded -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
also, I've commented all tags for spring boot dependencies.
mvc dependency:tree give the following output:
[INFO] --- maven-dependency-plugin:3.0.2:tree (default-cli) # test ---
[WARNING] The artifact org.hibernate:hibernate-infinispan:jar:5.3.3.Final has been relocated to org.infinispan:infinispan-hibernate-cache-v53:jar:9.3.0.Final
[INFO] ru.testproject:test:jar:2.4.41-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.5.8.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test:jar:1.5.8.RELEASE:test
[INFO] | | \- org.springframework.boot:spring-boot:jar:1.5.8.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.5.8.RELEASE:test
[INFO] | | \- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.8.RELEASE:compile
[INFO] | +- com.jayway.jsonpath:json-path:jar:2.2.0:test
[INFO] | | \- net.minidev:json-smart:jar:2.2.1:test
[INFO] | | \- net.minidev:accessors-smart:jar:1.1:test
[INFO] | +- org.assertj:assertj-core:jar:2.6.0:test
[INFO] | +- org.mockito:mockito-core:jar:1.10.19:test
[INFO] | | \- org.objenesis:objenesis:jar:2.1:test
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] | +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] | +- org.skyscreamer:jsonassert:jar:1.4.0:test
[INFO] | | \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] | +- org.springframework:spring-core:jar:4.3.12.RELEASE:compile
[INFO] | \- org.springframework:spring-test:jar:4.3.12.RELEASE:test
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.5.8.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:1.5.8.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:1.5.8.RELEASE:compile
[INFO] | | | +- ch.qos.logback:logback-classic:jar:1.1.11:compile
[INFO] | | | | \- ch.qos.logback:logback-core:jar:1.1.11:compile
[INFO] | | | +- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
[INFO] | | | \- org.slf4j:log4j-over-slf4j:jar:1.7.25:compile
[INFO] | | \- org.yaml:snakeyaml:jar:1.17:runtime
[INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:1.5.8.RELEASE:compile
[INFO] | | \- org.aspectj:aspectjweaver:jar:1.8.11:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.5.8.RELEASE:compile
[INFO] | | \- org.apache.tomcat:tomcat-jdbc:jar:8.5.23:compile
[INFO] | | \- org.apache.tomcat:tomcat-juli:jar:8.5.23:compile
[INFO] | +- javax.transaction:javax.transaction-api:jar:1.2:compile
[INFO] | +- org.springframework.data:spring-data-jpa:jar:1.11.8.RELEASE:compile
[INFO] | | +- org.springframework.data:spring-data-commons:jar:1.13.8.RELEASE:compile
[INFO] | | +- org.springframework:spring-orm:jar:4.3.12.RELEASE:compile
[INFO] | | \- org.slf4j:jcl-over-slf4j:jar:1.7.25:compile
[INFO] | \- org.springframework:spring-aspects:jar:4.3.12.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-jetty:jar:1.5.8.RELEASE:compile
[INFO] | +- org.eclipse.jetty:jetty-webapp:jar:9.4.7.v20170914:compile
[INFO] | | +- org.eclipse.jetty:jetty-xml:jar:9.4.7.v20170914:compile
[INFO] | | \- org.eclipse.jetty:jetty-servlet:jar:9.4.7.v20170914:compile
[INFO] | | \- org.eclipse.jetty:jetty-security:jar:9.4.7.v20170914:compile
[INFO] | | \- org.eclipse.jetty:jetty-server:jar:9.4.7.v20170914:compile
[INFO] | +- org.eclipse.jetty.websocket:websocket-server:jar:9.4.7.v20170914:compile
[INFO] | | +- org.eclipse.jetty.websocket:websocket-common:jar:9.4.7.v20170914:compile
[INFO] | | | \- org.eclipse.jetty.websocket:websocket-api:jar:9.4.7.v20170914:compile
[INFO] | | +- org.eclipse.jetty.websocket:websocket-client:jar:9.4.7.v20170914:compile
[INFO] | | | \- org.eclipse.jetty:jetty-client:jar:9.4.7.v20170914:compile
[INFO] | | \- org.eclipse.jetty.websocket:websocket-servlet:jar:9.4.7.v20170914:compile
[INFO] | +- org.eclipse.jetty.websocket:javax-websocket-server-impl:jar:9.4.7.v20170914:compile
[INFO] | | +- org.eclipse.jetty:jetty-annotations:jar:9.4.7.v20170914:compile
[INFO] | | | +- org.eclipse.jetty:jetty-plus:jar:9.4.7.v20170914:compile
[INFO] | | | +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO] | | | +- org.ow2.asm:asm:jar:5.1:compile
[INFO] | | | \- org.ow2.asm:asm-commons:jar:5.1:compile
[INFO] | | | \- org.ow2.asm:asm-tree:jar:5.1:compile
[INFO] | | +- org.eclipse.jetty.websocket:javax-websocket-client-impl:jar:9.4.7.v20170914:compile
[INFO] | | \- javax.websocket:javax.websocket-api:jar:1.0:compile
[INFO] | \- org.mortbay.jasper:apache-el:jar:8.0.33:compile
[INFO] +- commons-fileupload:commons-fileupload:jar:1.3.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web-services:jar:1.5.8.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-web:jar:1.5.8.RELEASE:compile
[INFO] | +- org.springframework:spring-oxm:jar:4.3.12.RELEASE:compile
[INFO] | \- org.springframework.ws:spring-ws-core:jar:2.4.0.RELEASE:compile
[INFO] | \- org.springframework.ws:spring-xml:jar:2.4.0.RELEASE:compile
[INFO] +- org.hibernate:hibernate-entitymanager:jar:5.3.3.Final:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.3.1.Final:compile
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | +- org.hibernate.common:hibernate-commons-annotations:jar:5.0.4.Final:compile
[INFO] | +- javax.persistence:javax.persistence-api:jar:2.2:compile
[INFO] | +- net.bytebuddy:byte-buddy:jar:1.8.13:compile
[INFO] | \- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.1.1.Final:compile
[INFO] +- org.hibernate:hibernate-core:jar:5.3.3.Final:compile
[INFO] | +- org.javassist:javassist:jar:3.21.0-GA:compile
[INFO] | +- antlr:antlr:jar:2.7.7:compile
[INFO] | +- org.jboss:jandex:jar:2.0.5.Final:compile
[INFO] | +- com.fasterxml:classmate:jar:1.3.4:compile
[INFO] | \- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
[INFO] +- org.hibernate:hibernate-osgi:jar:5.3.3.Final:compile
[INFO] | +- javax.interceptor:javax.interceptor-api:jar:1.2:compile
[INFO] | +- org.osgi:org.osgi.core:jar:6.0.0:compile
[INFO] | \- org.osgi:org.osgi.compendium:jar:5.0.0:compile
[INFO] +- org.hibernate:hibernate-envers:jar:5.3.3.Final:compile
[INFO] +- org.hibernate:hibernate-hikaricp:jar:5.3.3.Final:compile
[INFO] +- org.hibernate:hibernate-proxool:jar:5.3.3.Final:compile
[INFO] | \- proxool:proxool:jar:0.8.3:compile
[INFO] +- org.infinispan:infinispan-hibernate-cache-v53:jar:9.3.0.Final:compile
[INFO] | +- org.infinispan:infinispan-hibernate-cache-commons:jar:9.3.0.Final:compile
[INFO] | +- org.infinispan:infinispan-hibernate-cache-spi:jar:9.3.0.Final:compile
[INFO] | \- org.infinispan:infinispan-core:jar:9.3.0.Final:compile
[INFO] | +- org.infinispan:infinispan-commons:jar:9.3.0.Final:compile
[INFO] | +- org.jgroups:jgroups:jar:4.0.12.Final:compile
[INFO] | +- com.github.ben-manes.caffeine:caffeine:jar:2.3.5:compile
[INFO] | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.1.Final:compile
[INFO] | +- org.jboss.marshalling:jboss-marshalling-osgi:jar:2.0.5.Final:compile
[INFO] | \- io.reactivex.rxjava2:rxjava:jar:2.1.3:compile
[INFO] | \- org.reactivestreams:reactive-streams:jar:1.0.1:compile
[INFO] +- org.hibernate:hibernate-ehcache:jar:5.3.3.Final:compile
[INFO] | \- net.sf.ehcache:ehcache:jar:2.10.4:compile
[INFO] +- wsdl4j:wsdl4j:jar:1.6.1:compile
[INFO] +- org.springframework:spring-webmvc:jar:4.3.12.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:4.3.12.RELEASE:compile
[INFO] | +- org.springframework:spring-beans:jar:4.3.12.RELEASE:compile
[INFO] | +- org.springframework:spring-expression:jar:4.3.12.RELEASE:compile
[INFO] | \- org.springframework:spring-web:jar:4.3.12.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-config:jar:4.2.1.RELEASE:compile
[INFO] | +- aopalliance:aopalliance:jar:1.0:compile
[INFO] | \- org.springframework.security:spring-security-core:jar:4.2.3.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-web:jar:4.2.0.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-taglibs:jar:4.2.0.RELEASE:compile
[INFO] | \- org.springframework.security:spring-security-acl:jar:4.2.3.RELEASE:compile
[INFO] +- org.springframework:spring-jdbc:jar:4.3.12.RELEASE:compile
[INFO] +- org.springframework:spring-context:jar:5.0.4.RELEASE:compile
[INFO] +- org.springframework:spring-context-support:jar:4.3.12.RELEASE:compile
[INFO] +- org.springframework:spring-tx:jar:4.3.12.RELEASE:compile
[INFO] +- javax.xml.bind:jaxb-api:jar:2.3.0:compile
[INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO] +- javax.inject:javax.inject:jar:1:compile
[INFO] +- commons-configuration:commons-configuration:jar:1.10:compile
[INFO] | \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- commons-lang:commons-lang:jar:2.6:compile
[INFO] +- junit:junit:jar:4.11:test
[INFO] +- org.jdom:jdom:jar:2.0.2:compile
[INFO] +- commons-io:commons-io:jar:2.4:compile
[INFO] +- xalan:xalan:jar:2.7.2:compile
[INFO] | \- xalan:serializer:jar:2.7.2:compile
[INFO] | \- xml-apis:xml-apis:jar:1.4.01:compile
[INFO] +- org.apache.derby:derby:jar:10.11.1.1:compile
[INFO] +- org.postgresql:postgresql:jar:42.1.1:compile
[INFO] +- com.zaxxer:HikariCP:jar:2.6.3:compile
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] +- jaxen:jaxen:jar:1.1.6:compile
[INFO] +- ru.testproject:test-conf:jar:2.4.41-SNAPSHOT:compile
[INFO] | +- log4j:log4j:jar:1.2.16:compile
[INFO] | +- org.slf4j:slf4j-log4j12:jar:1.7.25:compile
[INFO] | \- ru.testproject:test-util:jar:2.4.41-SNAPSHOT:compile
[INFO] +- com.github.spullara.mustache.java:compiler:jar:0.9.0:compile
[INFO] +- org.quartz-scheduler:quartz:jar:2.2.1:compile
[INFO] | \- c3p0:c3p0:jar:0.9.1.1:compile
[INFO] +- javax.json:javax.json-api:jar:1.0:compile
[INFO] +- org.apache.santuario:xmlsec:jar:2.0.6:compile
[INFO] | +- org.codehaus.woodstox:woodstox-core-asl:jar:4.4.1:compile
[INFO] | | +- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] | | \- org.codehaus.woodstox:stax2-api:jar:3.1.4:compile
[INFO] | \- commons-codec:commons-codec:jar:1.10:compile
[INFO] +- org.eclipse.jetty:jetty-servlets:jar:9.3.5.v20151012:compile
[INFO] | +- org.eclipse.jetty:jetty-continuation:jar:9.4.7.v20170914:compile
[INFO] | +- org.eclipse.jetty:jetty-http:jar:9.4.7.v20170914:compile
[INFO] | +- org.eclipse.jetty:jetty-util:jar:9.4.7.v20170914:compile
[INFO] | \- org.eclipse.jetty:jetty-io:jar:9.4.7.v20170914:compile
[INFO] +- com.itextpdf:itextpdf:jar:5.5.12:compile
[INFO] +- org.bouncycastle:bcprov-jdk15on:jar:1.55:compile
[INFO] +- org.bouncycastle:bcmail-jdk15on:jar:1.55:compile
[INFO] +- org.bouncycastle:bcpkix-jdk15on:jar:1.55:compile
[INFO] +- com.google.guava:guava:jar:24.0-jre:compile
[INFO] | +- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] | +- org.checkerframework:checker-compat-qual:jar:2.0.0:compile
[INFO] | +- com.google.errorprone:error_prone_annotations:jar:2.1.3:compile
[INFO] | +- com.google.j2objc:j2objc-annotations:jar:1.1:compile
[INFO] | \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile
[INFO] +- org.dom4j:dom4j:jar:2.1.0:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.10:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.8.10:compile
[INFO] +- commons-net:commons-net:jar:3.6:compile
[INFO] +- org.samba.jcifs:jcifs:jar:1.2.19:compile
[INFO] \- org.reflections:reflections:jar:0.9.11:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.788 s
[INFO] Finished at: 2018-08-22T11:11:41+03:00
[INFO] ------------------------------------------------------------------------
Anyway, I have the same issue at application startup:
Warning: SLF4J: Class path contains multiple SLF4J bindings.
33:08.275 [main] DEBUG org.springframework.boot.logging.ClasspathLoggingApplicationListener - Application failed to start with classpath:
[main] ERROR org.springframework.boot.SpringApplication - Application startup failed
java.lang.NoSuchMethodError: org.springframework.util.ObjectUtils.unwrapOptional(Ljava/lang/Object;)Ljava/lang/Object;
at org.springframework.validation.DataBinder.<init>(DataBinder.java:179)
at org.springframework.boot.bind.RelaxedDataBinder.<init>(RelaxedDataBinder.java:83)
org.springframework.boot.context.config.ConfigFileApplicationListener.postProcessEnvironment(ConfigFileApplicationListener.java:197)
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:74)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:325)
org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
at ru.testproject.BootConfiguration.main(BootConfiguration.java:26)
cess finished with exit code 1
Problem solved: I fixed the dependency issues. Should use,
#Configuration
#EnableAutoConfiguration
#ComponentScan
#Import(Config.class)
instead #SpringBootApplication annotation. Now the application is getting booted, but cannot find config file which is another story.

Spring Bean ClassNotFound how to debug?

I'm new to Spring and im getting the following error
java.lang.NoClassDefFoundError: org/springframework/beans/factory/NoUniqueBeanDefinitionException
java.lang.Class.getDeclaredMethods0(Native Method)
java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
java.lang.Class.getDeclaredMethods(Class.java:1855)
org.springframework.core.type.StandardAnnotationMetadata.hasAnnotatedMethods(StandardAnnotationMetadata.java:159)
org.springframework.context.annotation.ConfigurationClassUtils.isLiteConfigurationCandidate(ConfigurationClassUtils.java:104)
org.springframework.context.annotation.ConfigurationClassUtils.checkConfigurationClassCandidate(ConfigurationClassUtils.java:87)
org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:253)
org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:223)
org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:630)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:647)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:598)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:661)
org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:517)
org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:458)
org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:138)
javax.servlet.GenericServlet.init(GenericServlet.java:160)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:409)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1044)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:2378)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
java.lang.Thread.run(Thread.java:744)
From what I've searched it seems that I'm missing a library, so here is my POM
<properties>
<spring.version>3.2.0.RELEASE</spring.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<!--Jersey-->
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-spring3</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-xml-provider</artifactId>
<version>2.3.0</version>
</dependency>
<!--Security-->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>3.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>3.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>3.2.0.RELEASE</version>
</dependency>
<!--Spring Data JDBC-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>4.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>4.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.28</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.0.Final</version>
</dependency>
If you guys could help me figure out which Lib it it i would be grateful.
But can some one teach how to debug this kind of error?
I'm using Intelij Idea 13
Here is the output of mvn dependency:three
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # WebGest ---
[INFO] com.springapp:WebGest:war:1.0-SNAPSHOT
[INFO] +- org.springframework:spring-core:jar:3.2.0.RELEASE:compile
[INFO] | \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- org.springframework:spring-web:jar:3.2.0.RELEASE:compile
[INFO] | +- org.springframework:spring-context:jar:3.2.0.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:3.2.0.RELEASE:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-beans:jar:3.2.0.RELEASE:compile
[INFO] +- javax.servlet:servlet-api:jar:2.5:compile
[INFO] +- javax.servlet.jsp:jsp-api:jar:2.1:provided
[INFO] +- org.springframework:spring-webmvc:jar:3.2.0.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:3.2.0.RELEASE:compile
[INFO] +- org.springframework:spring-test:jar:3.2.0.RELEASE:test
[INFO] +- junit:junit:jar:4.8.2:test
[INFO] +- org.glassfish.jersey.ext:jersey-spring3:jar:2.5.1:compile
[INFO] | +- org.glassfish.jersey.core:jersey-server:jar:2.5.1:compile
[INFO] | | +- org.glassfish.jersey.core:jersey-common:jar:2.5.1:compile
[INFO] | | | +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO] | | | \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile
[INFO] | | +- org.glassfish.jersey.core:jersey-client:jar:2.5.1:compile
[INFO] | | +- com.google.guava:guava:jar:14.0.1:compile
[INFO] | | +- org.glassfish.hk2:hk2-api:jar:2.2.0-b21:compile
[INFO] | | +- org.glassfish.hk2.external:javax.inject:jar:2.2.0-b21:compile
[INFO] | | +- org.glassfish.hk2:hk2-locator:jar:2.2.0-b21:compile
[INFO] | | | +- org.glassfish.hk2.external:asm-all-repackaged:jar:2.2.0-b21:compile
[INFO] | | | \- org.glassfish.hk2.external:cglib:jar:2.2.0-b21:compile
[INFO] | | \- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | +- org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.5.1:compile
[INFO] | +- org.glassfish.hk2:hk2:jar:2.2.0-b21:compile
[INFO] | | +- org.glassfish.hk2:hk2-utils:jar:2.2.0-b21:compile
[INFO] | | | \- javax.inject:javax.inject:jar:1:compile
[INFO] | | +- org.glassfish.hk2:config-types:jar:2.2.0-b21:compile
[INFO] | | +- org.glassfish.hk2:core:jar:2.2.0-b21:compile
[INFO] | | +- org.glassfish.hk2:hk2-config:jar:2.2.0-b21:compile
[INFO] | | | +- org.jvnet:tiger-types:jar:1.4:compile
[INFO] | | | \- org.glassfish.hk2.external:bean-validator:jar:2.2.0-b21:compile
[INFO] | | +- org.glassfish.hk2:hk2-runlevel:jar:2.2.0-b21:compile
[INFO] | | \- org.glassfish.hk2:class-model:jar:2.2.0-b21:compile
[INFO] | +- org.glassfish.hk2:spring-bridge:jar:2.2.0-b21:compile
[INFO] | \- javax.ws.rs:javax.ws.rs-api:jar:2.0:compile
[INFO] +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.3.0:compile
[INFO] | +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.3.0:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-core:jar:2.3.0:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.3.0:compile
[INFO] | | \- com.fasterxml.jackson.core:jackson-annotations:jar:2.3.0:compile
[INFO] | \- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.3.0:compile
[INFO] +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-xml-provider:jar:2.3.0:compile
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-xml:jar:2.3.0:compile
[INFO] | +- org.codehaus.woodstox:stax2-api:jar:3.1.1:compile
[INFO] | | \- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] | \- org.codehaus.woodstox:woodstox-core-asl:jar:4.1.4:compile
[INFO] +- org.springframework.security:spring-security-web:jar:3.2.0.RELEASE:compile
[INFO] | \- org.springframework.security:spring-security-core:jar:3.2.0.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-config:jar:3.2.0.RELEASE:compile
[INFO] +- org.springframework:spring-jdbc:jar:4.0.0.RELEASE:compile
[INFO] | \- org.springframework:spring-tx:jar:4.0.0.RELEASE:compile
[INFO] +- org.springframework:spring-orm:jar:4.0.0.RELEASE:compile
[INFO] +- mysql:mysql-connector-java:jar:5.1.28:compile
[INFO] \- org.hibernate:hibernate-core:jar:4.3.0.Final:compile
[INFO] +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile
[INFO] +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
[INFO] +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.0.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.4.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] +- antlr:antlr:jar:2.7.7:compile
[INFO] \- org.jboss:jandex:jar:1.1.0.Final:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.348s
[INFO] Finished at: Mon Feb 03 21:43:43 WET 2014
[INFO] Final Memory: 13M/217M
[INFO] ------------------------------------------------------------------------
To troubleshoot these kind of problems, search for the class in either findjar.com or
grepcode.com, in this case this is the report from grepcode for NoUniqueBeanDefinitionException.
There we can see that that class is not on version 3.2.0 of the spring-beans jar, and that the earliest version that has it 3.2.1.RELEASE.
Then check the version used in your project with mvn dependency:tree, and adapt accordingly, in this case upgrade to at least 3.2.1.RELEASE.
This class seems (from a since tag) to be introduced in Spring 3.2.1. Try to change spring.version to 3.2.1.RELEASE (to upgrade also spring-beans.jar which holds this class).

Why servlet-api.jar turns its status from test to compile?

This is what I have in pom.xml:
<dependency>
<groupId>com.sun.jersey.jersey-test-framework</groupId>
<artifactId>jersey-test-framework-grizzly</artifactId>
<version>1.4</version>
<scope>test</scope>
</dependency>
This is what I see after mvn --debug war:war:
[...]
[DEBUG] com.sun.jersey.jersey-test-framework:jersey-test-framework-grizzly:jar:1.4:test
[DEBUG] com.sun.jersey.jersey-test-framework:jersey-test-framework-core:jar:1.4:test
[DEBUG] org.glassfish:javax.servlet:jar:3.0-b66:test
[DEBUG] com.sun.grizzly:grizzly-servlet-webserver:jar:1.9.18-i:test
[DEBUG] com.sun.grizzly:grizzly-http:jar:1.9.18-i:test
[DEBUG] com.sun.grizzly:grizzly-framework:jar:1.9.18-i:test
[DEBUG] com.sun.grizzly:grizzly-rcm:jar:1.9.18-i:test
[DEBUG] com.sun.grizzly:grizzly-portunif:jar:1.9.18-i:test
[DEBUG] com.sun.grizzly:grizzly-http-servlet:jar:1.9.18-i:test
[DEBUG] com.sun.grizzly:grizzly-utils:jar:1.9.18-i:test
[DEBUG] javax.servlet:servlet-api:jar:2.5:compile
[...]
Pay attention to the last line. Why it's not "test", but "compile"?
ps. Indeed it's very weird. This is my complete pom.xml (sorry, it's not short):
[...]
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version> <!-- 10 Sep 2010 -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>xom</groupId>
<artifactId>xom</artifactId>
<version>1.2.5</version> <!-- 13 Oct 2010 -->
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.5</version> <!-- 9 Oct 2010 -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version> <!-- 9 Oct 2010 -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>1.6.2</version> <!-- 12 Oct 2010 -->
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version> <!-- 2 Nov 2010 -->
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<!-- version see below in dependencyManagement section -->
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<!-- version see below in dependencyManagement section -->
</dependency>
<dependency>
<groupId>com.sun.jersey.jersey-test-framework</groupId>
<artifactId>jersey-test-framework-grizzly</artifactId>
<!-- version see below in dependencyManagement section -->
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<!-- version see below in dependencyManagement section -->
</dependency>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>openejb-ejbd</artifactId>
<!-- version see below in dependencyManagement section -->
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<!-- version see below in dependencyManagement section -->
</dependency>
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<!-- version see below in dependencyManagement section -->
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version> <!-- 9 Oct 2010 -->
<scope>provided</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>${jersey.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey.jersey-test-framework</groupId>
<artifactId>jersey-test-framework-grizzly</artifactId>
<version>${jersey.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>openejb-ejbd</artifactId>
<version>3.1.3</version> <!-- 26 October 2010 -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.4.2</version> <!-- 29 oct 2010 -->
</dependency>
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.10</version> <!-- 12 October 2010 -->
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
[...]
This is how maven-war-plugin is configured:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0</version>
<configuration>
<archive>
<manifestEntries>
<SCM-Revision>${buildNumber}</SCM-Revision>
</manifestEntries>
</archive>
</configuration>
</plugin>
This is very very weird, I don't get the same output when running mvn with --debug:
$ mvn --debug compile
...
[DEBUG] com.sun.jersey.jersey-test-framework:jersey-test-framework-grizzly:jar:1.4:test
[DEBUG] com.sun.jersey.jersey-test-framework:jersey-test-framework-core:jar:1.4:test
[DEBUG] com.sun.jersey:jersey-server:jar:1.4:test
[DEBUG] com.sun.jersey:jersey-core:jar:1.4:test
[DEBUG] asm:asm:jar:3.1:test
[DEBUG] com.sun.jersey:jersey-client:jar:1.4:test
[DEBUG] org.glassfish:javax.servlet:jar:3.0-b66:test
[DEBUG] com.sun.grizzly:grizzly-servlet-webserver:jar:1.9.18-i:test
[DEBUG] com.sun.grizzly:grizzly-http:jar:1.9.18-i:test
[DEBUG] com.sun.grizzly:grizzly-framework:jar:1.9.18-i:test
[DEBUG] com.sun.grizzly:grizzly-rcm:jar:1.9.18-i:test
[DEBUG] com.sun.grizzly:grizzly-portunif:jar:1.9.18-i:test
[DEBUG] com.sun.grizzly:grizzly-http-servlet:jar:1.9.18-i:test
[DEBUG] com.sun.grizzly:grizzly-utils:jar:1.9.18-i:test
[DEBUG] javax.servlet:servlet-api:jar:2.5:test
...
Which is coherent with the dependency:tree:
$ mvn dependency:tree
[INFO] Scanning for projects...
...
[INFO] \- com.sun.jersey.jersey-test-framework:jersey-test-framework-grizzly:jar:1.4:test
[INFO] +- com.sun.jersey.jersey-test-framework:jersey-test-framework-core:jar:1.4:test
[INFO] | +- com.sun.jersey:jersey-server:jar:1.4:test
[INFO] | | +- com.sun.jersey:jersey-core:jar:1.4:test
[INFO] | | \- asm:asm:jar:3.1:test
[INFO] | +- com.sun.jersey:jersey-client:jar:1.4:test
[INFO] | \- org.glassfish:javax.servlet:jar:3.0-b66:test
[INFO] \- com.sun.grizzly:grizzly-servlet-webserver:jar:1.9.18-i:test
[INFO] +- com.sun.grizzly:grizzly-http:jar:1.9.18-i:test
[INFO] | +- com.sun.grizzly:grizzly-framework:jar:1.9.18-i:test
[INFO] | +- com.sun.grizzly:grizzly-rcm:jar:1.9.18-i:test
[INFO] | \- com.sun.grizzly:grizzly-portunif:jar:1.9.18-i:test
[INFO] +- com.sun.grizzly:grizzly-http-servlet:jar:1.9.18-i:test
[INFO] | \- com.sun.grizzly:grizzly-utils:jar:1.9.18-i:test
[INFO] \- javax.servlet:servlet-api:jar:2.5:test
...
The servlet-api artifact has a test scope as expected.
Do you have the servlet-api declared as dependency with a compile scope somewhere? That's the only way I could reproduce.
Update: I reproduced the output with mvn --debug after pasting all dependencies your provided. That said, I don't know how to interpret this output which is printed when the maven-compiler-plugin is executed. Also note that it differs from the dependency:tree:
$ mvn dependency:tree
[INFO] Scanning for projects...
...
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) # Q4098082 ---
[INFO] com.stackoverflow:Q4098082:jar:1.0-SNAPSHOT
[INFO] +- junit:junit:jar:4.7:test
[INFO] +- xom:xom:jar:1.2.5:compile
[INFO] | +- xml-apis:xml-apis:jar:1.3.03:compile
[INFO] | +- xerces:xercesImpl:jar:2.8.0:compile
[INFO] | \- xalan:xalan:jar:2.7.0:compile
[INFO] +- org.mockito:mockito-all:jar:1.8.5:test
[INFO] +- org.apache.commons:commons-io:jar:1.3.2:test
[INFO] +- joda-time:joda-time:jar:1.6.2:compile
[INFO] +- commons-httpclient:commons-httpclient:jar:3.1:compile
[INFO] | +- commons-logging:commons-logging:jar:1.0.4:compile
[INFO] | \- commons-codec:commons-codec:jar:1.2:compile
[INFO] +- com.sun.jersey:jersey-server:jar:1.4:compile
[INFO] | +- com.sun.jersey:jersey-core:jar:1.4:compile
[INFO] | \- asm:asm:jar:3.1:compile
[INFO] +- com.sun.jersey:jersey-client:jar:1.4:test
[INFO] +- com.sun.jersey.jersey-test-framework:jersey-test-framework-grizzly:jar:1.4:test
[INFO] | +- com.sun.jersey.jersey-test-framework:jersey-test-framework-core:jar:1.4:test
[INFO] | | \- org.glassfish:javax.servlet:jar:3.0-b66:test
[INFO] | \- com.sun.grizzly:grizzly-servlet-webserver:jar:1.9.18-i:test
[INFO] | +- com.sun.grizzly:grizzly-http:jar:1.9.18-i:test
[INFO] | | +- com.sun.grizzly:grizzly-framework:jar:1.9.18-i:test
[INFO] | | +- com.sun.grizzly:grizzly-rcm:jar:1.9.18-i:test
[INFO] | | \- com.sun.grizzly:grizzly-portunif:jar:1.9.18-i:test
[INFO] | +- com.sun.grizzly:grizzly-http-servlet:jar:1.9.18-i:test
[INFO] | | \- com.sun.grizzly:grizzly-utils:jar:1.9.18-i:test
[INFO] | \- javax.servlet:servlet-api:jar:2.5:test
[INFO] +- org.hibernate:hibernate-entitymanager:jar:3.5.6-Final:compile
[INFO] | +- org.hibernate:hibernate-core:jar:3.5.6-Final:compile
[INFO] | | +- antlr:antlr:jar:2.7.6:compile
[INFO] | | +- commons-collections:commons-collections:jar:3.1:compile
[INFO] | | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | \- javax.transaction:jta:jar:1.1:compile
[INFO] | +- org.hibernate:hibernate-annotations:jar:3.5.6-Final:compile
[INFO] | | \- org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final:compile
[INFO] | +- cglib:cglib:jar:2.2:compile
[INFO] | +- javassist:javassist:jar:3.9.0.GA:compile
[INFO] | +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.0.Final:compile
[INFO] | \- org.slf4j:slf4j-api:jar:1.5.8:compile
[INFO] +- org.apache.openejb:openejb-ejbd:jar:3.1.3:test
[INFO] | +- org.apache.openejb:javaee-api:jar:5.0-3:test
[INFO] | +- org.apache.openejb:openejb-core:jar:3.1.3:test
[INFO] | | +- log4j:log4j:jar:1.2.12:test
[INFO] | | +- org.apache.openejb:ejb31-api-experimental:jar:3.1.3:test
[INFO] | | +- org.apache.openejb:openejb-api:jar:3.1.3:test
[INFO] | | +- org.apache.openejb:openejb-javaagent:jar:3.1.3:test
[INFO] | | +- org.apache.openejb:openejb-jee:jar:3.1.3:test
[INFO] | | | +- org.codehaus.woodstox:wstx-asl:jar:3.2.0:test
[INFO] | | | | \- stax:stax-api:jar:1.0.1:test
[INFO] | | | \- com.sun.xml.bind:jaxb-impl:jar:2.1.9:test
[INFO] | | +- commons-cli:commons-cli:jar:1.1:test
[INFO] | | +- org.apache.activemq:activemq-ra:jar:5.3.1:test
[INFO] | | +- org.apache.activemq:activemq-core:jar:5.3.1:test
[INFO] | | | +- commons-logging:commons-logging-api:jar:1.1:test
[INFO] | | | +- org.apache.geronimo.specs:geronimo-jms_1.1_spec:jar:1.1.1:test
[INFO] | | | +- org.apache.activemq:activeio-core:jar:3.1.2:test
[INFO] | | | | \- org.apache.geronimo.specs:geronimo-j2ee-management_1.1_spec:jar:1.0.1:test
[INFO] | | | +- org.apache.activemq:kahadb:jar:5.3.1:test
[INFO] | | | +- org.apache.activemq.protobuf:activemq-protobuf:jar:1.0:test
[INFO] | | | +- org.apache.geronimo.specs:geronimo-j2ee-management_1.0_spec:jar:1.0:test
[INFO] | | | \- commons-net:commons-net:jar:2.0:test
[INFO] | | +- org.apache.openjpa:openjpa:jar:1.2.1:test
[INFO] | | | +- net.sourceforge.serp:serp:jar:1.13.1:test
[INFO] | | | +- commons-lang:commons-lang:jar:2.1:test
[INFO] | | | \- commons-pool:commons-pool:jar:1.3:test
[INFO] | | +- org.apache.geronimo.components:geronimo-connector:jar:2.1:test
[INFO] | | +- org.apache.geronimo.components:geronimo-transaction:jar:2.1:test
[INFO] | | +- org.objectweb.howl:howl:jar:1.0.1-1:test
[INFO] | | +- org.apache.geronimo.javamail:geronimo-javamail_1.4_mail:jar:1.2:test
[INFO] | | +- org.apache.xbean:xbean-asm-shaded:jar:3.7:test
[INFO] | | +- org.apache.xbean:xbean-finder-shaded:jar:3.7:test
[INFO] | | +- org.apache.xbean:xbean-reflect:jar:3.7:test
[INFO] | | +- org.apache.xbean:xbean-naming:jar:3.7:test
[INFO] | | +- org.apache.openejb:commons-dbcp-all:jar:1.3-r699049:test
[INFO] | | +- org.codehaus.swizzle:swizzle-stream:jar:1.0.1:test
[INFO] | | +- wsdl4j:wsdl4j:jar:1.6.1:test
[INFO] | | \- quartz:quartz:jar:1.5.2:test
[INFO] | +- org.apache.openejb:openejb-server:jar:3.1.3:test
[INFO] | +- org.apache.openejb:openejb-loader:jar:3.1.3:test
[INFO] | \- org.apache.openejb:openejb-client:jar:3.1.3:test
[INFO] +- org.slf4j:slf4j-jdk14:jar:1.4.2:compile
[INFO] +- hsqldb:hsqldb:jar:1.8.0.10:test
[INFO] \- javax:javaee-api:jar:6.0:provided
...
The above is my reference to analyze the scope of dependencies and it looks correct. I don't know why the maven-compiler-plugin outputs a different result in debug mode, I don't know if this is expected, I never pay attention to the output.
Additional remark, the javax.servlet:servlet-api:jar:2.5 is on the (huge) test classpath during the compiler:testCompile execution.
So while I don't have a full explanation, I can't spot any side effect.
This is what I've done to solve the problem:
[...]
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
[...]

Categories