MissingTableException in unit test with hiverunner - java

I have a simple hiverunner tests from - https://github.com/klarna/HiveRunner/blob/master/src/test/java/com/klarna/hiverunner/ExecuteScriptIntegrationTest.java and I want to add it to my multimodule maven project.
After adding tests, resources, plugins and dependencies I got an exception. I tried to create the new maven project and add the same to it. It worked successfully. I tried to execute mvn dependency:tree and comparing the result.
2020-04-13T21:11:16,626 WARN DataNucleus.Query:106 - Query for candidates of org.apache.hadoop.hive.metastore.model.MDatabase and subclasses resulted in no possible candidates
org.datanucleus.store.rdbms.exceptions.MissingTableException: Required table missing : "DBS" in Catalog "" Schema "". DataNucleus requires this table to perform its persistence operations. Either your MetaData is incorrect, or you need to enable "datanucleus.autoCreateTables"
Could you help me to resolve this problem:
pom.xml contains
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.klarna</groupId>
<artifactId>hiverunner</artifactId>
<version>5.1.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>provided</scope>
</dependency>
</dependencies>
Working project contains next:
+- org.apache.hive:hive-jdbc:jar:2.3.6:compile
[INFO] | | +- org.apache.hive:hive-metastore:jar:2.3.6:compile
[INFO] | | | +- javolution:javolution:jar:5.5.1:compile
[INFO] | | | +- org.apache.hbase:hbase-client:jar:1.1.1:compile
[INFO] | | | | +- org.apache.hbase:hbase-annotations:jar:1.1.1:compile
[INFO] | | | | +- org.apache.hbase:hbase-protocol:jar:1.1.1:compile
[INFO] | | | | +- io.netty:netty-all:jar:4.0.23.Final:compile
[INFO] | | | | +- org.jruby.jcodings:jcodings:jar:1.0.8:compile
[INFO] | | | | +- org.jruby.joni:joni:jar:2.1.2:compile
[INFO] | | | | \- com.github.stephenc.findbugs:findbugs-annotations:jar:1.3.9-1:compile
[INFO] | | | +- com.jolbox:bonecp:jar:0.8.0.RELEASE:compile
And the unworking version contains
| +- org.apache.hive:hive-jdbc:jar:1.2.1:compile
[INFO] | | +- org.apache.hive:hive-metastore:jar:1.2.1:compile
[INFO] | | | +- com.jolbox:bonecp:jar:0.8.0.RELEASE:compile
[INFO] | | | +- org.apache.derby:derby:jar:10.10.2.0:compile
[INFO] | | | +- org.datanucleus:datanucleus-api-jdo:jar:3.2.6:compile
[INFO] | | | +- org.datanucleus:datanucleus-core:jar:3.2.10:compile
[INFO] | | | +- org.datanucleus:datanucleus-rdbms:jar:3.2.9:compile
[INFO] | | | +- commons-pool:commons-pool:jar:1.5.4:compile
[INFO] | | | +- commons-dbcp:commons-dbcp:jar:1.4:compile
[INFO] | | | +- javax.jdo:jdo-api:jar:3.0.1:compile
[INFO] | | | | \- javax.transaction:jta:jar:1.1:compile

You should run the hive schema .sql scripts mentioned in $HIVE_HOME\scripts\metastore\upgrade\mysql.
NOTE: I was using MySql as the underlying db for hive.

Related

log4j exclusion from the pom.xml file

I am trying to fix log4j vulnerabilities and I have updated the existing log4j to the latest log4j-core version.
I tried adding exclusion in the googlecode.owasp dependency but the old version of log4j-1.2.12 is added in the war file. As of now, there is no change in the maven plugin.
Please let me know how to exclude log4j-1.2.12.
maven dependency:tree
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # Invoice ---
[INFO] Bookings:Invoice:war:0.0.1-SNAPSHOT
[INFO] +- Bookings:Miscellaneous:jar:0.0.1-SNAPSHOT:compile
[INFO] | +- org.owasp.esapi:esapi:jar:2.1.0:compile
[INFO] | | +- commons-configuration:commons-configuration:jar:1.5:compile
[INFO] | | | \- commons-digester:commons-digester:jar:1.8:compile
[INFO] | | +- commons-beanutils:commons-beanutils-core:jar:1.7.0:compile
[INFO] | | +- xom:xom:jar:1.2.5:compile
[INFO] | | | \- xalan:xalan:jar:2.7.0:compile
[INFO] | | \- org.beanshell:bsh-core:jar:2.0b4:compile
[INFO] | + xalan:serializer:jar:2.7.1:compile
[INFO] | | \- xml-apis:xml-apis:jar:1.3.04:compile
[INFO] | +- org.owasp.antisamy:antisamy:jar:1.4.4:compile
[INFO] | | +- xerces:xercesImpl:jar:2.8.1:compile
[INFO] | | +- org.apache.xmlgraphics:batik-css:jar:1.7:compile
[INFO] | | | +- org.apache.xmlgraphics:batik-ext:jar:1.7:compile
[INFO] | | | +- org.apache.xmlgraphics:batik-util:jar:1.7:compile
[INFO] | | | \- xml-apis:xml-apis-ext:jar:1.3.04:compile
[INFO] | | +- net.sourceforge.nekohtml;nekohtml:jar:1.9.12:compile
[INFO] | | \- commons-httpclient:commons-httpclient:jar:3.1:compile
[INFO] | +- com.mikesamuel:json-sanitizer:jar:1.2.0:compile
[INFO] | +- com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:jar:r156:compile
[INFO] | | +- com.google.guava:guava:jar:31.1-jre:compile (version selected from constraint [11.0,))
[INFO] | | | +- com.google.guava:failureaccess:jar:1.0.1:compile
[INFO] | | | +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
[INFO] | | | +- org.checkerframework:checker-qual:jar:3.12.0:compile
[INFO] | | | +- com.google.errorprone:error_prone_annotations:jar:2.11.0:compile
[INFO] | | | \- com.google.j2objc:j2objc-annotations:jar:1.3:compile
[INFO] | | \- com.google.code.findbugs:jsr305:jar:3.0.2:compile (version selected from constraint [1.3.9,))
[INFO] | \- log4j:log4j:jar:1.2.12:compile
It looks like Bookings:Miscellaneous:jar depends on log4j.
Change the bookings:miscellaneous dependency to something like this:
<dependency>
<groupId>Bookings</groupId>
<artifactId>Miscellaneous</artifactId>
<version>0.0.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
Then add a dependency to logback.
Something like this:
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>{someversion-your-choise}</version>
</dependency>
Finally,
add the adaptor from log4j to slf4j:
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-to-slf4j</artifactId>
<version>{someversion-your-choise}</version>
</dependency>

Overriding maven dependency with child dependencies

I would like to upgrade version of spring-boot-starter-logging, but I am facing the problem with overriding maven dependency.
Dependency tree before any changes:
[INFO] +- org.springframework.boot:spring-boot-starter-security:jar:2.0.1.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:2.0.1.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:2.0.1.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.10.0:compile
[INFO] | | | | \- org.apache.logging.log4j:log4j-api:jar:2.10.0:compile
[INFO] | | | \- org.slf4j:jul-to-slf4j:jar:1.7.21:compile
By modifying parent pom and overriding dependency in dependencyManagement block:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
<version>2.6.2</version>
</dependency>
</dependencies>
</dependencyManagement>
I am able to override "sole dependency" - only spring-boot-starter-logging version is updated, but child dependencies (logback-classic and log4j-to-slf4j) exists still in old versions:
[INFO] +- org.springframework.boot:spring-boot-starter-security:jar:2.0.1.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:2.0.1.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:2.6.2: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.10.0:compile
[INFO] | | | | \- org.apache.logging.log4j:log4j-api:jar:2.10.0:compile
[INFO] | | | \- org.slf4j:jul-to-slf4j:jar:1.7.21:compile
Is it possible to upgrade child dependency versions by overriding version of spring-boot-starter-logging so that new versions of child dependencies will be taken from spring-boot-starter-logging pom?
I know that I can override all the child versions one by one in dependencyManagement block, but I would like to know if there is another possibility.

Scala module 2.12.3 requires Jackson Databind version >= 2.12.0 and < 2.13.0 but I have databind 2.12.3

For a project, I'm using spark structured streaming with kafka.
I have this conf :
<spark.version>3.1.1</spark.version>
<slf4j.version>1.7.7</slf4j.version>
<log4j.version>1.2.17</log4j.version>
<scala.version>2.12</scala.version>
But when I run, I have this error :
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Scala module 2.12.3 requires Jackson Databind version >= 2.12.0 and < 2.13.0
I'm confused because I alrady import databind in 2.12.3.
Just here, an extract of my pom.xml :
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-scala_${scala.version}</artifactId>
<version>2.12.3</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.12.3</version>
</dependency>
thank you in advance for helping
Allen D.Ball, my answer is too long for comment. So,
pom.xml :
4.0.0
<parent>
<groupId>fr.cnp.kfk</groupId>
<artifactId>jee</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>kfk-spark-structured-streams</artifactId>
<packaging>jar</packaging>
<name>Spark Structured Streams</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spark.version>3.1.1</spark.version>
<slf4j.version>1.7.7</slf4j.version>
<log4j.version>1.2.17</log4j.version>
<scala.version>2.12</scala.version>
<jackson-bom.version>2.12.3</jackson-bom.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<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>
<artifactSet>
<excludes>
<exclude>org.apache.flink:force-shading</exclude>
<exclude>com.google.code.findbugs:jsr305</exclude>
</excludes>
</artifactSet>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<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.ManifestResourceTransformer">
<mainClass>fr.cnp.kfk.streams.Application</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerId>jdt</compilerId>
</configuration>
<dependencies>
<dependency>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-jdt</artifactId>
<version>0.21.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<versionRange>[2.4,)</versionRange>
<goals>
<goal>single</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<versionRange>[3.1,)</versionRange>
<goals>
<goal>testCompile</goal>
<goal>compile</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>fr.cnp.kfk</groupId>
<artifactId>kfk-commons</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_${scala.version}</artifactId>
<version>${spark.version}</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.janino</groupId>
<artifactId>commons-compiler</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql-kafka-0-10_2.12</artifactId>
<version>3.1.1</version>
<exclusions>
<exclusion>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming_${scala.version}</artifactId>
<version>${spark.version}</version>
</dependency>
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>4.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-scala_${scala.version}</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<!-- Dépendences pour RecksDB -->
<!-- <dependency> <groupId>org.apache.flink</groupId> <artifactId>flink-statebackend-rocksdb_2.12</artifactId>
<version>${flink.version}</version> <scope>provided</scope> </dependency> -->
<dependency>
<artifactId>janino</artifactId>
<groupId>org.codehaus.janino</groupId>
<version>3.0.8</version>
</dependency>
<dependency>
<artifactId>commons-compiler</artifactId>
<groupId>org.codehaus.janino</groupId>
<version>3.0.8</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>2.9.0</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-bom</artifactId>
<version>${jackson-bom.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
dependency.tree :
[INFO] --- maven-dependency-plugin:3.0.2:tree (default-cli) # kfk-spark-structured-streams ---
[INFO] fr.cnp.kfk:kfk-spark-structured-streams:jar:0.0.1-SNAPSHOT
[INFO] +- fr.cnp.kfk:kfk-commons:jar:0.0.1-SNAPSHOT:compile
[INFO] +- org.apache.spark:spark-sql_2.12:jar:3.1.1:compile
[INFO] | +- com.univocity:univocity-parsers:jar:2.9.1:compile
[INFO] | +- org.apache.spark:spark-sketch_2.12:jar:3.1.1:compile
[INFO] | +- org.apache.spark:spark-core_2.12:jar:3.1.1:compile
[INFO] | | +- org.apache.avro:avro:jar:1.8.2:compile
[INFO] | | | +- org.apache.commons:commons-compress:jar:1.8.1:compile
[INFO] | | | \- org.tukaani:xz:jar:1.5:compile
[INFO] | | +- org.apache.avro:avro-mapred:jar:hadoop2:1.8.2:compile
[INFO] | | | \- org.apache.avro:avro-ipc:jar:1.8.2:compile
[INFO] | | +- com.twitter:chill_2.12:jar:0.9.5:compile
[INFO] | | | \- com.esotericsoftware:kryo-shaded:jar:4.0.2:compile
[INFO] | | | +- com.esotericsoftware:minlog:jar:1.3.0:compile
[INFO] | | | \- org.objenesis:objenesis:jar:2.6:compile
[INFO] | | +- com.twitter:chill-java:jar:0.9.5:compile
[INFO] | | +- org.apache.hadoop:hadoop-client:jar:3.2.0:compile
[INFO] | | | +- org.apache.hadoop:hadoop-common:jar:3.2.0:compile
[INFO] | | | | +- com.google.guava:guava:jar:23.0:compile
[INFO] | | | | | +- com.google.errorprone:error_prone_annotations:jar:2.0.18:compile
[INFO] | | | | | +- com.google.j2objc:j2objc-annotations:jar:1.1:compile
[INFO] | | | | | \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile [INFO] | | | | +- commons-cli:commons-cli:jar:1.3.1:compile
[INFO] | | | | +- org.apache.httpcomponents:httpclient:jar:4.5.5:compile
[INFO] | | | | | \- org.apache.httpcomponents:httpcore:jar:4.4.9:compile
[INFO] | | | | +- commons-io:commons-io:jar:2.5:compile
[INFO] | | | | +- org.eclipse.jetty:jetty-servlet:jar:9.4.8.v20171121:compile
[INFO] | | | | +- javax.servlet.jsp:jsp-api:jar:2.2:provided
[INFO] | | | | +- org.apache.commons:commons-configuration2:jar:2.1.1:compile
[INFO] | | | | +- com.google.re2j:re2j:jar:1.1:compile
[INFO] | | | | +- com.google.code.gson:gson:jar:2.8.2:compile
[INFO] | | | | +- org.apache.hadoop:hadoop-auth:jar:3.2.0:compile
[INFO] | | | | | +- com.nimbusds:nimbus-jose-jwt:jar:4.41.1:compile
[INFO] | | | | | | \- com.github.stephenc.jcip:jcip-annotations:jar:1.0-1:compile [INFO] | | | | | \- net.minidev:json-smart:jar:2.3:compile
[INFO] | | | | | \- net.minidev:accessors-smart:jar:1.2:compile
[INFO] | | | | +- org.apache.curator:curator-client:jar:2.12.0:compile
[INFO] | | | | +- org.apache.htrace:htrace-core4:jar:4.1.0-incubating:compile
[INFO] | | | | +- org.apache.kerby:kerb-simplekdc:jar:1.0.1:compile
[INFO] | | | | | +- org.apache.kerby:kerb-client:jar:1.0.1:compile
[INFO] | | | | | | +- org.apache.kerby:kerby-config:jar:1.0.1:compile
[INFO] | | | | | | +- org.apache.kerby:kerb-core:jar:1.0.1:compile
[INFO] | | | | | | | \- org.apache.kerby:kerby-pkix:jar:1.0.1:compile
[INFO] | | | | | | | +- org.apache.kerby:kerby-asn1:jar:1.0.1:compile
[INFO] | | | | | | | \- org.apache.kerby:kerby-util:jar:1.0.1:compile
[INFO] | | | | | | +- org.apache.kerby:kerb-common:jar:1.0.1:compile
[INFO] | | | | | | | \- org.apache.kerby:kerb-crypto:jar:1.0.1:compile
[INFO] | | | | | | +- org.apache.kerby:kerb-util:jar:1.0.1:compile
[INFO] | | | | | | \- org.apache.kerby:token-provider:jar:1.0.1:compile
[INFO] | | | | | \- org.apache.kerby:kerb-admin:jar:1.0.1:compile
[INFO] | | | | | +- org.apache.kerby:kerb-server:jar:1.0.1:compile
[INFO] | | | | | | \- org.apache.kerby:kerb-identity:jar:1.0.1:compile
[INFO] | | | | | \- org.apache.kerby:kerby-xdr:jar:1.0.1:compile
[INFO] | | | | +- org.codehaus.woodstox:stax2-api:jar:3.1.4:compile
[INFO] | | | | +- com.fasterxml.woodstox:woodstox-core:jar:5.0.3:compile
[INFO] | | | | \- dnsjava:dnsjava:jar:2.1.7:compile
[INFO] | | | +- org.apache.hadoop:hadoop-hdfs-client:jar:3.2.0:compile
[INFO] | | | | \- com.squareup.okhttp:okhttp:jar:2.7.5:compile
[INFO] | | | | \- com.squareup.okio:okio:jar:1.6.0:compile
[INFO] | | | +- org.apache.hadoop:hadoop-yarn-api:jar:3.2.0:compile
[INFO] | | | | \- javax.xml.bind:jaxb-api:jar:2.3.0:provided
[INFO] | | | +- org.apache.hadoop:hadoop-yarn-client:jar:3.2.0:compile
[INFO] | | | +- org.apache.hadoop:hadoop-mapreduce-client-core:jar:3.2.0:compile
[INFO] | | | | \- org.apache.hadoop:hadoop-yarn-common:jar:3.2.0:compile
[INFO] | | | | +- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.12.3:compile
[INFO] | | | | | +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.2:compile
[INFO] | | | | | \- jakarta.activation:jakarta.activation-api:jar:1.2.1:compile [INFO] | | | | \- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.12.3:compile
[INFO] | | | | \- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.12.3:compile
[INFO] | | | +- org.apache.hadoop:hadoop-mapreduce-client-jobclient:jar:3.2.0:compile [INFO] | | | | \- org.apache.hadoop:hadoop-mapreduce-client-common:jar:3.2.0:compile [INFO] | | | \- org.apache.hadoop:hadoop-annotations:jar:3.2.0:compile
[INFO] | | +- org.apache.spark:spark-launcher_2.12:jar:3.1.1:compile
[INFO] | | +- org.apache.spark:spark-kvstore_2.12:jar:3.1.1:compile
[INFO] | | | \- org.fusesource.leveldbjni:leveldbjni-all:jar:1.8:compile
[INFO] | | +- org.apache.spark:spark-network-common_2.12:jar:3.1.1:compile
[INFO] | | +- org.apache.spark:spark-network-shuffle_2.12:jar:3.1.1:compile
[INFO] | | +- org.apache.spark:spark-unsafe_2.12:jar:3.1.1:compile
[INFO] | | +- javax.activation:activation:jar:1.1.1:provided
[INFO] | | +- org.apache.curator:curator-recipes:jar:2.13.0:compile
[INFO] | | | \- org.apache.curator:curator-framework:jar:2.13.0:compile
[INFO] | | +- org.apache.zookeeper:zookeeper:jar:3.4.14:compile
[INFO] | | | \- org.apache.yetus:audience-annotations:jar:0.5.0:compile
[INFO] | | +- jakarta.servlet:jakarta.servlet-api:jar:4.0.3:compile
[INFO] | | +- org.apache.commons:commons-math3:jar:3.4.1:compile
[INFO] | | +- com.google.code.findbugs:jsr305:jar:3.0.0:compile
[INFO] | | +- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] | | +- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
[INFO] | | +- org.slf4j:jcl-over-slf4j:jar:1.7.25:compile
[INFO] | | +- log4j:log4j:jar:1.2.17:compile
[INFO] | | +- org.slf4j:slf4j-log4j12:jar:1.7.25:compile
[INFO] | | +- com.ning:compress-lzf:jar:1.0.3:compile
[INFO] | | +- org.xerial.snappy:snappy-java:jar:1.1.8.2:compile
[INFO] | | +- org.lz4:lz4-java:jar:1.7.1:compile
[INFO] | | +- com.github.luben:zstd-jni:jar:1.4.8-1:compile
[INFO] | | +- org.roaringbitmap:RoaringBitmap:jar:0.9.0:compile
[INFO] | | | \- org.roaringbitmap:shims:jar:0.9.0:runtime
[INFO] | | +- commons-net:commons-net:jar:3.1:compile
[INFO] | | +- org.scala-lang.modules:scala-xml_2.12:jar:1.2.0:compile
[INFO] | | +- org.scala-lang:scala-reflect:jar:2.12.10:compile
[INFO] | | +- org.json4s:json4s-jackson_2.12:jar:3.7.0-M5:compile
[INFO] | | | \- org.json4s:json4s-core_2.12:jar:3.7.0-M5:compile
[INFO] | | | +- org.json4s:json4s-ast_2.12:jar:3.7.0-M5:compile
[INFO] | | | \- org.json4s:json4s-scalap_2.12:jar:3.7.0-M5:compile
[INFO] | | +- org.glassfish.jersey.core:jersey-client:jar:2.25.1:compile
[INFO] | | | +- javax.ws.rs:javax.ws.rs-api:jar:2.1:provided
[INFO] | | | +- org.glassfish.hk2:hk2-api:jar:2.5.0-b32:compile
[INFO] | | | | +- org.glassfish.hk2:hk2-utils:jar:2.5.0-b32:compile
[INFO] | | | | \- org.glassfish.hk2.external:aopalliance-repackaged:jar:2.5.0-b32:compile
[INFO] | | | +- org.glassfish.hk2.external:javax.inject:jar:2.5.0-b32:compile
[INFO] | | | \- org.glassfish.hk2:hk2-locator:jar:2.5.0-b32:compile
[INFO] | | +- org.glassfish.jersey.core:jersey-common:jar:2.25.1:compile
[INFO] | | | +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO] | | | +- org.glassfish.jersey.bundles.repackaged:jersey-guava:jar:2.25.1:compile
[INFO] | | | \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile
[INFO] | | +- org.glassfish.jersey.core:jersey-server:jar:2.25.1:compile
[INFO] | | | +- org.glassfish.jersey.media:jersey-media-jaxb:jar:2.25.1:compile
[INFO] | | | \- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | | +- org.glassfish.jersey.containers:jersey-container-servlet:jar:2.25.1:compile
[INFO] | | +- org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.25.1:compile
[INFO] | | +- org.glassfish.jersey.inject:jersey-hk2:jar:2.30:compile
[INFO] | | | \- org.javassist:javassist:jar:3.21.0-GA:compile
[INFO] | | +- io.netty:netty-all:jar:4.1.51.Final:compile
[INFO] | | +- com.clearspring.analytics:stream:jar:2.9.6:compile
[INFO] | | +- io.dropwizard.metrics:metrics-core:jar:3.1.5:compile
[INFO] | | +- io.dropwizard.metrics:metrics-jvm:jar:3.1.5:compile
[INFO] | | +- io.dropwizard.metrics:metrics-json:jar:3.1.5:compile
[INFO] | | +- io.dropwizard.metrics:metrics-graphite:jar:3.1.5:compile
[INFO] | | +- io.dropwizard.metrics:metrics-jmx:jar:4.1.1:compile
[INFO] | | +- org.apache.ivy:ivy:jar:2.4.0:compile
[INFO] | | +- oro:oro:jar:2.0.8:compile
[INFO] | | +- net.razorvine:pyrolite:jar:4.30:compile
[INFO] | | +- net.sf.py4j:py4j:jar:0.10.9:compile
[INFO] | | \- org.apache.commons:commons-crypto:jar:1.1.0:compile
[INFO] | +- org.apache.spark:spark-catalyst_2.12:jar:3.1.1:compile
[INFO] | | +- org.scala-lang.modules:scala-parser-combinators_2.12:jar:1.1.2:compile [INFO] | | +- org.antlr:antlr4-runtime:jar:4.8-1:compile
[INFO] | | +- commons-codec:commons-codec:jar:1.10:compile
[INFO] | | +- org.apache.arrow:arrow-vector:jar:2.0.0:compile
[INFO] | | | +- org.apache.arrow:arrow-format:jar:2.0.0:compile
[INFO] | | | +- org.apache.arrow:arrow-memory-core:jar:2.0.0:compile
[INFO] | | | \- com.google.flatbuffers:flatbuffers-java:jar:1.9.0:compile
[INFO] | | \- org.apache.arrow:arrow-memory-netty:jar:2.0.0:compile
[INFO] | +- org.apache.spark:spark-tags_2.12:jar:3.1.1:compile
[INFO] | +- org.apache.orc:orc-core:jar:1.5.12:compile
[INFO] | | +- org.apache.orc:orc-shims:jar:1.5.12:compile
[INFO] | | +- com.google.protobuf:protobuf-java:jar:2.5.0:compile
[INFO] | | +- commons-lang:commons-lang:jar:2.6:compile
[INFO] | | +- io.airlift:aircompressor:jar:0.10:compile
[INFO] | | \- org.threeten:threeten-extra:jar:1.5.0:compile
[INFO] | +- org.apache.orc:orc-mapreduce:jar:1.5.12:compile
[INFO] | +- org.apache.hive:hive-storage-api:jar:2.7.2:compile
[INFO] | +- org.apache.parquet:parquet-column:jar:1.10.1:compile
[INFO] | | +- org.apache.parquet:parquet-common:jar:1.10.1:compile
[INFO] | | \- org.apache.parquet:parquet-encoding:jar:1.10.1:compile
[INFO] | +- org.apache.parquet:parquet-hadoop:jar:1.10.1:compile
[INFO] | | +- org.apache.parquet:parquet-format:jar:2.4.0:compile
[INFO] | | +- org.apache.parquet:parquet-jackson:jar:1.10.1: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.apache.xbean:xbean-asm7-shaded:jar:4.15:compile
[INFO] | \- org.spark-project.spark:unused:jar:1.0.0:compile
[INFO] +- org.apache.spark:spark-sql-kafka-0-10_2.12:jar:3.1.1:compile
[INFO] | +- org.apache.spark:spark-token-provider-kafka-0-10_2.12:jar:3.1.1:compile
[INFO] | \- org.apache.kafka:kafka-clients:jar:2.6.0:compile
[INFO] +- org.apache.spark:spark-streaming_2.12:jar:3.1.1:compile
[INFO] | \- org.scala-lang:scala-library:jar:2.12.10:compile
[INFO] +- com.opencsv:opencsv:jar:4.1:compile
[INFO] | +- org.apache.commons:commons-lang3:jar:3.5:compile
[INFO] | +- org.apache.commons:commons-text:jar:1.1:compile
[INFO] | \- commons-beanutils:commons-beanutils:jar:1.9.3:compile
[INFO] | \- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.12.3:compile [INFO] | +- org.yaml:snakeyaml:jar:1.17:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.12.3:compile
[INFO] +- com.fasterxml.jackson.module:jackson-module-scala_2.12:jar:2.12.3:runtime
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.12.3:compile
[INFO] | \- com.thoughtworks.paranamer:paranamer:jar:2.8:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.12.3:compile
[INFO] +- org.codehaus.janino:janino:jar:3.0.8:compile
[INFO] +- org.codehaus.janino:commons-compiler:jar:3.0.8:compile
[INFO] \- org.apache.commons:commons-pool2:jar:2.9.0:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.334 s [INFO] Finished at: 2021-06-02T09:19:26+02:00
[INFO] ------------------------------------------------------------------------
The error :
Error: Bad target:null
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at fr.cnp.kfk.streams.Application.main(Application.java:14)
Caused by: org.apache.spark.sql.streaming.StreamingQueryException: null
[...]
at org.apache.spark.sql.execution.streaming.StreamExecution.org$apache$spark$sql$execution$streaming$StreamExecution$$runStream(StreamExecution.scala:354)
at org.apache.spark.sql.execution.streaming.StreamExecution$$anon$1.run(StreamExecution.scala:244)
Caused by: java.lang.ExceptionInInitializerError
at org.apache.spark.sql.execution.SparkPlan.executeQuery(SparkPlan.scala:215)
at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:176)
at org.apache.spark.sql.execution.datasources.v2.V2TableWriteExec.writeWithV2(WriteToDataSourceV2Exec.scala:338)
at org.apache.spark.sql.execution.datasources.v2.V2TableWriteExec.writeWithV2$(WriteToDataSourceV2Exec.scala:336)
at org.apache.spark.sql.execution.datasources.v2.WriteToDataSourceV2Exec.writeWithV2(WriteToDataSourceV2Exec.scala:297)
at org.apache.spark.sql.execution.datasources.v2.WriteToDataSourceV2Exec.run(WriteToDataSourceV2Exec.scala:304)
at org.apache.spark.sql.execution.datasources.v2.V2CommandExec.result$lzycompute(V2CommandExec.scala:40)
at org.apache.spark.sql.execution.datasources.v2.V2CommandExec.result(V2CommandExec.scala:40)
at org.apache.spark.sql.execution.datasources.v2.V2CommandExec.executeCollect(V2CommandExec.scala:46)
at org.apache.spark.sql.Dataset.collectFromPlan(Dataset.scala:3696)
at org.apache.spark.sql.Dataset.$anonfun$collect$1(Dataset.scala:2965)
at org.apache.spark.sql.Dataset.$anonfun$withAction$1(Dataset.scala:3687)
at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId$5(SQLExecution.scala:103)
at org.apache.spark.sql.execution.SQLExecution$.withSQLConfPropagated(SQLExecution.scala:163)
at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId$1(SQLExecution.scala:90)
at org.apache.spark.sql.SparkSession.withActive(SparkSession.scala:772)
at org.apache.spark.sql.execution.SQLExecution$.withNewExecutionId(SQLExecution.scala:64)
at org.apache.spark.sql.Dataset.withAction(Dataset.scala:3685)
at org.apache.spark.sql.Dataset.collect(Dataset.scala:2965)
at org.apache.spark.sql.execution.streaming.MicroBatchExecution.$anonfun$runBatch$16(MicroBatchExecution.scala:589)
at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId$5(SQLExecution.scala:103)
at org.apache.spark.sql.execution.SQLExecution$.withSQLConfPropagated(SQLExecution.scala:163)
at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId$1(SQLExecution.scala:90)
at org.apache.spark.sql.SparkSession.withActive(SparkSession.scala:772)
at org.apache.spark.sql.execution.SQLExecution$.withNewExecutionId(SQLExecution.scala:64)
at org.apache.spark.sql.execution.streaming.MicroBatchExecution.$anonfun$runBatch$15(MicroBatchExecution.scala:584)
at org.apache.spark.sql.execution.streaming.ProgressReporter.reportTimeTaken(ProgressReporter.scala:357)
at org.apache.spark.sql.execution.streaming.ProgressReporter.reportTimeTaken$(ProgressReporter.scala:355)
at org.apache.spark.sql.execution.streaming.StreamExecution.reportTimeTaken(StreamExecution.scala:68)
at org.apache.spark.sql.execution.streaming.MicroBatchExecution.runBatch(MicroBatchExecution.scala:584)
at org.apache.spark.sql.execution.streaming.MicroBatchExecution.$anonfun$runActivatedStream$2(MicroBatchExecution.scala:226)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at org.apache.spark.sql.execution.streaming.ProgressReporter.reportTimeTaken(ProgressReporter.scala:357)
at org.apache.spark.sql.execution.streaming.ProgressReporter.reportTimeTaken$(ProgressReporter.scala:355)
at org.apache.spark.sql.execution.streaming.StreamExecution.reportTimeTaken(StreamExecution.scala:68)
at org.apache.spark.sql.execution.streaming.MicroBatchExecution.$anonfun$runActivatedStream$1(MicroBatchExecution.scala:194)
at org.apache.spark.sql.execution.streaming.ProcessingTimeExecutor.execute(TriggerExecutor.scala:57)
at org.apache.spark.sql.execution.streaming.MicroBatchExecution.runActivatedStream(MicroBatchExecution.scala:188)
at org.apache.spark.sql.execution.streaming.StreamExecution.org$apache$spark$sql$execution$streaming$StreamExecution$$runStream(StreamExecution.scala:333)
... 1 more
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Scala module 2.10.5 requires Jackson Databind version >= 2.10.0 and < 2.11.0
at com.fasterxml.jackson.module.scala.JacksonModule.setupModule(JacksonModule.scala:61)
at com.fasterxml.jackson.module.scala.JacksonModule.setupModule$(JacksonModule.scala:46)
at com.fasterxml.jackson.module.scala.DefaultScalaModule.setupModule(DefaultScalaModule.scala:17)
at com.fasterxml.jackson.databind.ObjectMapper.registerModule(ObjectMapper.java:747)
at org.apache.spark.rdd.RDDOperationScope$.<init>(RDDOperationScope.scala:82)
at org.apache.spark.rdd.RDDOperationScope$.<clinit>(RDDOperationScope.scala)
... 40 more
Are you sure of the error? Scala 2.12 requires Jackson 2.10.x.
To debug, run mvn dependency:tree to see what dependencies/versions are actually being dragged in. You are probably getting other Jackson JARs that are not 2.10.x.
If you are building a Spring project (with parent POM spring-boot-dependencies), set:
<jackson-bom.version>2.10.5.20201202</jackson-bom.version>
for the latest Jackson that satisfies the Scala requirement. Otherwise, you'll need to add the following to your <dependencyManagement/>:
<dependencyManagement>
<dependencies>
...
<dependency>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-bom</artifactId>
<version>${jackson-bom.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
...
</dependencies>
</dependencyManagement>
and remove the <version> from you Jackson dependencies.

How to find out and exclude an implicit dependency with Maven3?

I have a pom.xml file with several dependencies, one of them being c3p0-0.9.5.1.jar. However, when deploying the webapp with Tomcat7, the WEB-INF/lib subdirectory contains two versions for the same dependency:
c3p0-0.9.1.1.jar
c3p0-0.9.5.1.jar
I want to exclude version 0.9.1.1. I run:
mvn dependency:tree
However, only version 0.9.5.1 appears, the other jar file is not listed here. I need to exclude that version because it's causing a library conflict and currently my ugly workaround is manually removing the 0.9.1.1 version via rm and restarting Tomcat7.
I also tried adding an <exclude> block on each dependency but the file is still placed in the WEB-INF/lib subdirectory of the Tomcat7 webapp subdirectory.
Maven version is 3.0.5-1.
How can I find out what dependency is generating that old version and how can I forcibly exclude it?
This is the full pom.xml 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>com.login.cas</groupId>
<artifactId>local-cas-management</artifactId>
<packaging>war</packaging>
<version>4.1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warName>cas-management</warName>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.jasig.cas</groupId>
<artifactId>cas-management-webapp</artifactId>
<version>${cas.version}</version>
<type>war</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.connector.version}</version>
</dependency>
<dependency>
<groupId>org.jasig.cas</groupId>
<artifactId>cas-server-support-jdbc</artifactId>
<version>${cas.version}</version>
</dependency>
<dependency>
<groupId>org.jasig.cas</groupId>
<artifactId>cas-server-support-ldap</artifactId>
<version>${cas.version}</version>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>${xml.apis.version}</version>
</dependency>
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>${c3p0.version}</version>
</dependency>
</dependencies>
<properties>
<commons.dbcp.version>2.0</commons.dbcp.version>
<cas.version>4.1.1</cas.version>
<hibernate.version>4.3.10.Final</hibernate.version>
<mysql.connector.version>5.1.6</mysql.connector.version>
<xml.apis.version>1.4.01</xml.apis.version>
<c3p0.version>0.9.5.1</c3p0.version>
</properties>
<repositories>
<repository>
<id>ja-sig</id>
<url>http://oss.sonatype.org/content/repositories/releases/ </url>
</repository>
</repositories>
</project>
This would be the associated dependency:tree. As you can see, there's no version 0.9.1.1.
[INFO] com.login.cas:local-cas-management:war:4.1.0-SNAPSHOT
[INFO] +- org.jasig.cas:cas-management-webapp:war:4.1.1:runtime
[INFO] +- org.hibernate:hibernate-core:jar:4.3.10.Final:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile
[INFO] | +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
[INFO] | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.0.0.Final:compile
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | +- 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] | +- antlr:antlr:jar:2.7.7:compile
[INFO] | \- org.jboss:jandex:jar:1.1.0.Final:compile
[INFO] +- org.hibernate:hibernate-entitymanager:jar:4.3.10.Final:compile
[INFO] +- mysql:mysql-connector-java:jar:5.1.6:compile
[INFO] +- org.jasig.cas:cas-server-support-jdbc:jar:4.1.1:compile
[INFO] | +- org.jasig.cas:cas-server-core:jar:4.1.1:compile
[INFO] | | +- org.jasig.cas:cas-server-core-api:jar:4.1.1:compile
[INFO] | | +- org.jasig.inspektr:inspektr-audit:jar:1.2.GA:compile
[INFO] | | | \- org.jasig.inspektr:inspektr-common:jar:1.2.GA:compile
[INFO] | | +- io.dropwizard.metrics:metrics-core:jar:3.1.2:compile
[INFO] | | +- io.dropwizard.metrics:metrics-annotation:jar:3.1.2:compile
[INFO] | | +- org.jasig.service.persondir:person-directory-impl:jar:1.7.0:compile
[INFO] | | | +- aopalliance:aopalliance:jar:1.0:compile
[INFO] | | | +- com.sun.xml.bind:jaxb-impl:jar:2.2.7:compile
[INFO] | | | | +- com.sun.xml.bind:jaxb-core:jar:2.2.7:compile
[INFO] | | | | | +- javax.xml.bind:jaxb-api:jar:2.2.7:compile
[INFO] | | | | | \- com.sun.istack:istack-commons-runtime:jar:2.16:compile
[INFO] | | | | \- com.sun.xml.fastinfoset:FastInfoset:jar:1.2.12:compile
[INFO] | | | | \- javax.xml.bind:jsr173_api:jar:1.0:compile
[INFO] | | | \- org.jasig.service.persondir:person-directory-api:jar:1.7.0:compile
[INFO] | | +- commons-codec:commons-codec:jar:1.10:compile
[INFO] | | +- org.springframework:spring-core:jar:4.1.6.RELEASE:compile
[INFO] | | +- org.springframework:spring-beans:jar:4.1.6.RELEASE:compile
[INFO] | | +- org.springframework:spring-webmvc:jar:4.1.6.RELEASE:compile
[INFO] | | | \- org.springframework:spring-web:jar:4.1.6.RELEASE:compile
[INFO] | | +- org.springframework:spring-context-support:jar:4.1.6.RELEASE:compile
[INFO] | | +- org.springframework:spring-tx:jar:4.1.6.RELEASE:compile
[INFO] | | +- org.springframework:spring-context:jar:4.1.6.RELEASE:compile
[INFO] | | | \- org.springframework:spring-aop:jar:4.1.6.RELEASE:compile
[INFO] | | +- org.springframework.security:spring-security-core:jar:4.0.1.RELEASE:compile
[INFO] | | +- commons-jexl:commons-jexl:jar:1.1:runtime
[INFO] | | +- commons-io:commons-io:jar:2.4:compile
[INFO] | | +- org.reflections:reflections:jar:0.9.10:compile
[INFO] | | | \- com.google.code.findbugs:annotations:jar:2.0.1:compile
[INFO] | | +- org.apache.httpcomponents:httpclient:jar:4.4.1:compile
[INFO] | | | +- org.apache.httpcomponents:httpcore:jar:4.4.1:compile
[INFO] | | | \- commons-logging:commons-logging:jar:1.1.3:compile
[INFO] | | +- javax.cache:cache-api:jar:1.0.0:compile
[INFO] | | +- org.jsr107.ri:cache-ri-impl:jar:1.0.0:runtime
[INFO] | | | \- javax.enterprise:cdi-api:jar:1.0-SP4:runtime
[INFO] | | | +- org.jboss.spec.javax.interceptor:jboss-interceptors-api_1.1_spec:jar:1.0.0.Beta1:runtime
[INFO] | | | +- javax.annotation:jsr250-api:jar:1.0:runtime
[INFO] | | | \- javax.inject:javax.inject:jar:1:runtime
[INFO] | | +- com.google.guava:guava:jar:18.0:compile
[INFO] | | +- org.bitbucket.b_c:jose4j:jar:0.4.1:compile
[INFO] | | \- org.apache.commons:commons-collections4:jar:4.0:compile
[INFO] | +- org.apache.commons:commons-lang3:jar:3.4:compile
[INFO] | +- org.springframework:spring-jdbc:jar:4.1.6.RELEASE:compile
[INFO] | +- org.springframework:spring-orm:jar:4.1.6.RELEASE:compile
[INFO] | +- org.apache.shiro:shiro-core:jar:1.2.3:compile
[INFO] | | \- commons-beanutils:commons-beanutils:jar:1.8.3:compile
[INFO] | +- org.aspectj:aspectjrt:jar:1.8.6:compile
[INFO] | +- org.aspectj:aspectjweaver:jar:1.8.6:compile
[INFO] | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | +- org.glassfish.web:javax.el:jar:2.2.6:runtime
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.12:compile
[INFO] | +- org.slf4j:jul-to-slf4j:jar:1.7.12:runtime
[INFO] | +- org.apache.logging.log4j:log4j-api:jar:2.3:runtime
[INFO] | +- org.apache.logging.log4j:log4j-core:jar:2.3:runtime
[INFO] | +- org.apache.logging.log4j:log4j-slf4j-impl:jar:2.3:runtime
[INFO] | +- org.apache.logging.log4j:log4j-jcl:jar:2.3:runtime
[INFO] | \- org.jasig.inspektr:inspektr-aspects:jar:1.2.GA:compile
[INFO] +- org.jasig.cas:cas-server-support-ldap:jar:4.1.1:compile
[INFO] | +- org.springframework.webflow:spring-webflow:jar:2.4.1.RELEASE:compile
[INFO] | | +- opensymphony:ognl:jar:2.6.11:compile
[INFO] | | +- org.springframework.webflow:spring-binding:jar:2.4.1.RELEASE:compile
[INFO] | | \- org.springframework.webflow:spring-js:jar:2.4.1.RELEASE:compile
[INFO] | | \- org.springframework.webflow:spring-js-resources:jar:2.4.1.RELEASE:compile
[INFO] | +- org.ldaptive:ldaptive:jar:1.0.7:compile
[INFO] | +- org.springframework:spring-expression:jar:4.1.6.RELEASE:compile
[INFO] | +- joda-time:joda-time:jar:2.8.1:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-databind:jar:2.5.3:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.5.0:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.5.3:compile
[INFO] +- xml-apis:xml-apis:jar:1.4.01:compile
[INFO] \- com.mchange:c3p0:jar:0.9.5.1:compile
[INFO] \- com.mchange:mchange-commons-java:jar:0.2.10:compile
If you want to proceed in a clean way, I strongly suggest you use Eclipse to check your dependency hierarchy. The Maven integration plugin provides for pom.xml files a Dependency Hierarchy view that lets you view which dependencies refer to one another.
In this view, you can manually exclude a given artifact by right-clicking it and selecting Exclude Maven Artifact... from the context menu.
You will be shown a dialog asking where to place dependency exclusion. Usually you shouldn't have to change the selection. Click OK and the <exclude> element will be automatically placed into the pom.xml file for you. If you are comfortable with the modified pom.xml file, don't forget to save it before you rebuild your project.
Apart from adjusting your pom.xml file, run a mvn clean package command to make sure no stale dependencies remain in your target folder.
Try this
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<packagingExcludes>WEB-INF/lib/c3p0-0.9.1.1.jar</packagingExcludes>
</configuration>
</plugin>

jersey-spring and jenkins - strange error reading zip file /jersey-core-1.8.jar

We have a REST server that we want to build in jenkins. Locally everything's builds fine but when I tell jenkins to build the project it gives me
[INFO] Copying 1 resource
[WARNING] POM for 'com.sun.jersey:jersey-core:pom:1.8:compile' is invalid. Its dependencies (if any) will NOT be available to the current build.
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 2 source files to /usr/share/tomcat6/.jenkins/workspace/xx-engine-integration-server SNAPSHOT/target/classes
[JENKINS] Archiving /usr/share/tomcat6/.jenkins/workspace/xx-engine-integration-server SNAPSHOT/pom.xml to /usr/share/tomcat6/.jenkins/jobs/xx-engine-integration-server SNAPSHOT/modules/our.package.apps$xx-engine-integration-server/builds/2012-07-04_05-23-22/archive/our.package.apps/xx-engine-integration-server/1.0-SNAPSHOT/xx-engine-integration-server-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure error: error reading /usr/share/tomcat6/.m2/repository/com/sun/jersey/jersey-core/1.8/jersey-core-1.8.jar; error in opening zip file
Anyone seen this before? Why would the jersey-core pom be invalid? Why does jenkins need tomcat to build my project?
My pom
<!-- ... -->
<packaging>war</packaging>
<!-- Build -->
<build>
<!-- Filtering -->
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>projects-maven</id>
<name>My Maven Repository</name>
<url>http://path.to.our/repository</url>
</repository>
</repositories>
<dependencies>
<!-- Include Spring 3.1 dependencies and more.. -->
<dependency>
<groupId>our.path</groupId>
<artifactId>core-modules</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-spring</artifactId>
<version>1.8</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
The dependency tree:
[INFO]
[INFO] --- maven-dependency-plugin:2.4:tree (default-cli) # xx-manager ---
[INFO] our.package.apps:xx-manager:war:1.0-SNAPSHOT
[INFO] +- our.package.base:xx-connect:jar:1.0-SNAPSHOT:compile
[INFO] | +- our.package.base:xx-core:jar:1.1-SNAPSHOT:compile
[INFO] | | +- org.springframework:spring-aspects:jar:3.1.0.RELEASE:compile
[INFO] | | +- org.springframework:spring-orm:jar:3.1.0.RELEASE:compile
[INFO] | | +- org.aspectj:aspectjrt:jar:1.6.12:compile
[INFO] | | +- org.aspectj:aspectjweaver:jar:1.6.12:compile
[INFO] | | +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] | | +- commons-lang:commons-lang:jar:2.3:compile
[INFO] | | +- log4j:log4j:jar:1.2.16:compile
[INFO] | | +- org.slf4j:slf4j-api:jar:1.6.1:compile
[INFO] | | +- org.slf4j:jcl-over-slf4j:jar:1.6.1:runtime
[INFO] | | +- org.slf4j:slf4j-log4j12:jar:1.6.1:runtime
[INFO] | | +- junit:junit:jar:4.10:compile
[INFO] | | | \- org.hamcrest:hamcrest-core:jar:1.1:compile
[INFO] | | +- org.powermock:powermock-module-junit4:jar:1.4.11:compile
[INFO] | | | \- org.powermock:powermock-module-junit4-common:jar:1.4.11:compile
[INFO] | | | +- org.powermock:powermock-core:jar:1.4.11:compile
[INFO] | | | \- org.powermock:powermock-reflect:jar:1.4.11:compile
[INFO] | | | \- org.objenesis:objenesis:jar:1.2:compile
[INFO] | | +- org.powermock:powermock-api-mockito:jar:1.4.11:compile
[INFO] | | | \- org.powermock:powermock-api-support:jar:1.4.11:compile
[INFO] | | +- org.mockito:mockito-all:jar:1.8.4:compile
[INFO] | | +- com.google.guava:guava:jar:10.0.1:compile
[INFO] | | | \- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] | | +- com.natpryce:make-it-easy:jar:3.1.0:compile
[INFO] | | | +- org.hamcrest:hamcrest-library:jar:1.2.1:compile
[INFO] | | | \- junit:junit-dep:jar:4.8.1:compile
[INFO] | | +- javax.inject:javax.inject:jar:1:compile
[INFO] | | +- cglib:cglib:jar:2.2:compile
[INFO] | | +- joda-time:joda-time:jar:1.6.2:compile
[INFO] | | +- org.apache.cxf:cxf-rt-frontend-jaxws:jar:2.6.0:compile
[INFO] | | | +- xml-resolver:xml-resolver:jar:1.2:compile
[INFO] | | | +- org.apache.cxf:cxf-api:jar:2.6.0:compile
[INFO] | | | | +- org.codehaus.woodstox:woodstox-core-asl:jar:4.1.2:runtime
[INFO] | | | | | \- org.codehaus.woodstox:stax2-api:jar:3.1.1:runtime
[INFO] | | | | +- org.apache.ws.xmlschema:xmlschema-core:jar:2.0.2:compile
[INFO] | | | | +- org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.7.1:compile
[INFO] | | | | \- wsdl4j:wsdl4j:jar:1.6.2:compile
[INFO] | | | +- org.apache.cxf:cxf-rt-core:jar:2.6.0:compile
[INFO] | | | +- org.apache.cxf:cxf-rt-bindings-soap:jar:2.6.0:compile
[INFO] | | | | \- org.apache.cxf:cxf-rt-databinding-jaxb:jar:2.6.0:compile
[INFO] | | | +- org.apache.cxf:cxf-rt-bindings-xml:jar:2.6.0:compile
[INFO] | | | +- org.apache.cxf:cxf-rt-frontend-simple:jar:2.6.0:compile
[INFO] | | | \- org.apache.cxf:cxf-rt-ws-addr:jar:2.6.0:compile
[INFO] | | | \- org.apache.cxf:cxf-rt-ws-policy:jar:2.6.0:compile
[INFO] | | | \- org.apache.neethi:neethi:jar:3.0.2:compile
[INFO] | | +- org.apache.cxf:cxf-rt-transports-http:jar:2.6.0:compile
[INFO] | | \- org.apache.cxf:cxf-rt-transports-local:jar:2.6.0:compile
[INFO] | +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.5:compile
[INFO] | | \- org.codehaus.jackson:jackson-core-asl:jar:1.9.5:compile
[INFO] | +- com.sun.jersey:jersey-server:jar:1.12:compile
[INFO] | | +- asm:asm:jar:3.1:compile
[INFO] | | \- com.sun.jersey:jersey-core:jar:1.12:compile
[INFO] | +- com.sun.jersey:jersey-client:jar:1.12:compile
[INFO] | +- com.sun.jersey:jersey-json:jar:1.12:compile
[INFO] | | +- org.codehaus.jettison:jettison:jar:1.1:compile
[INFO] | | | \- stax:stax-api:jar:1.0.1:compile
[INFO] | | +- com.sun.xml.bind:jaxb-impl:jar:2.2.3-1:compile
[INFO] | | | \- javax.xml.bind:jaxb-api:jar:2.2.2:compile
[INFO] | | | +- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] | | | \- javax.activation:activation:jar:1.1:compile
[INFO] | | +- org.codehaus.jackson:jackson-jaxrs:jar:1.9.2:compile
[INFO] | | \- org.codehaus.jackson:jackson-xc:jar:1.9.2:compile
[INFO] | \- com.sun.jersey.contribs:jersey-multipart:jar:1.6:compile
[INFO] | \- org.jvnet:mimepull:jar:1.4:compile
[INFO] +- our.package.base:xx-security:jar:1.1-SNAPSHOT:compile
[INFO] | +- our.package.base:xx-data-jpa:jar:1.1-SNAPSHOT:compile
[INFO] | | +- org.springframework.data:spring-data-jpa:jar:1.0.3.RELEASE:compile
[INFO] | | +- org.springframework.data:spring-data-commons-core:jar:1.1.0.RELEASE:compile
[INFO] | | +- org.hibernate:hibernate-core:jar:4.1.3.Final:compile
[INFO] | | | +- antlr:antlr:jar:2.7.7:compile
[INFO] | | | +- org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile
[INFO] | | | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.0.Final:compile
[INFO] | | | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | | +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
[INFO] | | | +- org.javassist:javassist:jar:3.15.0-GA:compile
[INFO] | | | \- org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final:compile
[INFO] | | +- org.hibernate:hibernate-entitymanager:jar:4.1.3.Final:compile
[INFO] | | +- javax.validation:validation-api:jar:1.0.0.GA:compile
[INFO] | | +- org.hibernate:hibernate-validator:jar:4.3.0.Final:compile
[INFO] | | +- com.mysema.querydsl:querydsl-apt:jar:2.6.0:compile
[INFO] | | | \- com.mysema.querydsl:querydsl-codegen:jar:2.6.0:compile
[INFO] | | | \- com.mysema.codegen:codegen:jar:0.4.11:compile
[INFO] | | +- com.mysema.querydsl:querydsl-jpa:jar:2.6.0:compile
[INFO] | | | \- com.mysema.querydsl:querydsl-core:jar:2.6.0:compile
[INFO] | | | \- com.mysema.commons:mysema-commons-lang:jar:0.2.2:compile
[INFO] | | \- mysql:mysql-connector-java:jar:5.1.11:compile
[INFO] | +- our.package.base:xx-utils:jar:1.1-SNAPSHOT:compile
[INFO] | | \- net.sf.opencsv:opencsv:jar:2.3:compile
[INFO] | +- org.springframework.security:spring-security-core:jar:3.1.0.RELEASE:compile
[INFO] | +- org.springframework.security:spring-security-config:jar:3.1.0.RELEASE:compile
[INFO] | +- org.springframework.security:spring-security-web:jar:3.1.0.RELEASE:compile
[INFO] | +- org.springframework.security:spring-security-acl:jar:3.1.0.RELEASE:compile
[INFO] | +- org.springframework.security:spring-security-crypto:jar:3.1.0.RELEASE:compile
[INFO] | \- net.sf.ehcache:ehcache-core:jar:2.4.6:compile
[INFO] +- our.package.base:xx-view-mvc:jar:1.0-SNAPSHOT:compile
[INFO] | +- org.springframework:spring-webmvc:jar:3.1.0.RELEASE:compile
[INFO] | | \- org.springframework:spring-context-support:jar:3.1.0.RELEASE:compile
[INFO] | +- org.springframework:spring-test:jar:3.1.0.RELEASE:compile
[INFO] | +- cglib:cglib-nodep:jar:2.2:compile
[INFO] | +- javax.servlet:jstl:jar:1.2:compile
[INFO] | \- org.freemarker:freemarker:jar:2.3.19:compile
[INFO] +- our.package.company:xx-engine-integration-server:war:1.0-SNAPSHOT:test
[INFO] +- javax.servlet:servlet-api:jar:2.5:provided
[INFO] +- javax.servlet.jsp:jsp-api:jar:2.1:provided
[INFO] +- org.springframework:spring-test-mvc:jar:1.0.0.BUILD-SNAPSHOT:test
[INFO] +- xmlunit:xmlunit:jar:1.3:test
[INFO] +- org.springframework:spring-aop:jar:3.1.0.RELEASE:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-asm:jar:3.1.0.RELEASE:compile
[INFO] +- org.springframework:spring-context:jar:3.1.0.RELEASE:compile
[INFO] +- org.springframework:spring-beans:jar:3.1.0.RELEASE:compile
[INFO] +- org.springframework:spring-core:jar:3.1.0.RELEASE:compile
[INFO] | \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- org.springframework:spring-tx:jar:3.1.0.RELEASE:compile
[INFO] +- org.springframework:spring-web:jar:3.1.0.RELEASE:compile
[INFO] +- org.springframework:spring-jdbc:jar:3.1.0.RELEASE:compile
[INFO] \- org.springframework:spring-expression:jar:3.1.0.RELEASE:compile
So it's the usual: dependency conflicts.. as mvn dependency:tree -Dincludes=com.sun.jersey showed. Sigh..
Solution was to updgrade to jersey-spring 1.12.
That's what you get for copying dependencies from tutorials without worrying about versions and then mixing them with your own project.

Categories

Resources