java.lang.NoSuchMethodError when connecting to Firebase from Java - 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

Related

Tomcat 7 and Spring boot war start up

I get the following message when I deploy my war to the Tomcat 7:
nested exception is java.lang.NoClassDefFoundError: javax/el/ELManager
I added <tomcat.version>7.0.61</tomcat.version> to my pom.xml and can now reproduce the error on my development environment.
The error happens after the bean creation, the other changes that were necessary to get the war to run I made.
I tried to change my pom.xml so that it uses old versions which might play nice with tomcat 7, but failed to remove the problem. I don't know which package produces the problem.
See 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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.xxx</groupId>
<artifactId>monitormonitor</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>monitormonitor</name>
<description>Web Service Monitoring project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<start-class>com.xxx.monitormonitor.MonitormonitorApplication</start-class>
<!-- deploying war-file on tomcat 7 -->
<tomcat.version>7.0.61</tomcat.version><!-- nested exception is java.lang.NoClassDefFoundError: javax/el/ELManager -->
<servlet-api.version>3.0.1</servlet-api.version>
</properties>
<packaging>war</packaging>
<dependencies>
<!-- added other version of log4j for invalid byte tag error -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<!-- changed version vs. ClassFormatException: Invalid byte tag in constant pool: 19 -->
<!--<version>2.11.1</version>-->
<version>2.7</version>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!-- <scope>provided</scope> -->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<!--
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<version>1.1.6.RELEASE</version>
<scope>provided</scope>
</dependency>
-->
<!-- added vs java.lang.NoClassDefFoundError: javax/el/ELManager -->
<!--<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
-->
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>2.2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.el</artifactId>
<version>2.2.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.xxx.monitormonitor.MonitormonitorApplication</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
dependency tree:
[INFO] com.xxx:monitormonitor:war:0.0.1-SNAPSHOT
[INFO] +- org.apache.logging.log4j:log4j-api:jar:2.7:compile
[INFO] +- org.apache.logging.log4j:log4j-core:jar:2.7:compile
[INFO] +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.1.2.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:2.1.2.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:2.1.2.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.11.1:compile
[INFO] | | | \- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
[INFO] | | \- org.yaml:snakeyaml:jar:1.23:runtime
[INFO] | +- com.zaxxer:HikariCP:jar:3.2.0:compile
[INFO] | | \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] | \- org.springframework:spring-jdbc:jar:5.1.4.RELEASE:compile
[INFO] | \- org.springframework:spring-tx:jar:5.1.4.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-mail:jar:2.1.2.RELEASE:compile
[INFO] | \- com.sun.mail:javax.mail:jar:1.6.2:compile
[INFO] | \- javax.activation:activation:jar:1.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.1.2.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-json:jar:2.1.2.RELEASE:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.8:compile
[INFO] | | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
[INFO] | | | \- com.fasterxml.jackson.core:jackson-core:jar:2.9.8:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.9.8:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.8:compile
[INFO] | | \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.9.8:compile
[INFO] | +- org.hibernate.validator:hibernate-validator:jar:6.0.14.Final:compile
[INFO] | | +- javax.validation:validation-api:jar:2.0.1.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.3.2.Final:compile
[INFO] | | \- com.fasterxml:classmate:jar:1.4.0:compile
[INFO] | +- org.springframework:spring-web:jar:5.1.4.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:5.1.4.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:5.1.4.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:5.1.4.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.1.2.RELEASE:provided
[INFO] | +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-core:jar:7.0.61:provided
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-el:jar:7.0.61:provided
[INFO] | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:7.0.61:provided
[INFO] +- org.springframework.boot:spring-boot-devtools:jar:2.1.2.RELEASE:runtime
[INFO] | +- org.springframework.boot:spring-boot:jar:2.1.2.RELEASE:compile
[INFO] | \- org.springframework.boot:spring-boot-autoconfigure:jar:2.1.2.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.1.2.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test:jar:2.1.2.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.1.2.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] | +- junit:junit:jar:4.12:test
[INFO] | +- org.assertj:assertj-core:jar:3.11.1:test
[INFO] | +- org.mockito:mockito-core:jar:2.23.4:test
[INFO] | | +- net.bytebuddy:byte-buddy:jar:1.9.7:test
[INFO] | | +- net.bytebuddy:byte-buddy-agent:jar:1.9.7:test
[INFO] | | \- org.objenesis:objenesis:jar:2.6: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.5.0:test
[INFO] | | \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] | +- org.springframework:spring-core:jar:5.1.4.RELEASE:compile
[INFO] | | \- org.springframework:spring-jcl:jar:5.1.4.RELEASE:compile
[INFO] | +- org.springframework:spring-test:jar:5.1.4.RELEASE:test
[INFO] | \- org.xmlunit:xmlunit-core:jar:2.6.2:test
[INFO] +- org.springframework:spring-context-support:jar:5.1.4.RELEASE:compile
[INFO] | +- org.springframework:spring-beans:jar:5.1.4.RELEASE:compile
[INFO] | \- org.springframework:spring-context:jar:5.1.4.RELEASE:compile
[INFO] +- javax.el:javax.el-api:jar:2.2.4:provided
[INFO] \- org.glassfish.web:javax.el:jar:2.2.4:provided
spring boot 2.1.2 release supports any Servlet 3.1+ compatible container.
Tomcat 7 is not one of them
spring boot docs
Use tomcat 8 or beyond http://tomcat.apache.org/whichversion.html
Spring Boot 2.1 requires a Servlet 3.1 compatible container. Tomcat 7 is a Servlet 3.0 container so you cannot use it with Spring Boot 2.1.
You'll need to upgrade to Tomcat 8.5.x or 9.0.x.
It is because javax/el/ELManager was introduced in el-api 3.0 and tomcat 7 is using el-api 2.2 so this class is not present in it.
Please make sure your dev and prod environment are the same when you are developing.
Or you can add following dependency in your pom.xml
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>3.0.0</version>
</dependency>

Maven project building fails at test-compile stage with NoClassDefFoundError and others

I'm totally lost with the unhelpful Maven trace. mvn compile succeeds like a charm but with mvn package, the tests (of this particular quickstart tutorial) fail with NoClassDefFoundError, NoSuchMethodError at test-compile stage (with -DskipTests=true option emitting that stage it works successfully) of the Maven build process. Also, projects fails at runtime with those errors.
I have this problem in my own project, and to go through the proper mvn install and project initialization from an archetype I ended up to go through the process with a bear bone tutorial.
When compiled and packaged on a remote machine (OS is Ubuntu 16.04, local is OS X), it packages and compiles normally. With the local machine, not.
trace:
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building first-dataflow 0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # first-dataflow ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/user/projects/personal/first-dataflow/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) # first-dataflow ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # first-dataflow ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/user/projects/personal/first-dataflow/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) # first-dataflow ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.20:test (default-test) # first-dataflow ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.example.WordCountTest
[ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.002 s <<< FAILURE! - in com.example.WordCountTest
[ERROR] testCountWords(com.example.WordCountTest) Time elapsed: 0.002 s <<< ERROR!
java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z
at com.example.WordCountTest.<init>(WordCountTest.java:72)
[ERROR] testExtractWordsFn(com.example.WordCountTest) Time elapsed: 0.002 s <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class org.apache.beam.sdk.testing.TestPipeline
at com.example.WordCountTest.<init>(WordCountTest.java:72)
[INFO] Running com.example.DebuggingWordCountTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.098 s <<< FAILURE! - in com.example.DebuggingWordCountTest
[ERROR] testDebuggingWordCount(com.example.DebuggingWordCountTest) Time elapsed: 0.098 s <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class org.apache.beam.sdk.testing.TestPipeline
at com.example.DebuggingWordCountTest.testDebuggingWordCount(DebuggingWordCountTest.java:47)
[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] DebuggingWordCountTest.testDebuggingWordCount:47 NoClassDefFound Could not ini...
[ERROR] WordCountTest.<init>:72 » NoSuchMethod com.fasterxml.jackson.core.JsonFactory....
[ERROR] WordCountTest.<init>:72 NoClassDefFound Could not initialize class org.apache....
[INFO]
[ERROR] Tests run: 3, Failures: 0, Errors: 3, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.948 s
[INFO] Finished at: 2017-06-24T22:40:00+03:00
[INFO] Final Memory: 17M/437M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20:test (default-test) on project first-dataflow: There are test failures.
[ERROR]
[ERROR] Please refer to /Users/user/projects/personal/first-dataflow/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright (C) 2017 Google Inc.
~
~ Licensed under the Apache License, Version 2.0 (the "License"); you may not
~ use this file except in compliance with the License. You may obtain a copy of
~ the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
~ License for the specific language governing permissions and limitations under
~ the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<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.example</groupId>
<artifactId>first-dataflow</artifactId>
<version>0.1</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<surefire-plugin.version>2.20</surefire-plugin.version>
</properties>
<repositories>
<repository>
<id>ossrh.snapshots</id>
<name>Sonatype OSS Repository Hosting</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<configuration>
<parallel>all</parallel>
<threadCount>4</threadCount>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>${surefire-plugin.version}</version>
</dependency>
</dependencies>
</plugin>
<!-- Ensure that the Maven jar plugin runs before the Maven
shade plugin by listing the plugin higher within the file. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
</plugin>
<!--
Configures `mvn package` to produce a bundled jar ("fat jar") for runners
that require this for job submission to a cluster.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>${project.artifactId}-bundled-${project.version}</finalName>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/LICENSE</exclude>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<cleanupDaemonThreads>false</cleanupDaemonThreads>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<!-- Adds a dependency on a specific version of the Dataflow SDK. -->
<dependency>
<groupId>com.google.cloud.dataflow</groupId>
<artifactId>google-cloud-dataflow-java-sdk-all</artifactId>
<version>2.0.0</version>
</dependency>
<!-- Dependencies below this line are specific dependencies needed by the examples code. -->
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.22.0</version>
<exclusions>
<!-- Exclude an old version of guava that is being pulled
in by a transitive dependency of google-api-client -->
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava-jdk5</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-bigquery</artifactId>
<version>v2-rev295-1.22.0</version>
<exclusions>
<!-- Exclude an old version of guava that is being pulled
in by a transitive dependency of google-api-client -->
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava-jdk5</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
<version>1.22.0</version>
<exclusions>
<!-- Exclude an old version of guava that is being pulled
in by a transitive dependency of google-api-client -->
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava-jdk5</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-pubsub</artifactId>
<version>v1-rev10-1.22.0</version>
<exclusions>
<!-- Exclude an old version of guava that is being pulled
in by a transitive dependency of google-api-client -->
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava-jdk5</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>20.0</version>
</dependency>
<!-- Add slf4j API frontend binding with JUL backend -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.14</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.14</version>
<!-- When loaded at runtime this will wire up slf4j to the JUL backend -->
<scope>runtime</scope>
</dependency>
<!-- Hamcrest and JUnit are required dependencies of PAssert,
which is used in the main code of DebuggingWordCount example. -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
</dependencies>
</project>
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home
$ echo $M2_HOME
/opt/maven
Edit: tutorial reference:
https://cloud.google.com/dataflow/docs/quickstarts/quickstart-java-maven
Dependency tree:
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.example:first-dataflow:jar:0.1
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. # line 79, column 15
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building first-dataflow 0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # first-dataflow ---
[INFO] com.example:first-dataflow:jar:0.1
[INFO] +- com.google.cloud.dataflow:google-cloud-dataflow-java-sdk-all:jar:2.0.0:compile
[INFO] | +- org.apache.beam:beam-sdks-java-core:jar:2.0.0:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-core:jar:2.8.8:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.8:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.8:compile
[INFO] | | +- org.apache.avro:avro:jar:1.8.1:compile
[INFO] | | | +- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile
[INFO] | | | +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile
[INFO] | | | +- com.thoughtworks.paranamer:paranamer:jar:2.7:compile
[INFO] | | | +- org.apache.commons:commons-compress:jar:1.8.1:compile
[INFO] | | | \- org.tukaani:xz:jar:1.5:compile
[INFO] | | \- org.xerial.snappy:snappy-java:jar:1.1.4-M3:compile
[INFO] | +- org.apache.beam:beam-sdks-java-io-google-cloud-platform:jar:2.0.0:compile
[INFO] | | +- org.apache.beam:beam-sdks-java-extensions-google-cloud-platform-core:jar:2.0.0:compile
[INFO] | | | +- com.google.cloud.bigdataoss:gcsio:jar:1.4.5:compile
[INFO] | | | \- com.google.apis:google-api-services-cloudresourcemanager:jar:v1-rev6-1.22.0:compile
[INFO] | | +- org.apache.beam:beam-sdks-java-extensions-protobuf:jar:2.0.0:compile
[INFO] | | +- com.google.api.grpc:grpc-google-pubsub-v1:jar:0.1.0:compile
[INFO] | | | \- com.google.api.grpc:grpc-google-iam-v1:jar:0.1.0:compile
[INFO] | | +- com.google.cloud.bigdataoss:util:jar:1.4.5:compile
[INFO] | | | +- com.google.api-client:google-api-client-java6:jar:1.20.0:compile
[INFO] | | | +- com.google.api-client:google-api-client-jackson2:jar:1.20.0:compile
[INFO] | | | \- com.google.oauth-client:google-oauth-client-java6:jar:1.20.0:compile
[INFO] | | +- com.google.cloud.datastore:datastore-v1-proto-client:jar:1.4.0:compile
[INFO] | | | +- com.google.http-client:google-http-client-protobuf:jar:1.20.0:compile
[INFO] | | | \- com.google.http-client:google-http-client-jackson:jar:1.20.0:compile
[INFO] | | +- com.google.cloud.datastore:datastore-v1-protos:jar:1.3.0:compile
[INFO] | | +- io.grpc:grpc-auth:jar:1.2.0:compile
[INFO] | | +- io.grpc:grpc-core:jar:1.2.0:compile
[INFO] | | | +- com.google.errorprone:error_prone_annotations:jar:2.0.11:compile
[INFO] | | | +- io.grpc:grpc-context:jar:1.2.0:compile
[INFO] | | | \- com.google.instrumentation:instrumentation-api:jar:0.3.0:compile
[INFO] | | +- io.grpc:grpc-netty:jar:1.2.0:compile
[INFO] | | | +- io.netty:netty-codec-http2:jar:4.1.8.Final:compile (version selected from constraint [4.1.8.Final,4.1.8.Final])
[INFO] | | | | \- io.netty:netty-codec-http:jar:4.1.8.Final:compile
[INFO] | | | \- io.netty:netty-handler-proxy:jar:4.1.8.Final:compile
[INFO] | | | \- io.netty:netty-codec-socks:jar:4.1.8.Final:compile
[INFO] | | +- io.netty:netty-handler:jar:4.1.8.Final:compile
[INFO] | | | +- io.netty:netty-buffer:jar:4.1.8.Final:compile
[INFO] | | | | \- io.netty:netty-common:jar:4.1.8.Final:compile
[INFO] | | | +- io.netty:netty-transport:jar:4.1.8.Final:compile
[INFO] | | | | \- io.netty:netty-resolver:jar:4.1.8.Final:compile
[INFO] | | | \- io.netty:netty-codec:jar:4.1.8.Final:compile
[INFO] | | +- io.grpc:grpc-stub:jar:1.2.0:compile
[INFO] | | +- io.grpc:grpc-all:jar:1.2.0:compile
[INFO] | | | +- io.grpc:grpc-okhttp:jar:1.2.0:compile
[INFO] | | | | +- com.squareup.okhttp:okhttp:jar:2.5.0:compile
[INFO] | | | | \- com.squareup.okio:okio:jar:1.6.0:compile
[INFO] | | | +- io.grpc:grpc-protobuf:jar:1.2.0:compile
[INFO] | | | | \- com.google.protobuf:protobuf-java-util:jar:3.2.0:compile
[INFO] | | | | \- com.google.code.gson:gson:jar:2.7:compile
[INFO] | | | +- io.grpc:grpc-protobuf-lite:jar:1.2.0:compile
[INFO] | | | \- io.grpc:grpc-protobuf-nano:jar:1.2.0:compile
[INFO] | | | \- com.google.protobuf.nano:protobuf-javanano:jar:3.0.0-alpha-5:compile
[INFO] | | +- com.google.cloud.bigtable:bigtable-protos:jar:0.9.6.2:compile
[INFO] | | +- com.google.cloud.bigtable:bigtable-client-core:jar:0.9.6.2:compile
[INFO] | | | +- com.google.auth:google-auth-library-appengine:jar:0.6.0:compile
[INFO] | | | | \- com.google.appengine:appengine-api-1.0-sdk:jar:1.9.34:compile
[INFO] | | | \- io.dropwizard.metrics:metrics-core:jar:3.1.2:compile
[INFO] | | +- com.google.auth:google-auth-library-credentials:jar:0.6.1:compile
[INFO] | | +- com.google.auth:google-auth-library-oauth2-http:jar:0.6.1:compile
[INFO] | | +- com.google.api.grpc:grpc-google-common-protos:jar:0.1.0:compile
[INFO] | | +- com.google.protobuf:protobuf-java:jar:3.2.0:compile
[INFO] | | \- io.netty:netty-tcnative-boringssl-static:jar:1.1.33.Fork26:runtime
[INFO] | +- org.apache.beam:beam-runners-direct-java:jar:2.0.0:compile
[INFO] | \- org.apache.beam:beam-runners-google-cloud-dataflow-java:jar:2.0.0:compile
[INFO] | +- org.apache.beam:beam-sdks-common-runner-api:jar:2.0.0:compile
[INFO] | +- com.google.apis:google-api-services-dataflow:jar:v1b3-rev196-1.22.0:compile
[INFO] | +- com.google.apis:google-api-services-clouddebugger:jar:v2-rev8-1.22.0:compile
[INFO] | \- com.google.apis:google-api-services-storage:jar:v1-rev71-1.22.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.google.apis:google-api-services-bigquery:jar:v2-rev295-1.22.0: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] | \- org.apache.httpcomponents:httpclient:jar:4.0.1:compile
[INFO] | +- org.apache.httpcomponents:httpcore:jar:4.0.1:compile
[INFO] | +- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] | \- commons-codec:commons-codec:jar:1.3:compile
[INFO] +- com.google.apis:google-api-services-pubsub:jar:v1-rev10-1.22.0:compile
[INFO] +- joda-time:joda-time:jar:2.4:compile
[INFO] +- com.google.guava:guava:jar:20.0:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.14:compile
[INFO] +- org.slf4j:slf4j-jdk14:jar:1.7.14:runtime
[INFO] +- org.hamcrest:hamcrest-all:jar:1.3:compile
[INFO] \- junit:junit:jar:4.12:compile
[INFO] \- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.080 s
[INFO] Finished at: 2017-06-24T23:24:24+03:00
[INFO] Final Memory: 18M/437M
[INFO] ------------------

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

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

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.

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