I am working on project with my friends in which there are lot of dependencies which are required by lot of modules.
Scenario is like this :-
i am using datastax drivers for apache_cassandra and spark_cassandra_connector which requires different versions of io.netty modules.
spark_cassandra_connector requires cassandra-driver-core which i am already using in my project.
First problem arrived on my friend's laptop which was some netty-epoll error that it didn't find some method although mine was working fine without any error.(same pom.xml)
After working on error we found out there were different versions of io.netty which was used by project dependencies which may be causing the error.
so we used global version of io.netty modules that is :-
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>${netty.version}</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<version>${netty.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
That Problem was fixed .
Now same method not found error is happening in my friends laptop with cassandra-driver-core . so we decided to use cassandra drivers globally
that is :-
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>${netty.version}</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-</artifactId>
<version>${netty.version}</version>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
<version>${cassandra-driver.version}</version>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-extras</artifactId>
<version>${cassandra-driver.version}</version>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-mapping</artifactId>
<version>${cassandra-driver.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
which is not working.
i have tried excluding cassandra-driver-core from spark connectors
<dependency>
<groupId>com.datastax.spark</groupId>
<artifactId>spark-cassandra-connector-java_2.10</artifactId>
<version>${spark.version}</version>
<exclusions>
<exclusion>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
</exclusion>
<exclusion>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-mapping</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.datastax.spark</groupId>
<artifactId>spark-cassandra-connector_2.10</artifactId>
<version>${spark.version}</version>
<exclusions>
<exclusion>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
</exclusion>
</exclusions>
</dependency>
which also didn't work and this problem is happening on friends system not mine.
is there any thing i need to know about maven or does any body knows why it is happening version i am using has that method.
why other system is not picking up that version or overriding other version which is used by spark module.
i have checked dependency tree on both systems in verbose which shows the same output (in case maven is picking up another version on other system but which is not case also)
i have tried cleaning the .m2 folder on other system which also didn't work.
what can be the solution ??
Related
I followed the usual procedure in adding the dependency for the es high level rest client, but it seems like maven is ignoring it completely. Here's my pom config -
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>${elasticsearch.version}</version>
<exclusions>
<exclusion>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>${elasticsearch.version}</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>>${elasticsearch.version}</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-client</artifactId>
<version>${elasticsearch.version}</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-client-sniffer</artifactId>
<version>${elasticsearch.version}</version>
</dependency>
We are also using spring boot too, but that should not be an issue here, as it is downloading all es dependencies except the high level rest client. The version is 6.8.7. Please help.
UPDATE:
I resolved this by creating a new project, basically there were some conflicts in the existing project and I am yet to debug that.
Please find snippet of my pom below and, important, I would highly recommend to start using version 7 of the Rest High Level Client library. We ran into major problems (mostly load-related) when using version 6 and Elastic decided for a full rewrite of their library.
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>7.4.0</version>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>7.4.0</version>
</dependency>
Im trying mess around with graph ql and integrating it with our existing project. Im following this tutorial since our project is java with spring framework
but after adding the dependencies
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-spring-boot-starter</artifactId>
<version>5.0.2</version>
</dependency>
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java-tools</artifactId>
<version>5.2.4</version>
</dependency>
and trying to start my project i get an error
Caused by: org.apache.logging.log4j.LoggingException: log4j-slf4j-impl
cannot be present with log4j-to-slf4j
I have found similar post here, and here
Which lead me to attempt to add exclusions but that did NOT help
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-spring-boot-starter</artifactId>
<version>5.0.2</version>
<exclusions>
<exclusion>
<groupId>log4j-slf4j-impl</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>log4j-to-slf4j</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
Excluded dependencies groupId seems wrong. Changing excluded groupId's to org.apache.logging.log4j may solve your problem.
i ended up using
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java</artifactId>
<version>5.0.2</version>
</dependency>
I'm using renjin in a Java web application to load RData files.
Since I'm in a corporate network i only have access to packages from maven central. Since renjin is hosted in a different repository i downloaded the standalone jar (renjin-script-engine-3.5-beta43.jar) from the website and manually installed it in my local maven repository.
The integration with Java works fine.
I'm using slf4j (1.7.28) in my application as the main logging api. However, when i try to add log4j2 (2.12.1) as the logging implementation to use, i get a slf4j warning upon startup due to multiple implementations on the classpath:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:<project-path>/target/<project-name>-0.0.1-SNAPSHOT/WEB-INF/lib/log4j-slf4j-impl-2.12.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:<project-path>/target/<project-name>-0.0.1-SNAPSHOT/WEB-INF/lib/renjin-script-engine-3.5-beta43.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
It seems renjin includes a slf4j implementation at compile time, which is something slf4j recommends against. Since the implementation isn't added as a transitive dependency, i can't exclude it in maven.
The slf4j documentation says it should mention which implementation it binds against, but i don't have any output in that regard. My current log4j2.xml configuration seems to have no effect on the log output i see, but i don't know if that is due to a problem in the configuration or because slf4j binds against the other implementation. To properly debug this i would like to fix the slf4j warning and have only log4j2 as an implementation on the classpath.
I also looked at compiling renjin myself but it requires an old gcc version (4.7) which i can't install ony my machine (Ubuntu 18.04.3). In addition some of the build dependencies are located on other repositories, which i can't access due to network restrictions.
The newest renjin jar (beta73) also includes the slf4j implementation classes mentioned. Is this an issue i should bring up on the renjin github page, or is there some other way i can use renjin without the included slf4j implementation?
For reference, this is my current pom.xml (i have replaced the project name, groupId and artifactId with generic placeholders):
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId><my-group></groupId>
<artifactId><my-project></artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name><project-name></name>
<description>Backend for LDB</description>
<properties>
<java.version>11</java.version>
<ignite.version>2.7.6</ignite.version>
<!-- Springboot will default to 1.4.199, which will not work with ignite. -->
<h2.version>1.4.197</h2.version>
<log4j2.version>2.12.1</log4j2.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.renjin</groupId>
<artifactId>renjin-script-engine</artifactId>
<version>RELEASE</version>
</dependency>
<dependency>
<groupId>de.grundid.opendatalab</groupId>
<artifactId>geojson-jackson</artifactId>
<version>1.8.1</version>
</dependency>
<!--
The swagger libraries included in springfox contain a bug that will log various NumberFormatExceptions due to not set example values
in ApiModelProperty, when rendering the Swagger UI. To fix this we load a newer version of these swagger libraries.
See: https://github.com/springfox/springfox/issues/2265#issuecomment-413286451
-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
<exclusions>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.23</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.5.23</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<!-- Apache Ignite -->
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-core</artifactId>
<version>${ignite.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-spring</artifactId>
<version>${ignite.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-indexing</artifactId>
<version>${ignite.version}</version>
</dependency>
<!-- Logging Slf4j with log4j2 as the implementation -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${log4j2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-web</artifactId>
<version>${log4j2.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
It sounds like you've downloaded the renjin-script-engine-3.5-beta43-jar-with-dependencies.jar.
This distribution does include all of Renjin's dependencies, and is intended for those who are not using Maven or another build tool.
If you're unable to use Renjin's repository, you'd have to install the "normal" renjin-script-engine.jar and its pom file into your local maven repository, along with all of its dependencies, some of which are only available from our repository.
You can start here:
https://nexus.bedatadriven.com/content/groups/public/org/renjin/renjin-script-engine/3.5-beta76/
But it will be alot of manual work.
Can I ask what is preventing you from accessing the repository? The jar you downloaded is also hosted in our repository, so it doesn't sound like a firewall issue...
I looked at the source code of renjin-script-engine at Renjin's Repository and the renjin jar didn't include StaticLoggerBinder class. So I believe the JAR you installed manually is incorrect one.
P.S. Usage of RELEASE as version is not recommended.
Am using a kafka-client dependency in my project abc-bus-api. The version is 2.1.0. See below.
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>2.1.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
Now this above project is a dependency in another project abc-lib. Here i see a different kafka-client version than what i have specified in my abc-bus-api. See below.
maven tree in STS (for kafka):
Any guess what am doing wrong here.
I'm new to Maven. I recently learned it to solve some dependency issues I'm having with a Java and Spring WebApp. I've been trying maven out on a small sample webapp. The webapp uses JSTL tags. I found it necessary to put these tags in pom.xml:
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
<version>1.2-rev-1</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jstl-impl</artifactId>
<version>1.2</version>
</dependency>
These get 2 jars that I need:
jstl-api-1.2-rev-1.jar
jstl-impl-1.2.jar
BUT it also includes THIS jar in my WEB-INF/lib, the inclusion of which causes all sorts of errors when I try to run it in Tomcat 7:
jsp-api-2.1.jar
Is there a way I can rewrite my dependency tags to leave jsp-api-2.1.jar out of my WEB-INF/lib ?
Thanks
Fixed. Thanks Guys. FWIW, this is how I changed the dependency tags for the JSTL to not put the JSP-API jar in my WEB-INF lib:
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
<version>1.2-rev-1</version>
<exclusions>
<exclusion>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jstl-impl</artifactId>
<version>1.2</version>
<exclusions>
<exclusion>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
</exclusion>
</exclusions>
</dependency>
I was able to find the groupID and artifactID at this site
https://repository.sonatype.org/index.html#welcome
Have exclusions section, similar to the one below.
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.2.6.ga</version>
<exclusions>
<exclusion>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
</exclusion>
</exclusions>
</dependency>
In your case, one (or both) of the dependencies you add include the one that you do not need. Find which one, and add the exclusion section.
Change the scope to 'provided'. EG:
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jstl-impl</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
The provided scope ensures that jar is available to the compiler, but assumes that it will be 'provided' at runtime when the code is run. In your cast, it is provided by Tomcat.