Class path contains multiple SLF4J bindings, log back-classic and log4j - java

getting below error when i try to run unit test in my java project:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/me/.m2/repository/org/slf4j/slf4j-log4j12/1.5.8/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/me/.m2/repository/ch/qos/logback/logback-classic/1.0.6/logback-classic-1.0.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See slf4j.org/… for an explanation.
My pom.xml does have these dependencies:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${org.slf4j-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>${org.slf4j-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${org.slf4j-version}</version>
</dependency>
My mvn dependency tree:
[INFO] +- junit:junit:jar:4.8.1:test
[INFO] +- storm:storm:jar:0.9.0.1:provided
[INFO] | +- storm:storm-console-logging:jar:0.9.0.1:provided
[INFO] | +- storm:storm-core:jar:0.9.0.1:provided
[INFO] | | +- org.clojure:clojure:jar:1.4.0:provided
[INFO] | | +- commons-io:commons-io:jar:1.4:provided
[INFO] | | +- org.apache.commons:commons-exec:jar:1.1:provided
[INFO] | | +- storm:libthrift7:jar:0.7.0-2:provided
[INFO] | | | +- commons-lang:commons-lang:jar:2.5:provided
[INFO] | | | \- javax.servlet:servlet-api:jar:2.5:provided
[INFO] | | +- clj-time:clj-time:jar:0.4.1:provided
[INFO] | | | \- joda-time:joda-time:jar:2.0:provided
[INFO] | | +- com.netflix.curator:curator-framework:jar:1.0.1:provided
[INFO] | | | +- com.netflix.curator:curator-client:jar:1.0.1:provided
[INFO] | | | \- org.apache.zookeeper:zookeeper:jar:3.3.3:provided
[INFO] | | | \- jline:jline:jar:0.9.94:provided
[INFO] | | +- backtype:jzmq:jar:2.1.0:provided
[INFO] | | +- com.googlecode.json-simple:json-simple:jar:1.1:provided
[INFO] | | +- compojure:compojure:jar:1.1.3:provided
[INFO] | | | +- org.clojure:core.incubator:jar:0.1.0:provided
[INFO] | | | +- org.clojure:tools.macro:jar:0.1.0:provided
[INFO] | | | +- clout:clout:jar:1.0.1:provided
[INFO] | | | \- ring:ring-core:jar:1.1.5:provided
[INFO] | | | \- commons-fileupload:commons-fileupload:jar:1.2.1:provided
[INFO] | | +- hiccup:hiccup:jar:0.3.6:provided
[INFO] | | +- ring:ring-devel:jar:0.3.11:provided
[INFO] | | | \- clj-stacktrace:clj-stacktrace:jar:0.2.2:provided
[INFO] | | +- ring:ring-jetty-adapter:jar:0.3.11:provided
[INFO] | | | +- ring:ring-servlet:jar:0.3.11:provided
[INFO] | | | +- org.mortbay.jetty:jetty:jar:6.1.26:provided
[INFO] | | | | \- org.mortbay.jetty:servlet-api:jar:2.5-20081211:provided
[INFO] | | | \- org.mortbay.jetty:jetty-util:jar:6.1.26:provided
[INFO] | | +- org.clojure:tools.logging:jar:0.2.3:provided
[INFO] | | +- org.clojure:math.numeric-tower:jar:0.0.1:provided
[INFO] | | +- storm:carbonite:jar:1.5.0:provided
[INFO] | | | \- com.esotericsoftware.kryo:kryo:jar:2.17:provided
[INFO] | | | +- com.esotericsoftware.reflectasm:reflectasm:jar:shaded:1.07:provided
[INFO] | | | | \- org.ow2.asm:asm:jar:4.0:provided
[INFO] | | | +- com.esotericsoftware.minlog:minlog:jar:1.2:provided
[INFO] | | | \- org.objenesis:objenesis:jar:1.2:provided
[INFO] | | +- org.yaml:snakeyaml:jar:1.11:provided
[INFO] | | +- org.apache.httpcomponents:httpclient:jar:4.1.1:provided
[INFO] | | | \- org.apache.httpcomponents:httpcore:jar:4.1:provided
[INFO] | | +- storm:tools.cli:jar:0.2.2:provided
[INFO] | | +- com.googlecode.disruptor:disruptor:jar:2.10.1:provided
[INFO] | | +- storm:jgrapht:jar:0.8.3:provided
[INFO] | | +- com.google.guava:guava:jar:13.0:provided
[INFO] | | \- ch.qos.logback:logback-classic:jar:1.0.6:provided
[INFO] | | \- ch.qos.logback:logback-core:jar:1.0.6:provided
[INFO] | \- storm:storm-netty:jar:0.9.0.1:provided
[INFO] | \- io.netty:netty:jar:3.6.3.Final:provided
[INFO] +- com.rabbitmq:amqp-client:jar:3.2.2:compile
[INFO] +- org.mongodb:mongo-java-driver:jar:2.11.3:compile
[INFO] +- org.springframework.data:spring-data-mongodb:jar:1.3.3.RELEASE:compile
[INFO] | +- org.springframework:spring-tx:jar:3.1.4.RELEASE:compile
[INFO] | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | +- org.springframework:spring-beans:jar:3.1.4.RELEASE:compile
[INFO] | +- org.springframework:spring-expression:jar:3.1.4.RELEASE:compile
[INFO] | \- org.springframework.data:spring-data-commons:jar:1.6.3.RELEASE:compile
[INFO] +- org.springframework:spring-core:jar:3.2.3.RELEASE:compile
[INFO] +- org.springframework:spring-context:jar:3.2.3.RELEASE:compile
[INFO] | \- org.springframework:spring-aop:jar:3.2.3.RELEASE:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.6:compile
[INFO] +- org.slf4j:log4j-over-slf4j:jar:1.7.6:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.7.6:compile
[INFO] +- org.mockito:mockito-all:jar:1.9.0:test
[INFO] +- org.easytesting:fest-assert-core:jar:2.0M8:test
[INFO] | \- org.easytesting:fest-util:jar:1.2.3:test
[INFO] +- com.google.code.gson:gson:jar:2.2.4:compile
[INFO] \- commons-codec:commons-codec:jar:1.8:compile
Edit 1:
After removing log4j dependency tree
+- junit:junit:jar:4.8.1:test
[INFO] +- storm:storm:jar:0.9.0.1:provided
[INFO] | +- storm:storm-console-logging:jar:0.9.0.1:provided
[INFO] | +- storm:storm-core:jar:0.9.0.1:provided
[INFO] | | +- org.clojure:clojure:jar:1.4.0:provided
[INFO] | | +- commons-io:commons-io:jar:1.4:provided
[INFO] | | +- org.apache.commons:commons-exec:jar:1.1:provided
[INFO] | | +- storm:libthrift7:jar:0.7.0-2:provided
[INFO] | | | +- commons-lang:commons-lang:jar:2.5:provided
[INFO] | | | \- javax.servlet:servlet-api:jar:2.5:provided
[INFO] | | +- clj-time:clj-time:jar:0.4.1:provided
[INFO] | | | \- joda-time:joda-time:jar:2.0:provided
[INFO] | | +- com.netflix.curator:curator-framework:jar:1.0.1:provided
[INFO] | | | +- com.netflix.curator:curator-client:jar:1.0.1:provided
[INFO] | | | \- org.apache.zookeeper:zookeeper:jar:3.3.3:provided
[INFO] | | | \- jline:jline:jar:0.9.94:provided
[INFO] | | +- backtype:jzmq:jar:2.1.0:provided
[INFO] | | +- com.googlecode.json-simple:json-simple:jar:1.1:provided
[INFO] | | +- compojure:compojure:jar:1.1.3:provided
[INFO] | | | +- org.clojure:core.incubator:jar:0.1.0:provided
[INFO] | | | +- org.clojure:tools.macro:jar:0.1.0:provided
[INFO] | | | +- clout:clout:jar:1.0.1:provided
[INFO] | | | \- ring:ring-core:jar:1.1.5:provided
[INFO] | | | \- commons-fileupload:commons-fileupload:jar:1.2.1:provided
[INFO] | | +- hiccup:hiccup:jar:0.3.6:provided
[INFO] | | +- ring:ring-devel:jar:0.3.11:provided
[INFO] | | | \- clj-stacktrace:clj-stacktrace:jar:0.2.2:provided
[INFO] | | +- ring:ring-jetty-adapter:jar:0.3.11:provided
[INFO] | | | +- ring:ring-servlet:jar:0.3.11:provided
[INFO] | | | +- org.mortbay.jetty:jetty:jar:6.1.26:provided
[INFO] | | | | \- org.mortbay.jetty:servlet-api:jar:2.5-20081211:provided
[INFO] | | | \- org.mortbay.jetty:jetty-util:jar:6.1.26:provided
[INFO] | | +- org.clojure:tools.logging:jar:0.2.3:provided
[INFO] | | +- org.clojure:math.numeric-tower:jar:0.0.1:provided
[INFO] | | +- storm:carbonite:jar:1.5.0:provided
[INFO] | | | \- com.esotericsoftware.kryo:kryo:jar:2.17:provided
[INFO] | | | +- com.esotericsoftware.reflectasm:reflectasm:jar:shaded:1.07:provided
[INFO] | | | | \- org.ow2.asm:asm:jar:4.0:provided
[INFO] | | | +- com.esotericsoftware.minlog:minlog:jar:1.2:provided
[INFO] | | | \- org.objenesis:objenesis:jar:1.2:provided
[INFO] | | +- org.yaml:snakeyaml:jar:1.11:provided
[INFO] | | +- org.apache.httpcomponents:httpclient:jar:4.1.1:provided
[INFO] | | | \- org.apache.httpcomponents:httpcore:jar:4.1:provided
[INFO] | | +- storm:tools.cli:jar:0.2.2:provided
[INFO] | | +- com.googlecode.disruptor:disruptor:jar:2.10.1:provided
[INFO] | | +- storm:jgrapht:jar:0.8.3:provided
[INFO] | | +- com.google.guava:guava:jar:13.0:provided
[INFO] | | +- ch.qos.logback:logback-classic:jar:1.0.6:provided
[INFO] | | | \- ch.qos.logback:logback-core:jar:1.0.6:provided
[INFO] | | \- org.slf4j:log4j-over-slf4j:jar:1.6.6:provided
[INFO] | \- storm:storm-netty:jar:0.9.0.1:provided
[INFO] | \- io.netty:netty:jar:3.6.3.Final:provided
[INFO] +- com.rabbitmq:amqp-client:jar:3.2.2:compile
[INFO] +- org.mongodb:mongo-java-driver:jar:2.11.3:compile
[INFO] +- org.springframework.data:spring-data-mongodb:jar:1.3.3.RELEASE:compile
[INFO] | +- org.springframework:spring-tx:jar:3.1.4.RELEASE:compile
[INFO] | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | +- org.springframework:spring-beans:jar:3.1.4.RELEASE:compile
[INFO] | +- org.springframework:spring-expression:jar:3.1.4.RELEASE:compile
[INFO] | +- org.springframework.data:spring-data-commons:jar:1.6.3.RELEASE:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.1:compile
[INFO] | \- org.slf4j:jcl-over-slf4j:jar:1.7.1:runtime
[INFO] +- org.springframework:spring-core:jar:3.2.3.RELEASE:compile
[INFO] +- org.springframework:spring-context:jar:3.2.3.RELEASE:compile
[INFO] | \- org.springframework:spring-aop:jar:3.2.3.RELEASE:compile
[INFO] +- org.mockito:mockito-all:jar:1.9.0:test
[INFO] +- org.easytesting:fest-assert-core:jar:2.0M8:test
[INFO] | \- org.easytesting:fest-util:jar:1.2.3:test
[INFO] +- com.google.code.gson:gson:jar:2.2.4:compile
[INFO] \- commons-codec:commons-codec:jar:1.8:compile
And pom.xml
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.version>3.2.3.RELEASE</spring.version>
</properties>
<repositories>
<repository>
<id>clojars.org</id>
<url>http://clojars.org/repo</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<!-- Storm library -->
<dependency>
<groupId>storm</groupId>
<artifactId>storm</artifactId>
<version>0.9.0.1</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- RabbitMQ Driver -->
<dependency>
<groupId>com.rabbitmq</groupId>
<artifactId>amqp-client</artifactId>
<version>3.2.2</version>
</dependency>
<!-- mongodb java driver -->
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>2.11.3</version>
</dependency>
<!-- Spring data mongodb -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>1.3.3.RELEASE</version>
</dependency>
<!-- Spring framework -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- Log4j -->
<!-- Unit Testing Tools -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert-core</artifactId>
<version>2.0M8</version>
<scope>test</scope>
</dependency>
<!-- dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId>
<version>6.8</version> <scope>test</scope> </dependency> -->
<!-- Google JSON serialization -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
</dependency>
<!-- Encoder -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.8</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>local</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<build.profile.id>local</build.profile.id>
</properties>
</profile>
<profile>
<id>dev</id>
<properties>
<build.profile.id>dev</build.profile.id>
</properties>
</profile>
<profile>
<id>stage</id>
<properties>
<build.profile.id>stage</build.profile.id>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<build.profile.id>prod</build.profile.id>
</properties>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>clean</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<delete file="src/main/resources/application.properties" />
<copy file="profiles/application.${build.profile.id}.properties"
tofile="src/main/resources/application.properties" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.madisonlogic.conscriptor.topology.ConscriptorTopology</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
<!-- Used to Correct slf4j errors with log4j -->
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<id>enforce-banned-dependencies</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<bannedDependencies>
<searchTransitive>true</searchTransitive>
<excludes>
<exclude>commons-logging</exclude>
<exclude>org.slf4j:1.5*</exclude>
<exclude>org.slf4j:1.6*</exclude>
<exclude>org.springframework:2.*</exclude>
<exclude>org.springframework:3.0.*</exclude>
</excludes>
</bannedDependencies>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Edit 2 Updated pom.xml
<!-- Log4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${org.slf4j-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>${org.slf4j-version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.8</version>
</exclusion>
</exclusions>
</dependency>

Found the problem. It was in /.classpath. I compared the class path file with a working project and deleted any additional references. And it worked.
The bad class path had alot of jar specific references like below
<classpathentry kind="var" path="M2_REPO...
Below is a diff b/t bad class path file on left, and correct class path file on right.
I have no idea on how those class path entry got in.

Related

How to resolve TLS version issue with MongoDB cluster in java Spring Boot web project?

I am building a Spring Boot web application that uses MongoDB as a data store. I am communicating directly to the live cluster (not a local cluster) using a MongoDB URI. I am using Java 11 (AdoptOpenJDK 11.0.5).
On application startup, my application is unable to communicate to MongoDB cluster due to what looks like a TLS/SSL error:
com.mongodb.MongoSocketWriteException: Exception sending message
at com.mongodb.internal.connection.InternalStreamConnection.translateWriteException(InternalStreamConnection.java:551) ~[mongodb-driver-core-3.11.2.jar:na]
at com.mongodb.internal.connection.InternalStreamConnection.sendMessage(InternalStreamConnection.java:433) ~[mongodb-driver-core-3.11.2.jar:na]
at com.mongodb.internal.connection.InternalStreamConnection.sendCommandMessage(InternalStreamConnection.java:273) ~[mongodb-driver-core-3.11.2.jar:na]
at com.mongodb.internal.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:257) ~[mongodb-driver-core-3.11.2.jar:na]
at com.mongodb.internal.connection.CommandHelper.sendAndReceive(CommandHelper.java:83) ~[mongodb-driver-core-3.11.2.jar:na]
at com.mongodb.internal.connection.CommandHelper.executeCommand(CommandHelper.java:33) ~[mongodb-driver-core-3.11.2.jar:na]
at com.mongodb.internal.connection.InternalStreamConnectionInitializer.initializeConnectionDescription(InternalStreamConnectionInitializer.java:105) ~[mongodb-driver-core-3.11.2.jar:na]
at com.mongodb.internal.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:62) ~[mongodb-driver-core-3.11.2.jar:na]
at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:129) ~[mongodb-driver-core-3.11.2.jar:na]
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:117) ~[mongodb-driver-core-3.11.2.jar:na]
at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
Caused by: javax.net.ssl.SSLHandshakeException: extension (5) should not be presented in certificate_request
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:131) ~[na:na]
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:117) ~[na:na]
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:307) ~[na:na]
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:263) ~[na:na
According to sources on MongoDB's driver website, they explain that this is a known issue with Java 11. I believe the issue to be this bug filed with OpenJDK, where it notes an issue with the implementation of SSL connections for TLS 1.3. This provides me with two options:
Upgrade to a version of Java that has fixed this.
Set the jdk.tls.client.protocols system property value to TLSv1.2.
I have been able to verify that this issue does not resolve when upgrading to Java 15; the error remains identical. I double checked that I was actually using Java 15 before cleaning and rerunning the application with mvn spring-boot:run.
That leaves me with the second option, which brings me to my question:
How do I correctly set jdk.tls.client.protocols system property when building with Maven?
I've tried running the application with mvn spring-boot:run -Djdk.tls.client.protocols=TLSv1.2 but that still gives the same error as before.
I've provided my pom.xml below; I have zero files/code pertaining to MongoDB auto setup in the project, which you can examine in it's entirety here.
For clarification, I am engaging the localhost build profile.
pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.5.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>edu.ucsb</groupId>
<artifactId>mapache-search</artifactId>
<version>0.1.0</version>
<name>Mapache Search</name>
<description>Mapache Search (CMPSC 156 class project)</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
<exclusion>
<groupId>com.vaadin.external.google</groupId>
<artifactId>android-json</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.11</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.json/json -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20190722</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.auth0/java-jwt -->
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.10.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.security.oauth.boot/spring-security-oauth2-autoconfigure -->
<dependency>
<groupId>org.springframework.security.oauth.boot</groupId>
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
<version>2.2.5.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.jaxb/jaxb-runtime -->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.4.0-b180830.0438</version>
</dependency>
<!-- jpa, crud repository -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- add mongodb repositories -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
<version>2.2.5.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.codebox/javabean-tester -->
<dependency>
<groupId>net.codebox</groupId>
<artifactId>javabean-tester</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.6</version>
<configuration>
<workingDirectory>javascript</workingDirectory>
<installDirectory>target</installDirectory>
</configuration>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>v12.12.0</nodeVersion>
<npmVersion>6.14.3</npmVersion>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>ci</arguments>
</configuration>
</execution>
<execution>
<id>npm run build</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>run build</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>generate-resources</phase>
<configuration>
<target>
<copy todir="${project.build.directory}/classes/public">
<fileset dir="${project.basedir}/javascript/build" />
</copy>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
</plugin>
<!-- Fix the error
Exit code: 1 - javadoc: error - The code being documented uses modules
but the packages defined in http://docs.oracle.com/javase/8/docs/api/
are in the unnamed module. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<source>11</source>
</configuration>
<version>3.1.0</version>
</plugin>
<!-- Make jar file executable -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<archive>
<manifest>
<!-- full package name of class with the main you want to run -->
<mainClass>edu.ucsb.mapache.DemoApplication</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<!-- Test case coverage report -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.8.2</version>
</plugin>
</plugins>
</build>
<!-- (28) <profiles/> -->
<profiles>
<profile>
<id>localhost</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<resources>
<resource>
<directory>src/main/config/localhost</directory>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/classes</outputDirectory>
<resources>
<resource>
<directory>.</directory>
<include>secrets-localhost.properties</include>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
<properties>
<environment-properties />
</properties>
</profile>
<profile>
<id>test</id>
<activation>
<property>
<name>env.TEST_PROPERTIES</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
<properties>
<environment-properties>${env.TEST_PROPERTIES}</environment-properties>
</properties>
</profile>
<profile>
<id>heroku</id>
<activation>
<property>
<name>env.HEROKU_PROPERTIES</name>
</property>
</activation>
<build>
<resources>
<resource>
<directory>src/main/config/heroku</directory>
</resource>
</resources>
</build>
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
</dependencies>
<properties>
<environment-properties>${env.HEROKU_PROPERTIES}</environment-properties>
</properties>
</profile>
</profiles>
</project>
I have also included the output of mvn dependency:tree below:
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< edu.ucsb:mapache-search >-----------------------
[INFO] Building Mapache Search 0.1.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:3.1.1:tree (default-cli) # mapache-search ---
[INFO] edu.ucsb:mapache-search:jar:0.1.0
[INFO] +- org.springframework.boot:spring-boot-starter-security:jar:2.2.5.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:2.2.5.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:2.2.5.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.30:compile
[INFO] | | +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] | | \- org.yaml:snakeyaml:jar:1.25:runtime
[INFO] | +- org.springframework:spring-aop:jar:5.2.4.RELEASE:compile
[INFO] | | \- org.springframework:spring-beans:jar:5.2.4.RELEASE:compile
[INFO] | +- org.springframework.security:spring-security-config:jar:5.2.2.RELEASE:compile
[INFO] | | \- org.springframework:spring-context:jar:5.2.4.RELEASE:compile
[INFO] | \- org.springframework.security:spring-security-web:jar:5.2.2.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:5.2.4.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.2.5.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-json:jar:2.2.5.RELEASE:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.10.2:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.10.2:compile
[INFO] | | \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.10.2:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.2.5.RELEASE:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.31:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.31:compile
[INFO] | | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.31:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-validation:jar:2.2.5.RELEASE:compile
[INFO] | | +- jakarta.validation:jakarta.validation-api:jar:2.0.2:compile
[INFO] | | \- org.hibernate.validator:hibernate-validator:jar:6.0.18.Final:compile
[INFO] | +- org.springframework:spring-web:jar:5.2.4.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:5.2.4.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.2.5.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test:jar:2.2.5.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.2.5.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.30:compile
[INFO] | +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.2:test
[INFO] | +- org.junit.jupiter:junit-jupiter:jar:5.5.2:test
[INFO] | | +- org.junit.jupiter:junit-jupiter-api:jar:5.5.2:test
[INFO] | | | +- org.apiguardian:apiguardian-api:jar:1.1.0:test
[INFO] | | | +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO] | | | \- org.junit.platform:junit-platform-commons:jar:1.5.2:test
[INFO] | | +- org.junit.jupiter:junit-jupiter-params:jar:5.5.2:test
[INFO] | | \- org.junit.jupiter:junit-jupiter-engine:jar:5.5.2:test
[INFO] | | \- org.junit.platform:junit-platform-engine:jar:1.5.2:test
[INFO] | +- org.mockito:mockito-junit-jupiter:jar:3.1.0:test
[INFO] | +- org.assertj:assertj-core:jar:3.13.2:test
[INFO] | +- org.hamcrest:hamcrest:jar:2.1:compile
[INFO] | +- org.mockito:mockito-core:jar:3.1.0:test
[INFO] | | +- net.bytebuddy:byte-buddy:jar:1.10.8:compile
[INFO] | | +- net.bytebuddy:byte-buddy-agent:jar:1.10.8:test
[INFO] | | \- org.objenesis:objenesis:jar:2.6:test
[INFO] | +- org.skyscreamer:jsonassert:jar:1.5.0:test
[INFO] | +- org.springframework:spring-core:jar:5.2.4.RELEASE:compile
[INFO] | | \- org.springframework:spring-jcl:jar:5.2.4.RELEASE:compile
[INFO] | +- org.springframework:spring-test:jar:5.2.4.RELEASE:test
[INFO] | \- org.xmlunit:xmlunit-core:jar:2.6.3:test
[INFO] +- org.springframework.security:spring-security-test:jar:5.2.2.RELEASE:test
[INFO] | \- org.springframework.security:spring-security-core:jar:5.2.2.RELEASE:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.11:compile
[INFO] +- org.json:json:jar:20190722:compile
[INFO] +- com.auth0:java-jwt:jar:3.10.1:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.10.2:compile
[INFO] | | \- com.fasterxml.jackson.core:jackson-core:jar:2.10.2:compile
[INFO] | \- commons-codec:commons-codec:jar:1.13:compile
[INFO] +- org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:jar:2.2.5.RELEASE:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.10.2:compile
[INFO] | +- javax.xml.bind:jaxb-api:jar:2.3.1:compile
[INFO] | +- org.springframework.boot:spring-boot:jar:2.2.5.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-autoconfigure:jar:2.2.5.RELEASE:compile
[INFO] | +- org.springframework.security.oauth:spring-security-oauth2:jar:2.3.8.RELEASE:compile
[INFO] | | \- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile
[INFO] | | \- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile
[INFO] | \- org.springframework.security:spring-security-jwt:jar:1.0.11.RELEASE:compile
[INFO] | \- org.bouncycastle:bcpkix-jdk15on:jar:1.64:compile
[INFO] | \- org.bouncycastle:bcprov-jdk15on:jar:1.64:compile
[INFO] +- org.glassfish.jaxb:jaxb-runtime:jar:2.4.0-b180830.0438: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] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:2.2.5.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:2.2.5.RELEASE:compile
[INFO] | | \- org.aspectj:aspectjweaver:jar:1.9.5:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.2.5.RELEASE:compile
[INFO] | | +- com.zaxxer:HikariCP:jar:3.4.2:compile
[INFO] | | \- org.springframework:spring-jdbc:jar:5.2.4.RELEASE:compile
[INFO] | +- jakarta.activation:jakarta.activation-api:jar:1.2.2:compile
[INFO] | +- jakarta.persistence:jakarta.persistence-api:jar:2.2.3:compile
[INFO] | +- jakarta.transaction:jakarta.transaction-api:jar:1.3.3:compile
[INFO] | +- org.hibernate:hibernate-core:jar:5.4.12.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.4.1.Final:compile
[INFO] | | +- org.javassist:javassist:jar:3.24.0-GA:compile
[INFO] | | +- antlr:antlr:jar:2.7.7:compile
[INFO] | | +- org.jboss:jandex:jar:2.1.1.Final:compile
[INFO] | | +- com.fasterxml:classmate:jar:1.5.1:compile
[INFO] | | +- org.dom4j:dom4j:jar:2.1.1:compile
[INFO] | | \- org.hibernate.common:hibernate-commons-annotations:jar:5.1.0.Final:compile
[INFO] | +- org.springframework.data:spring-data-jpa:jar:2.2.5.RELEASE:compile
[INFO] | | +- org.springframework.data:spring-data-commons:jar:2.2.5.RELEASE:compile
[INFO] | | +- org.springframework:spring-orm:jar:5.2.4.RELEASE:compile
[INFO] | | \- org.springframework:spring-tx:jar:5.2.4.RELEASE:compile
[INFO] | \- org.springframework:spring-aspects:jar:5.2.4.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-mongodb:jar:2.2.5.RELEASE:compile
[INFO] | +- org.mongodb:mongodb-driver:jar:3.11.2:compile
[INFO] | | +- org.mongodb:bson:jar:3.11.2:compile
[INFO] | | \- org.mongodb:mongodb-driver-core:jar:3.11.2:compile
[INFO] | \- org.springframework.data:spring-data-mongodb:jar:2.2.5.RELEASE:compile
[INFO] +- net.codebox:javabean-tester:jar:1.0.0:compile
[INFO] | \- junit:junit:jar:4.12:compile
[INFO] | \- org.hamcrest:hamcrest-core:jar:2.1:compile
[INFO] \- com.h2database:h2:jar:1.4.200:runtime
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.022 s
[INFO] Finished at: 2020-12-10T12:28:18-08:00
[INFO] ------------------------------------------------------------------------
Here's how you pass that variable correctly (for Spring Boot 2.X.X):
mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Djdk.tls.client.protocols=TLSv1.2"

java.lang.NoSuchMethodError when connecting to Firebase from Java

I'm trying to connect my Java web project to Firebase, so I'll be able to store my data in Firestore. I'm using Java Admin SDK, following official guide: FirebaseAdminSDK. Sadly, I'm getting exceptions when FirebaseAp is being initialized:
java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;)V
at com.google.firebase.FirebaseApp.checkNotDeleted(FirebaseApp.java:352)
at com.google.firebase.FirebaseApp.getOptions(FirebaseApp.java:267)
at com.google.firebase.FirebaseApp$TokenRefresher.<init>(FirebaseApp.java:434)
at com.google.firebase.FirebaseApp$TokenRefresher$Factory.create(FirebaseApp.java:535)
at com.google.firebase.FirebaseApp.<init>(FirebaseApp.java:113)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:201)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:188)
Now, I read here and there, that it's problem with guava project and it is recommended to use different versions of guava library. I tried all versions starting from 18.
Then, I read that it can be caused by multiple guava libraries referenced by different libraries in my classpath in defferent versions fighting each other. So, I checked maven dependency tree to see if there are multiple dependencies on guava. Nope.
Then, I unpacked .WAR file to see what exact jars are being deployed to glassfish with my app. Only one guava jar is there (the one pointed by my pom.xml file).
To be honest, I've run out of ideas. Please help. You can see pom.xml and generated maven dependency tree appended below.
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.greenstudio</groupId>
<artifactId>trekking-project</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<name>trekking-project</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
<version>5.6.0</version>
<exclusions>
<exclusion>
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>21.0</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.9</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.5.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
<version>2.5.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.3.3</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.6</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>5.3</version>
</dependency>
<dependency>
<groupId>primefaces.blacktie</groupId>
<artifactId>primefaces.blacktie</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>bootstrap</groupId>
<artifactId>bootstrap</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons.validator.routines.EmailValidatororg.apache.commons.validator.routines.EmailValidator</groupId>
<artifactId>org.apache.commons.validator.routines.EmailValidator</artifactId>
<version>1.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>7.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
dependency tree
[INFO] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/2.8/maven-dependency-plugin-2.8.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/2.8/maven-dependency-plugin-2.8.pom (11 kB at 18 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/2.8/maven-dependency-plugin-2.8.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/2.8/maven-dependency-plugin-2.8.jar (153 kB at 709 kB/s)
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building trekking-project 1.0
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for primefaces:primefaces:jar:5.3 is missing, no dependency information available
[WARNING] The POM for primefaces.blacktie:primefaces.blacktie:jar:1.0 is missing, no dependency information available
[WARNING] The POM for bootstrap:bootstrap:jar:1.0 is missing, no dependency information available
[WARNING] The POM for org.apache.commons.validator.routines.EmailValidatororg.apache.commons.validator.routines.EmailValidator:org.apache.commons.validator.routines.EmailValidator:jar:1.0 is missing, no dependency information available
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # trekking-project ---
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/2.3/plexus-archiver-2.3.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/2.3/plexus-archiver-2.3.pom (3.4 kB at 38 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-dependency-analyzer/1.4/maven-dependency-analyzer-1.4.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-dependency-analyzer/1.4/maven-dependency-analyzer-1.4.pom (5.2 kB at 58 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/2.3/plexus-archiver-2.3.jar
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-dependency-analyzer/1.4/maven-dependency-analyzer-1.4.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-dependency-analyzer/1.4/maven-dependency-analyzer-1.4.jar (27 kB at 105 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/2.3/plexus-archiver-2.3.jar (186 kB at 704 kB/s)
[INFO] com.greenstudio:trekking-project:war:1.0
[INFO] +- com.google.firebase:firebase-admin:jar:5.6.0:compile
[INFO] | +- com.google.api-client:google-api-client:jar:1.22.0:compile
[INFO] | | +- com.google.oauth-client:google-oauth-client:jar:1.22.0:compile
[INFO] | | \- com.google.http-client:google-http-client-jackson2:jar:1.22.0:compile
[INFO] | | \- com.fasterxml.jackson.core:jackson-core:jar:2.1.3:compile
[INFO] | +- com.google.api-client:google-api-client-gson:jar:1.22.0:compile
[INFO] | | \- com.google.http-client:google-http-client-gson:jar:1.22.0:compile
[INFO] | | \- com.google.code.gson:gson:jar:2.1:compile
[INFO] | +- com.google.http-client:google-http-client:jar:1.22.0:compile
[INFO] | | \- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] | +- com.google.api:api-common:jar:1.2.0:compile
[INFO] | +- com.google.auth:google-auth-library-oauth2-http:jar:0.8.0:compile
[INFO] | | \- com.google.auth:google-auth-library-credentials:jar:0.8.0:compile
[INFO] | +- com.google.cloud:google-cloud-storage:jar:1.7.0:compile
[INFO] | | +- com.google.cloud:google-cloud-core:jar:1.7.0:compile
[INFO] | | | +- com.google.api:gax:jar:1.8.1:compile
[INFO] | | | +- com.google.protobuf:protobuf-java-util:jar:3.3.1:compile
[INFO] | | | +- com.google.api.grpc:proto-google-common-protos:jar:0.1.20:compile
[INFO] | | | \- com.google.api.grpc:proto-google-iam-v1:jar:0.1.20:compile
[INFO] | | +- com.google.cloud:google-cloud-core-http:jar:1.7.0:compile
[INFO] | | | +- com.google.http-client:google-http-client-appengine:jar:1.22.0:compile
[INFO] | | | \- com.google.http-client:google-http-client-jackson:jar:1.22.0:compile
[INFO] | | | \- org.codehaus.jackson:jackson-core-asl:jar:1.9.11:compile
[INFO] | | \- com.google.apis:google-api-services-storage:jar:v1-rev108-1.22.0:compile
[INFO] | +- com.google.cloud:google-cloud-firestore:jar:0.25.0-beta:compile
[INFO] | | +- io.netty:netty-tcnative-boringssl-static:jar:2.0.3.Final:compile
[INFO] | | +- com.google.cloud:google-cloud-core-grpc:jar:1.7.0:compile
[INFO] | | | +- com.google.protobuf:protobuf-java:jar:3.3.1:compile
[INFO] | | | +- io.grpc:grpc-protobuf:jar:1.6.1:compile
[INFO] | | | | \- io.grpc:grpc-protobuf-lite:jar:1.6.1:compile
[INFO] | | | \- io.grpc:grpc-context:jar:1.6.1:compile
[INFO] | | +- com.google.api:gax-grpc:jar:0.25.1:compile
[INFO] | | | +- com.google.auto.value:auto-value:jar:1.2:compile
[INFO] | | | \- org.threeten:threetenbp:jar:1.3.3:compile
[INFO] | | +- com.google.api.grpc:proto-google-cloud-firestore-v1beta1:jar:0.1.20:compile
[INFO] | | +- io.grpc:grpc-netty:jar:1.6.1:compile
[INFO] | | | +- io.grpc:grpc-core:jar:1.6.1:compile (version selected from constraint [1.6.1,1.6.1])
[INFO] | | | | +- com.google.errorprone:error_prone_annotations:jar:2.0.19:compile
[INFO] | | | | +- com.google.instrumentation:instrumentation-api:jar:0.4.3:compile
[INFO] | | | | \- io.opencensus:opencensus-api:jar:0.5.1:compile
[INFO] | | | +- io.netty:netty-codec-http2:jar:4.1.14.Final:compile (version selected from constraint [4.1.14.Final,4.1.14.Final])
[INFO] | | | \- io.netty:netty-handler-proxy:jar:4.1.14.Final:compile
[INFO] | | | \- io.netty:netty-codec-socks:jar:4.1.14.Final:compile
[INFO] | | +- io.grpc:grpc-stub:jar:1.6.1:compile
[INFO] | | \- io.grpc:grpc-auth:jar:1.6.1:compile
[INFO] | +- org.json:json:jar:20160810:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] | +- io.netty:netty-codec-http:jar:4.1.14.Final:compile
[INFO] | | \- io.netty:netty-codec:jar:4.1.14.Final:compile
[INFO] | +- io.netty:netty-handler:jar:4.1.14.Final:compile
[INFO] | | \- io.netty:netty-buffer:jar:4.1.14.Final:compile
[INFO] | | \- io.netty:netty-common:jar:4.1.14.Final:compile
[INFO] | \- io.netty:netty-transport:jar:4.1.14.Final:compile
[INFO] | \- io.netty:netty-resolver:jar:4.1.14.Final:compile
[INFO] +- com.google.guava:guava:jar:21.0:compile
[INFO] +- joda-time:joda-time:jar:2.9.9:compile
[INFO] +- org.eclipse.persistence:eclipselink:jar:2.5.2:provided
[INFO] | +- org.eclipse.persistence:javax.persistence:jar:2.1.0:provided
[INFO] | \- org.eclipse.persistence:commonj.sdo:jar:2.1.1:provided
[INFO] +- org.eclipse.persistence:org.eclipse.persistence.jpa.modelgen.processor:jar:2.5.2:provided
[INFO] | +- org.eclipse.persistence:org.eclipse.persistence.core:jar:2.5.2:provided
[INFO] | | \- org.eclipse.persistence:org.eclipse.persistence.asm:jar:2.5.2:provided
[INFO] | \- org.eclipse.persistence:org.eclipse.persistence.jpa:jar:2.5.2:provided
[INFO] | +- org.eclipse.persistence:org.eclipse.persistence.antlr:jar:2.5.2:provided
[INFO] | \- org.eclipse.persistence:org.eclipse.persistence.jpa.jpql:jar:2.5.2:provided
[INFO] +- org.apache.httpcomponents:httpcore:jar:4.3.3:compile
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.3.6:compile
[INFO] | +- commons-logging:commons-logging:jar:1.1.3:compile
[INFO] | \- commons-codec:commons-codec:jar:1.6:compile
[INFO] +- primefaces:primefaces:jar:5.3:compile
[INFO] +- primefaces.blacktie:primefaces.blacktie:jar:1.0:compile
[INFO] +- bootstrap:bootstrap:jar:1.0:compile
[INFO] +- org.apache.commons.validator.routines.EmailValidatororg.apache.commons.validator.routines.EmailValidator:org.apache.commons.validator.routines.EmailValidator:jar:1.0:compile
[INFO] \- javax:javaee-web-api:jar:7.0:provided
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.897 s
[INFO] Finished at: 2018-01-12T10:16:59+01:00
[INFO] Final Memory: 15M/215M
[INFO] ------------------------------------------------------------------------
I even downloaded github repository of google firebase sdk and got rid of all guava code references there, but then I'm getting similar errors when trying to read/write Firestore. It seems that some other google libraries depend on that crappy little jar as well.
I had the same problem with Guava versions in different dependencies.
I resolved this in Gradle like this :
configurations.all {
resolutionStrategy {
force 'com.google.guava:guava:17.0'
}
}
There should be a Maven way, otherwise exclude Guava from all your dependencies and add it explicitly with your version.
It enforces Guava version globally. Fortunatelly for me, version 17 was compatible with all my dependencies. Neither 16- nor 18+ were... Sad thing these are using Guava.
Hope it helps,
Regards

#RunWith(SpringJUnit4ClassRunner.class) cause java.lang.NoSuchMethodError

I try run unit test for rest controller follow http://spring.io/guides/tutorials/bookmarks/
#RunWith(SpringJUnit4ClassRunner.class)
#SpringApplicationConfiguration(classes = Application.class)
#WebAppConfiguration
public class GreetingControllerTest {
//body
}
For this class I always get error:
java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotationUtils.isInJavaLangAnnotationPackage(Ljava/lang/annotation/Annotation;)
I found that someone had similar error because he used few spring versions (java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotationUtils.isInJavaLangAnnotationPackage(Ljava/lang/annotation/Annotation;)Z)
But I think that I use newest libraries and it isn't problem. For reliability I attach my 'mvn dependency:tree' result
[INFO] +- org.springframework.boot:spring-boot-starter- web:jar:1.2.7.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:1.2.7.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot:jar:1.2.7.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.2.7.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:1.2.7.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] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.4.6:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.4.6:compile
[INFO] | | \- com.fasterxml.jackson.core:jackson-core:jar:2.4.6: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.8.RELEASE:compile
[INFO] | +- org.springframework:spring-web:jar:4.1.8.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:4.1.8.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.2.7.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:1.2.7.RELEASE:compile
[INFO] | | +- org.aspectj:aspectjrt:jar:1.8.7:compile
[INFO] | | \- org.aspectj:aspectjweaver:jar:1.8.7:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.2.7.RELEASE:compile
[INFO] | | \- org.apache.tomcat:tomcat-jdbc:jar:8.0.28:compile
[INFO] | | \- org.apache.tomcat:tomcat-juli:jar:8.0.28:compile
[INFO] | +- org.hibernate:hibernate-entitymanager:jar:4.3.11.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
[INFO] | | +- org.hibernate:hibernate-core:jar:4.3.11.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.8.RELEASE:compile
[INFO] | +- org.springframework.data:spring-data-jpa:jar:1.7.4.RELEASE:compile
[INFO] | | +- org.springframework.data:spring-data-commons:jar:1.9.4.RELEASE:compile
[INFO] | | +- org.slf4j:slf4j-api:jar:1.7.12:compile
[INFO] | | \- org.slf4j:jcl-over-slf4j:jar:1.7.12:compile
[INFO] | \- org.springframework:spring-aspects:jar:4.1.8.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-security:jar:1.2.7.RELEASE:compile
[INFO] | +- org.springframework:spring-beans:jar:4.1.8.RELEASE:compile
[INFO] | +- org.springframework:spring-context:jar:4.1.8.RELEASE:compile
[INFO] | +- org.springframework:spring-expression:jar:4.1.8.RELEASE:compile
[INFO] | +- org.springframework.security:spring-security-config:jar:3.2.8.RELEASE:compile
[INFO] | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | +- org.springframework.security:spring-security-web:jar:3.2.8.RELEASE:compile
[INFO] | \- org.springframework:spring-aop:jar:4.1.8.RELEASE:compile
[INFO] +- org.springframework:spring-jdbc:jar:4.1.8.RELEASE:compile
[INFO] | \- org.springframework:spring-tx:jar:4.1.8.RELEASE:compile
[INFO] +- com.h2database:h2:jar:1.4.190:compile
[INFO] +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.2.7.RELEASE:compile
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.0.28:compile
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.0.28:compile
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-logging-juli:jar:8.0.28:compile
[INFO] | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.0.28:compile
[INFO] +- org.springframework.security.oauth:spring-security-oauth2:jar:2.0.7.RELEASE:compile
[INFO] | +- org.springframework.security:spring-security-core:jar:3.2.8.RELEASE:compile
[INFO] | +- commons-codec:commons-codec:jar:1.6:compile
[INFO] | \- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile
[INFO] | \- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile
[INFO] +- org.springframework:spring-test:jar:4.1.8.RELEASE:test
[INFO] \- junit:junit:jar:4.12:test
[INFO] \- org.hamcrest:hamcrest-core:jar:1.3:test
Edit:
Attached pom file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>team.pocket.lublin</groupId>
<artifactId>pocket-lublin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<properties>
<java.version>1.8</java.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.7.RELEASE</version>
</parent>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</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-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<version>2.0.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
</project>

Maven adding jars to war which are not present in dependency:tree

I've recently prepared spring-boot configuration to work properly on a standalone jetty.
I've encountered a strange behavior from maven. It adds jars to my .war archive which are not present in mvn dependency:tree. I've worked around the problem by adding this to my pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<packagingExcludes>WEB-INF/lib/tomcat-*.jar</packagingExcludes>
</configuration>
</plugin>
But that's obviously an ugly solution.
pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.pretius</groupId>
<artifactId>springBootJettyExample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Spring-Boot jetty example app</name>
<packaging>war</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.0.BUILD-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
</exclusion>
</exclusions>
</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-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
</dependencies>
<build>
<finalName>spbj-example</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<packagingExcludes>WEB-INF/lib/tomcat-*.jar</packagingExcludes>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<url>http://repo.spring.io/milestone</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/snapshot</url>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<url>http://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
</project>
mvn dependency:tree:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Spring-Boot jetty example app 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) # springBootJettyExample ---
[INFO] com.pretius:springBootJettyExample:war:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | | +- org.springframework.boot:spring-boot:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:1.3.0.BUILD-SNAPSHOT: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.slf4j:jul-to-slf4j:jar:1.7.12:compile
[INFO] | | | \- org.slf4j:log4j-over-slf4j:jar:1.7.12:compile
[INFO] | | +- org.springframework:spring-core:jar:4.2.2.BUILD-SNAPSHOT:compile
[INFO] | | \- org.yaml:snakeyaml:jar:1.16:runtime
[INFO] | +- org.springframework.boot:spring-boot-starter-validation:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.0.26:compile
[INFO] | | \- org.hibernate:hibernate-validator:jar:5.2.1.Final:compile
[INFO] | | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | | \- com.fasterxml:classmate:jar:1.1.0:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.6.1:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.6.1:compile
[INFO] | | \- com.fasterxml.jackson.core:jackson-core:jar:2.6.1:compile
[INFO] | +- org.springframework:spring-web:jar:4.2.2.BUILD-SNAPSHOT:compile
[INFO] | | +- org.springframework:spring-aop:jar:4.2.2.BUILD-SNAPSHOT:compile
[INFO] | | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | | +- org.springframework:spring-beans:jar:4.2.2.BUILD-SNAPSHOT:compile
[INFO] | | \- org.springframework:spring-context:jar:4.2.2.BUILD-SNAPSHOT:compile
[INFO] | \- org.springframework:spring-webmvc:jar:4.2.2.BUILD-SNAPSHOT:compile
[INFO] | \- org.springframework:spring-expression:jar:4.2.2.BUILD-SNAPSHOT:compile
[INFO] +- org.springframework.boot:spring-boot-starter-jetty:jar:1.3.0.BUILD-SNAPSHOT:provided
[INFO] | +- org.eclipse.jetty:jetty-servlets:jar:9.2.13.v20150730:provided
[INFO] | | +- org.eclipse.jetty:jetty-continuation:jar:9.2.13.v20150730:provided
[INFO] | | +- org.eclipse.jetty:jetty-http:jar:9.2.13.v20150730:provided
[INFO] | | +- org.eclipse.jetty:jetty-util:jar:9.2.13.v20150730:provided
[INFO] | | \- org.eclipse.jetty:jetty-io:jar:9.2.13.v20150730:provided
[INFO] | +- org.eclipse.jetty:jetty-webapp:jar:9.2.13.v20150730:provided
[INFO] | | +- org.eclipse.jetty:jetty-xml:jar:9.2.13.v20150730:provided
[INFO] | | \- org.eclipse.jetty:jetty-servlet:jar:9.2.13.v20150730:provided
[INFO] | | \- org.eclipse.jetty:jetty-security:jar:9.2.13.v20150730:provided
[INFO] | | \- org.eclipse.jetty:jetty-server:jar:9.2.13.v20150730:provided
[INFO] | +- org.eclipse.jetty.websocket:websocket-server:jar:9.2.13.v20150730:provided
[INFO] | | +- org.eclipse.jetty.websocket:websocket-common:jar:9.2.13.v20150730:provided
[INFO] | | | \- org.eclipse.jetty.websocket:websocket-api:jar:9.2.13.v20150730:provided
[INFO] | | +- org.eclipse.jetty.websocket:websocket-client:jar:9.2.13.v20150730:provided
[INFO] | | \- org.eclipse.jetty.websocket:websocket-servlet:jar:9.2.13.v20150730:provided
[INFO] | | \- javax.servlet:javax.servlet-api:jar:3.1.0:provided
[INFO] | \- org.eclipse.jetty.websocket:javax-websocket-server-impl:jar:9.2.13.v20150730:provided
[INFO] | +- org.eclipse.jetty:jetty-annotations:jar:9.2.13.v20150730:provided
[INFO] | | +- org.eclipse.jetty:jetty-plus:jar:9.2.13.v20150730:provided
[INFO] | | | \- org.eclipse.jetty:jetty-jndi:jar:9.2.13.v20150730:provided
[INFO] | | +- javax.annotation:javax.annotation-api:jar:1.2:provided
[INFO] | | +- org.ow2.asm:asm:jar:5.0.1:provided
[INFO] | | \- org.ow2.asm:asm-commons:jar:5.0.1:provided
[INFO] | | \- org.ow2.asm:asm-tree:jar:5.0.1:provided
[INFO] | +- org.eclipse.jetty.websocket:javax-websocket-client-impl:jar:9.2.13.v20150730:provided
[INFO] | \- javax.websocket:javax.websocket-api:jar:1.0:provided
[INFO] +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | \- org.springframework:spring-jdbc:jar:4.2.2.BUILD-SNAPSHOT:compile
[INFO] | \- org.springframework:spring-tx:jar:4.2.2.BUILD-SNAPSHOT:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | | +- org.aspectj:aspectjrt:jar:1.8.6:compile
[INFO] | | \- org.aspectj:aspectjweaver:jar:1.8.6:compile
[INFO] | +- org.hibernate:hibernate-entitymanager:jar:4.3.11.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.hibernate:hibernate-core:jar:4.3.11.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.data:spring-data-jpa:jar:1.9.0.RELEASE:compile
[INFO] | | +- org.springframework.data:spring-data-commons:jar:1.11.0.RELEASE:compile
[INFO] | | +- org.springframework:spring-orm:jar:4.2.2.BUILD-SNAPSHOT:compile
[INFO] | | \- org.slf4j:jcl-over-slf4j:jar:1.7.12:compile
[INFO] | \- org.springframework:spring-aspects:jar:4.2.2.BUILD-SNAPSHOT:compile
[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] | \- org.springframework.boot:spring-boot-actuator:jar:1.3.0.BUILD-SNAPSHOT:compile
[INFO] +- org.hsqldb:hsqldb:jar:2.3.3:runtime
[INFO] \- org.slf4j:slf4j-log4j12:jar:1.7.12:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.12:compile
[INFO] \- log4j:log4j:jar:1.2.17:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.746 s
[INFO] Finished at: 2015-10-05T09:36:47+02:00
[INFO] Final Memory: 21M/309M
[INFO] ------------------------------------------------------------------------
(Yes, there is one tomcat lib in the tree, but there are several added to .war)
Unwanted jars:
tomcat-embed-core-8.0.26.jar
tomcat-embed-logging-juli-8.0.26.jar
tomcat-embed-websocket-8.0.26.jar
tomcat-jdbc-8.0.26.jar
tomcat-juli-8.0.26.jar
Here's a link to the sample application.
What is adding the tomcat* jars to my .war? How can I stop it doing so?
Well when I run maven package this pom produces two war files one named "spbj-example.war" for running with
org.springframework.boot.loader.WarLauncher
and another one named "spbj-example.war.original".
You should use the second war which doesn't contain anything related to servers.
The first one contains a lib directory in which you have jar files to run a server like "jetty-server-9.2.13.v20150730.jar" and lots of others.
So most likey problem is related to your dirty "target" directory.
You should use
mvn clean package/install

issue with maven dependency?

Trying to execute twilio Java api fails as follows:
18:17:35.270 [main] DEBUG o.a.h.c.protocol.RequestAddCookies - CookieSpec selected: best-match
18:17:35.296 [main] DEBUG o.a.h.c.protocol.RequestAuthCache - Auth cache not set in the context
18:17:35.297 [main] DEBUG o.a.h.impl.client.DefaultHttpClient - Reopening the direct connection.
18:17:35.297 [main] DEBUG o.a.h.impl.client.DefaultHttpClient - Attempt 1 to execute request
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.twilio.sdk.AppEngineClientConnection.flush(AppEngineClientConnection.java:197)
at org.apache.http.protocol.HttpRequestExecutor.doSendRequest(HttpRequestExecutor.java:258)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:123)
at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:645)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:464)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:732)
at com.twilio.sdk.TwilioRestClient.request(TwilioRestClient.java:410)
at com.twilio.sdk.TwilioRestClient.safeRequest(TwilioRestClient.java:581)
at com.twilio.sdk.resource.list.MessageList.create(MessageList.java:70)
at ws.SmsSender.main(SmsSender.java:34)
Caused by: com.google.apphosting.api.ApiProxy$CallNotFoundException: The API package 'urlfetch' or call 'Fetch()' was not found.
at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:98)
at com.google.appengine.api.urlfetch.URLFetchServiceImpl.fetch(URLFetchServiceImpl.java:37)
... 16 more
18:17:35.334 [main] DEBUG o.a.h.impl.client.DefaultHttpClient - Closing the connection.
I think it has something to do with a dependency issue in Maven. Here's my pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.wat</groupId>
<artifactId>ws</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>ws</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>foursquareapijava</id>
<name>Foursquare V2 API for Java Repository</name>
<url>http://foursquare-api-java.googlecode.com/svn/repository</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.yammer.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
<version>0.6.2</version>
</dependency>
<dependency>
<groupId>com.yammer.dropwizard</groupId>
<artifactId>dropwizard-auth</artifactId>
<version>0.6.2</version>
</dependency>
<dependency>
<groupId>com.googlecode.libphonenumber</groupId>
<artifactId>libphonenumber</artifactId>
<version>6.1</version>
</dependency>
<dependency>
<groupId>net.vz.mongodb.jackson</groupId>
<artifactId>mongo-jackson-mapper</artifactId>
<version>1.4.2</version>
</dependency>
<dependency>
<groupId>com.twilio.sdk</groupId>
<artifactId>twilio-java-sdk</artifactId>
<version>3.4.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>2.12.0-rc2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>fi.foyt</groupId>
<artifactId>foursquare-api</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.scribe</groupId>
<artifactId>scribe</artifactId>
<version>1.1.0</version>
</dependency>
<!-- <dependency>
<groupId>org.apache.mahout</groupId>
<artifactId>mahout-core</artifactId>
<version>0.9</version>
</dependency>
<dependency>
<groupId>org.apache.mahout</groupId>
<artifactId>mahout-integration</artifactId>
<version>0.9</version>
</dependency> -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.6</version>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>ws.WSService</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Here's the output from mvn dependency:tree -Dverbose
Last login: Tue Jun 24 18:09:15 on ttys002
$ mvn dependency:tree -Dverbose
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ws 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # ws ---
[INFO] com.wat:ws:jar:0.0.1-SNAPSHOT
[INFO] +- com.yammer.dropwizard:dropwizard-core:jar:0.6.2:compile
[INFO] | +- com.sun.jersey:jersey-core:jar:1.17.1:compile
[INFO] | +- com.sun.jersey:jersey-server:jar:1.17.1:compile
[INFO] | | +- asm:asm:jar:3.1:compile
[INFO] | | \- (com.sun.jersey:jersey-core:jar:1.17.1:compile - omitted for duplicate)
[INFO] | +- com.sun.jersey:jersey-servlet:jar:1.17.1:compile
[INFO] | | \- (com.sun.jersey:jersey-server:jar:1.17.1:compile - omitted for duplicate)
[INFO] | +- com.yammer.metrics:metrics-core:jar:2.2.0:compile
[INFO] | | \- (org.slf4j:slf4j-api:jar:1.7.2:compile - omitted for conflict with 1.7.4)
[INFO] | +- com.yammer.metrics:metrics-servlet:jar:2.2.0:compile
[INFO] | | +- (com.yammer.metrics:metrics-core:jar:2.2.0:compile - omitted for duplicate)
[INFO] | | \- (com.fasterxml.jackson.core:jackson-databind:jar:2.1.1:compile - omitted for conflict with 2.1.4)
[INFO] | +- com.yammer.metrics:metrics-jetty:jar:2.2.0:compile
[INFO] | | +- (com.yammer.metrics:metrics-core:jar:2.2.0:compile - omitted for duplicate)
[INFO] | | \- (org.eclipse.jetty:jetty-server:jar:8.1.8.v20121106:compile - omitted for conflict with 8.1.10.v20130312)
[INFO] | +- com.yammer.metrics:metrics-logback:jar:2.2.0:compile
[INFO] | | +- (com.yammer.metrics:metrics-core:jar:2.2.0:compile - omitted for duplicate)
[INFO] | | +- (ch.qos.logback:logback-core:jar:1.0.7:compile - omitted for conflict with 1.0.10)
[INFO] | | \- (ch.qos.logback:logback-classic:jar:1.0.7:compile - omitted for conflict with 1.0.10)
[INFO] | +- com.yammer.metrics:metrics-jersey:jar:2.2.0:compile
[INFO] | | +- (com.yammer.metrics:metrics-core:jar:2.2.0:compile - omitted for duplicate)
[INFO] | | +- com.yammer.metrics:metrics-annotation:jar:2.2.0:compile
[INFO] | | \- (com.sun.jersey:jersey-server:jar:1.15:compile - omitted for conflict with 1.17.1)
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.1.4:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.1.4:compile
[INFO] | | \- (com.fasterxml.jackson.core:jackson-core:jar:2.1.4:compile - omitted for conflict with 2.1.1)
[INFO] | +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.1.4:compile
[INFO] | | +- (com.fasterxml.jackson.core:jackson-core:jar:2.1.4:compile - omitted for duplicate)
[INFO] | | +- (com.fasterxml.jackson.core:jackson-databind:jar:2.1.4:compile - omitted for duplicate)
[INFO] | | \- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.1.4:compile
[INFO] | | +- (com.fasterxml.jackson.core:jackson-core:jar:2.1.4:compile - omitted for duplicate)
[INFO] | | \- (com.fasterxml.jackson.core:jackson-databind:jar:2.1.4:compile - omitted for duplicate)
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.1.4:compile
[INFO] | | \- (com.fasterxml.jackson.core:jackson-core:jar:2.1.4:compile - omitted for duplicate)
[INFO] | +- com.fasterxml.jackson.datatype:jackson-datatype-guava:jar:2.1.2:compile
[INFO] | | +- (com.fasterxml.jackson.core:jackson-databind:jar:2.1.2:compile - omitted for conflict with 2.1.4)
[INFO] | | +- (com.fasterxml.jackson.core:jackson-core:jar:2.1.2:compile - omitted for conflict with 2.1.4)
[INFO] | | \- (com.google.guava:guava:jar:11.0.2:compile - omitted for conflict with 14.0.1)
[INFO] | +- net.sourceforge.argparse4j:argparse4j:jar:0.4.0:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.4:compile
[INFO] | +- org.slf4j:jul-to-slf4j:jar:1.7.4:compile
[INFO] | | \- (org.slf4j:slf4j-api:jar:1.7.4:compile - omitted for duplicate)
[INFO] | +- ch.qos.logback:logback-core:jar:1.0.10:compile
[INFO] | +- ch.qos.logback:logback-classic:jar:1.0.10:compile
[INFO] | | +- (ch.qos.logback:logback-core:jar:1.0.10:compile - omitted for duplicate)
[INFO] | | \- (org.slf4j:slf4j-api:jar:1.7.2:compile - omitted for conflict with 1.7.4)
[INFO] | +- org.slf4j:log4j-over-slf4j:jar:1.7.4:compile
[INFO] | | \- (org.slf4j:slf4j-api:jar:1.7.4:compile - omitted for duplicate)
[INFO] | +- org.eclipse.jetty:jetty-server:jar:8.1.10.v20130312:compile
[INFO] | | +- org.eclipse.jetty.orbit:javax.servlet:jar:3.0.0.v201112011016:compile
[INFO] | | +- org.eclipse.jetty:jetty-continuation:jar:8.1.10.v20130312:compile
[INFO] | | \- (org.eclipse.jetty:jetty-http:jar:8.1.10.v20130312:compile - omitted for duplicate)
[INFO] | +- org.eclipse.jetty:jetty-servlet:jar:8.1.10.v20130312:compile
[INFO] | | \- org.eclipse.jetty:jetty-security:jar:8.1.10.v20130312:compile
[INFO] | | \- (org.eclipse.jetty:jetty-server:jar:8.1.10.v20130312:compile - omitted for duplicate)
[INFO] | +- org.eclipse.jetty:jetty-http:jar:8.1.10.v20130312:compile
[INFO] | | \- org.eclipse.jetty:jetty-io:jar:8.1.10.v20130312:compile
[INFO] | | \- org.eclipse.jetty:jetty-util:jar:8.1.10.v20130312:compile
[INFO] | +- com.google.guava:guava:jar:14.0.1:compile
[INFO] | +- com.google.code.findbugs:jsr305:jar:2.0.1:compile
[INFO] | +- org.hibernate:hibernate-validator:jar:4.3.1.Final:compile
[INFO] | | +- javax.validation:validation-api:jar:1.0.0.GA:compile
[INFO] | | \- org.jboss.logging:jboss-logging:jar:3.1.0.CR2:compile
[INFO] | +- joda-time:joda-time:jar:2.2:compile
[INFO] | \- (com.fasterxml.jackson.datatype:jackson-datatype-joda:jar:2.1.2:compile - omitted for conflict with 2.1.1)
[INFO] +- com.yammer.dropwizard:dropwizard-auth:jar:0.6.2:compile
[INFO] | \- (com.yammer.dropwizard:dropwizard-core:jar:0.6.2:compile - omitted for duplicate)
[INFO] +- com.googlecode.libphonenumber:libphonenumber:jar:6.1:compile
[INFO] +- net.vz.mongodb.jackson:mongo-jackson-mapper:jar:1.4.2:compile
[INFO] | +- (org.mongodb:mongo-java-driver:jar:2.7.2:compile - omitted for conflict with 2.12.0-rc2)
[INFO] | +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.3:compile (version managed from 1.9.5)
[INFO] | | \- org.codehaus.jackson:jackson-core-asl:jar:1.9.3:compile
[INFO] | +- de.undercouch:bson4jackson:jar:1.3.0:compile
[INFO] | | +- (org.codehaus.jackson:jackson-core-asl:jar:1.7.4:compile - omitted for conflict with 1.9.3)
[INFO] | | \- (org.codehaus.jackson:jackson-mapper-asl:jar:1.9.3:compile - version managed from 1.7.4; omitted for duplicate)
[INFO] | \- javax.persistence:persistence-api:jar:1.0.2:compile
[INFO] +- com.twilio.sdk:twilio-java-sdk:jar:3.4.5:compile
[INFO] | +- org.apache.httpcomponents:httpclient:jar:4.1.2:compile
[INFO] | | +- org.apache.httpcomponents:httpcore:jar:4.1.2:compile
[INFO] | | +- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] | | \- (commons-codec:commons-codec:jar:1.4:compile - omitted for duplicate)
[INFO] | +- commons-lang:commons-lang:jar:2.6:compile
[INFO] | +- com.googlecode.json-simple:json-simple:jar:1.1:compile
[INFO] | \- (org.codehaus.jackson:jackson-mapper-asl:jar:1.9.3:compile - version managed from 1.7.4; omitted for duplicate)
[INFO] +- org.mongodb:mongo-java-driver:jar:2.12.0-rc2:compile
[INFO] +- com.fasterxml.jackson.datatype:jackson-datatype-joda:jar:2.1.1:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-core:jar:2.1.1:compile
[INFO] | +- (com.fasterxml.jackson.core:jackson-databind:jar:2.1.1:compile - omitted for conflict with 2.1.4)
[INFO] | \- (joda-time:joda-time:jar:2.1:compile - omitted for conflict with 2.2)
[INFO] +- fi.foyt:foursquare-api:jar:1.0.2:compile
[INFO] | +- org.json:json:jar:20090211:compile
[INFO] | \- com.google.appengine:appengine-api-1.0-sdk:jar:1.6.5:compile
[INFO] \- org.scribe:scribe:jar:1.1.0:compile
[INFO] \- commons-codec:commons-codec:jar:1.4:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.901 s
[INFO] Finished at: 2014-06-24T18:41:27-08:00
[INFO] Final Memory: 12M/183M
[INFO] ------------------------------------------------------------------------
$
And the code being executed:
package ws;
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.TwilioRestResponse;
import com.twilio.sdk.resource.factory.CallFactory;
import com.twilio.sdk.resource.factory.MessageFactory;
import com.twilio.sdk.resource.instance.*;
import com.twilio.sdk.resource.list.AccountList;
import com.twilio.sdk.resource.list.AvailablePhoneNumberList;
import com.twilio.sdk.resource.list.ParticipantList;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import java.util.*;
public class SmsSender {
// Find your Account Sid and Token at twilio.com/user/account
public static final String ACCOUNT_SID = "<HIDDEN>";
public static final String AUTH_TOKEN = "<HIDDEN>";
public static void main(String[] args) throws TwilioRestException {
TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);
Account mainAccount = client.getAccount();
// Send an sms (using the new messages endpoint)
MessageFactory messageFactory = mainAccount.getMessageFactory();
List<NameValuePair> messageParams = new ArrayList<NameValuePair>();
messageParams.add(new BasicNameValuePair("To", "+HIDDEN")); // Replace with a valid phone number
messageParams.add(new BasicNameValuePair("From", "+HIDDEN")); // Replace with a valid phone
// number in your account
messageParams.add(new BasicNameValuePair("Body", "This is a test message!"));
messageFactory.create(messageParams);
}
}
Any ideas?
From twilio:
Hi Matthew,
Thanks for checking with us.
It looks like "foursquare-api" is bringing in the
"appengine-api-1.0-sdk" dependency.
[INFO] +- fi.foyt:foursquare-api:jar:1.0.2:compile
[INFO] | +- org.json:json:jar:20090211:compile
[INFO] | \- com.google.appengine:appengine-api-1.0-sdk:jar:1.6.5:compile
You can try excluding this dependency, however I expect it will
probably break the "foursquare-api" library.
"twilio-java" does not have a hard dependency on App Engine for this
reason.
Please let us know if you have any other questions.
Alex Chan Twilio Customer Support www.twilio.com
Updated pom.xml as follows:
<dependency>
<groupId>fi.foyt</groupId>
<artifactId>foursquare-api</artifactId>
<version>1.0.2</version>
<exclusions>
<exclusion> <!-- declare the exclusion here -->
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
</exclusion>
</exclusions>
</dependency>

Categories

Resources