Failure to find org.springframework:spring-webmvc-portlet:jar:5.3.22 in https://repo.maven.apache.org/maven2 - spring

Recently, I am trying to upgrade my spring version to 5.3.22 and hibernate-core to 5.4.33.Final. However, I am facing this error Failure to find org.springframework:spring-webmvc-portlet:jar:5.3.22 in https://repo.maven.apache.org/maven2 although I have added the dependency as follow:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc-portlet</artifactId>
<version>5.3.22</version>
</dependency>
I have checked from here that spring-webmvc 5.3.22 is a legitimate version. Any idea on how to fix this ?

Related

How to resolve NoSuchMethodError in spring TransactionSynchronizationManager.currentTransaction when using pring-data-r2dbc

I am writing service based on Spring webflux, which reads data from PostgreSQL using r2dbc. I need to use latest release of r2dbc, however I am getting NoSuchMethodError exception in using TransactionSynchronizationManager spring-tx 5.2.0.RELEASE library.
I basically need to know what is correct spring-tx library version to be compatible with version of spring-data-r2dbc which works correctly with latest r2dbc-postgresql and r2dbc-spi libraries.
Here are my Maven dependencies.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-r2dbc</artifactId>
<version>1.0.0.M2</version>
</dependency>
<dependency>
<groupId>io.r2dbc</groupId>
<artifactId>r2dbc-postgresql</artifactId>
<version>0.8.0.RC2</version>
</dependency>
<dependency>
<groupId>io.r2dbc</groupId>
<artifactId>r2dbc-spi</artifactId>
<version>0.8.0.M8</version>
</dependency>
I am using interface extending ReactiveCrudRepository interface to retrieve table data per below.
#Query("...")
Flux<QuoteHistory> findAllBySecIdAndDateTimeBetweenAndUpdateTypeIn(LocalDate date, Long secId);
I was able to get this code to work with earlier versions of r2dbc-postgresql and r2dbc-spi but now I am getting following exception.
java.lang.NoSuchMethodError: org.springframework.transaction.reactive.TransactionSynchronizationManager.currentTransaction()Lreactor/core/publisher/Mono;
at org.springframework.data.r2dbc.connectionfactory.ConnectionFactoryUtils.doGetConnection(ConnectionFactoryUtils.java:88) ~[spring-data-r2dbc-1.0.0.M2.jar:1.0.0.M2]
at org.springframework.data.r2dbc.connectionfactory.ConnectionFactoryUtils.getConnection(ConnectionFactoryUtils.java:70) ~[spring-data-r2dbc-1.0.0.M2.jar:1.0.0.M2]
at org.springframework.data.r2dbc.core.DefaultDatabaseClient.getConnection(DefaultDatabaseClient.java:189) ~[spring-data-r2dbc-1.0.0.M2.jar:1.0.0.M2]
These are r2dbc dependencies which code works with.
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-r2dbc</artifactId>
<version>1.0.0.M1</version>
</dependency>
<dependency>
<groupId>io.r2dbc</groupId>
<artifactId>r2dbc-postgresql</artifactId>
<version>1.0.0.M7</version>
</dependency>
Please use the following dependency combination:
R2DBC Postgres: 0.8.0.RC2
R2DBC SPI: 0.8.0.RC2
Spring Data R2DBC: 1.0.0.RC1
Spring Framework: 5.2.0.RELEASE
Alternatively, go to https://start.spring.io to get a dependency-managed project with versions that work together.

Correct the classpath of your application so that it contains a single, compatible version of org.elasticsearch.common.logging.Loggers

I'm getting following error while running my Spring boot app, I'm new to Spring boot and elastic search, please help to solve this issue.And attached my pom dependencies below.
Thanks in advance,
*************************** APPLICATION FAILED TO START ***************************
Description:
An attempt was made to call the method org.elasticsearch.common.logging.Loggers.getLogger(Ljava/lang/String;)Lorg/apache/logging/log4j/Logger; but it does not exist. Its class, org.elasticsearch.common.logging.Loggers, is available from the following locations:
jar:file:/C:/Users/Sudhakar/.m2/repository/org/elasticsearch/elasticsearch/6.6.2/elasticsearch-6.6.2.jar!/org/elasticsearch/common/logging/Loggers.class
It was loaded from the following location:
file:/C:/Users/Sudhakar/.m2/repository/org/elasticsearch/elasticsearch/6.6.2/elasticsearch-6.6.2.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.elasticsearch.common.logging.Loggers
Process finished with exit code 1
Maven dependencies:
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-to-slf4j</artifactId>
<version>2.11.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.24</version>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>6.6.2</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>6.6.2</version>
</dependency>
Spring Boot uses Elasticsearch 6.4 by default. By using 6.6.2 as the versions for two Elasticsearch modules you will have ended up with a mixture of the two versions. You should remove the <version> configuration in your pom. If you are able to use Spring Boot’s default version there’s nothing more to do. If you need to use 6.6.2 you should add an entry in your pom’s <properties>:
<elasticsearch.version>6.6.2</elasticsearch.version>

spring-boot upgrade from 1.3.2 to 1.3.3: logback issue

We've hit an issue when upgrading from spring-boot 1.3.2 to the recently released 1.3.3.
Our application has been making use of the following dependencies, each the latest, without issue:
<neo4j.version>2.3.2</neo4j.version>
<sdn.version>4.0.0.RELEASE</sdn.version>
<sdn.rest.version>3.4.0.RELEASE</sdn.rest.version>
<neo4j.ogm.version>1.1.5</neo4j.ogm.version>
Today I upgraded our spring-boot and Spring Data Neo4j -based application, which starts and works well with spring-boot 1.3.2.RELEASE, by changing the pom.xml from:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.2.RELEASE</version>
</parent>
to
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.3.RELEASE</version>
</parent>
With this being literally the only change, the application now fails to start with the following error:
...
Failed to instantiate [ch.qos.logback.classic.LoggerContext]
Reported exception:
java.lang.AbstractMethodError: ch.qos.logback.classic.pattern.EnsureExceptionHandling.process(Lch/qos/logback/core/pattern/Converter;)V
at ch.qos.logback.core.pattern.PatternLayoutBase.start(PatternLayoutBase.java:88)
at ch.qos.logback.classic.encoder.PatternLayoutEncoder.start(PatternLayoutEncoder.java:28)
at ch.qos.logback.core.joran.action.NestedComplexPropertyIA.end(NestedComplexPropertyIA.java:167)
at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:317)
at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:196)
at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:182)
at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:62)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:149)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:135)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:99)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:49)
at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:77)
at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:152)
at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85)
at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:143)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:122)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:378)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:328)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:349)
at com.mycompany.Application.<clinit>(Application.java:35)
As expected, returning to 1.3.2.RELEASE does not cause any issues.
Searching so far reveals no trail to follow. Comparing the mvn dependency:tree output between using spring-boot 1.3.2.RELEASE and 1.3.3.RELEASE, I can see that the transient dependencies of ch.qos.logback:logback-classic and ch.qos.logback:logback-access jars have changed from 1.1.3 for spring-boot 1.3.2.RELEASE to 1.1.5 for spring-boot 1.3.3.RELEASE, while ch.qos.logback:logback-core remains at 1.1.3 for both spring-boot flavors.
Does anyone have any idea of what the underlying issue is (I'm guessing the class failing to instantiate has been removed or relocated) and/or -- more importantly -- what I can do to resolve it?
Spring Boot is missing some dependency management for logback-core which is allowing different versions to creep in. I've opened an issue to address that.
In the meantime, you can avoid the problem by adding your own dependency management for it to your pom:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Hbase 0.98.0-hadoop2 mvn dependency

I am adding hbase jars in my client project using mvn dependency
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase</artifactId>
<version>0.98.0-hadoop2</version>
</dependency>
However, mvn is not able to find the required version and is giving error. I myself checked at following link but there is no hbase-0.98.0-hadoop2.jar present at that location. Please help
Downloading: http://repo1.maven.org/maven2/org/apache/hbase/hbase/0.98.0-hadoop2/hbase-0.98.0-hadoop2.jar
[INFO] Unable to find resource 'org.apache.hbase:hbase:jar:0.98.0-hadoop2' in repository java.net (http://repo1.maven.org/maven2)
Downloading: https://repository.jboss.org/maven2//org/apache/hbase/hbase/0.98.0-hadoop2/hbase-0.98.0-hadoop2.jar
[INFO] Unable to find resource 'org.apache.hbase:hbase:jar:0.98.0-hadoop2' in repository jboss (https://repository.jboss.org/maven2/)
Thanks in advance.
Dependency definition which you have mentioned has been updated. Use below maven dependency definition instead :-
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
<version>0.98.8-hadoop2</version>
</dependency>
this will solve your problem.

Spring + Hibernate + Tomcat Dependency problems

when I run tomcat and the war is deployed I get :
NoClassDefFoundError : org/apache/commons/collections/map/LRUMap
Invocation of init method failed; nested exception is
java.lang.NoClassDefFoundError:
org/apache/commons/collections/map/LRUMap
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
~[spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
What is strange is that I got the commons-collections-2.1.jar (I even tried 3.1) in my WEB-INF lib folder.
Edit :
I did copy the commons-collections from WEB-INF/lib to Tomcat lib and it seems to work. However I won't be able to do that on the production server, why isn't it taking my WEB-INF/lib version ?
Ok so I did put version 3.2.1 of commons-collections and the error disappeared. I unfortunately still don't know which library is depending on this version. Even mvn dependency:tree didn't help ...
I had this exception when I was with xdoclet on dependencies.
If you are with this dependency, just exclude it.
I have the same probleme, maybe it's too late to approve the answer but it's still benefitial for people who will have this problem in the futur.
So I exclude commons-collections from net.sf.jasperreports, after that the tomcat runs perfectly whithout any problem.
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>4.1.1</version>
<type>jar</type>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>commons-collections</artifactId>
<groupId>commons-collections</groupId>
</exclusion>
</exclusions>
</dependency>

Resources