How to override the spring boot version used by jhipster - spring-boot

my JHipster generated application uses
<jhipster-dependencies.version>2.0.28</jhipster-dependencies.version>
which includes Spring Boot v.2.0.6
But I want to use Spring Boot 2.1.1
What do I need to change in my pom.xml to achieve that.
I tried to set <spring-boot.version>2.1.1.RELEASE</spring-boot.version>
But when I build & run, still v2.0.6 is used.

Thanks for asking this question. The comment to your question by Gael pointed me in the right direction. I've just completed an upgrade of my legacy project. Here is how I did it:
Go to this link: https://www.jhipster.tech/upgrading-an-application/
Follow the instructions for automatic upgrade ( Make sure before you upgrade that you create a new branch, there are sure to be merge conflicts).
Resolve the merge conflicts and run your tests.
Commit the changes to avoid having to repeat the work.
Above all read the instructions and understand them before beginning because otherwise you will become frustrated.
You can get the list of JHipster release versions here: https://www.jhipster.tech/releases/

I faced the same problem, my jhipster version is 3.9.1 and spring boot's version is 2.2.7.RELEASE.
So to upgrade spring-boot.version to latest 2.7.5:
Add dependency management from Spring Boot before Jhipster as follow:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.github.jhipster</groupId>
<artifactId>jhipster-dependencies</artifactId>
<version>${jhipster-dependencies.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
It worked for me

Related

Method does not exist: org.elasticsearch.client.RequestOptions$Builder.setRequestConfig(Lorg/apache/http/client/config/RequestConfig;)

I am creating Hibernate Search 6 application with Spring Boot 2.3.4
I am facing this error while I try to build my application -
Description:
An attempt was made to call a method that does not exist. The attempt was made from the
following location:
org.hibernate.search.backend.elasticsearch.client.impl.ElasticsearchClientImpl.setPerRequestSocketTimeout(ElasticsearchClientImpl.java:198)
The following method did not exist:
org.elasticsearch.client.RequestOptions$Builder.setRequestConfig(Lorg/apache/http/client/config/RequestConfig;)Lorg/elasticsearch/client/RequestOptions$Builder;
The method's class, org.elasticsearch.client.RequestOptions$Builder, is available from the following locations:
jar:file:/C:/Users/pranali.rasal/.m2/repository/org/elasticsearch/client/elasticsearch-rest-client/7.6.2/elasticsearch-rest-client-7.6.2.jar!/org/elasticsearch/client/RequestOptions$Builder.class
The class hierarchy was loaded from the following locations:
org.elasticsearch.client.RequestOptions.Builder:
file:/C:/Users/pranali.rasal/.m2/repository/org/elasticsearch/client/elasticsearch-rest-client/7.6.2/elasticsearch-rest-client-7.6.2.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.elasticsearch.client.RequestOptions$Builder
Following are the dependencies that i have added -
<dependency>
<groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-mapper-orm</artifactId>
<version>6.1.5.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-backend-elasticsearch</artifactId>
<version>6.1.5.Final</version>
</dependency>
Let me know if I missing something.
This is all explained here: https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#gettingstarted-framework-spring-boot-dependency-versions
Basically, Spring Boot is managing your dependencies, and it's forcing an older version of the Elasticsearch client. You need to force it back to the version Hibernate Search expects (a newer version, 7.16.x).
And just to clarify, this has nothing to do with the Elasticsearch server version that I've seen mentioned in other answers. This is strictly about your client.
This is probably due to incompatible version of the elasticsearch dependency. From https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#getting-started-compatibility it seems you need 7.10 or 7.16 but you have 7.6 dependency. Also check server version to be sure.
hibernate-search-backend-elasticsearch
is internally dependent on elasticsearch-rest-client-7.6.2.jar
And the method
org.elasticsearch.client.RequestOptions$Builder.setRequestConfig(Lorg/apache/http/client/config/RequestConfig;)Lorg/elasticsearch/client/RequestOptions$Builder;
it is trying to find is in later versions of low level client.
Temporary solution will be to exclude 7.6.2 and include latest version of elasticsearch-rest-client-7.6.2.jar -
<dependency>
<groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-backend-elasticsearch</artifactId>
<exclusions>
<exclusion>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-client</artifactId>
</exclusion>
</exclusions>
</dependency>
and including,
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-client</artifactId>
<version>7.10.0</version>
</dependency>
Since this is a temporary, I am not sure if this is reliable.
Please let me know in case there is a better solution.

Compatibility (as Spring boot Maven dependencies) between Elasticsearch 7.17, spring data elasticsearch and elasticsearch-rest-high-level-client

I have an Spring Boot + Elasticsearch application that had the now deprecated High Level Rest Client. I am trying to migrate the existing queries/methods to the new Java API Client but want to keep the HLRC for a bit (in case I break anything).
I seem to be running into a dependency problem that I'm not getting. I am currently getting the error java.lang.NoClassDefFoundError: org/elasticsearch/xcontent/ToXContentObject which I assume is due to compatibility issues. These are my current (relevent) dependencies:
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>7.17.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>4.3.4</version>
</dependency>
The Elasticsearch is on 7.17 . As for the maven dependencies... I don't really know what versions to use so that it can run the old HLRC still while I test out newer code? (So I set the versions to the newest possible ones)
Edit infos:
current spring boot version is 2.2.8
before manually setting the version, org.elasticsearch.client was on 6.8.x
is my approach dumb and I should just scrap all the HLRC in favor of implementing/testing Java API Client?
Any pointers/fixes appreciated!
If I remember correctly it was in version 7.15 or 7.16 that Elasticsearch had a breaking change moving the xcontent classes to a different package. You cannot use Spring Data Elasticsearch 4.3.x with Elasticsearch 7.17

Dozer Critical CVE-2014-9515 Dozer 5.5.1

Iam having one open vulnerability wen i scan my dependencies in blackduck for dozer version with 5.5.1. I tried to update the maven version but in maven central it is the latest version updated in 2014 . Could you please help me how to overcome the above vulnerability(CVE-2014-9515 Dozer 5.5.1).
Please find the POM :
<dependency>
<groupId>net.sf.dozer</groupId>
<artifactId>dozer</artifactId>
<version>5.5.1</version>
</dependency>
On the dozer webpage: https://github.com/DozerMapper/dozer
you will find the snippet for your pom file.
<dependency>
<groupId>com.github.dozermapper</groupId>
<artifactId>dozer-core</artifactId>
<version>6.5.2</version>
</dependency>
But it will not fix the issue CVE-2014-9515.
The dozer project is currently not active and will more than likely be deprecated in the future. If you are looking to use Dozer on a greenfield project, we would discourage that. If you have been using Dozer for a while, we would suggest you start to think about migrating onto another library, such as:
mapstruct
modelmapper

Spring Cloud Feign + Sleuth + Zipkin - original request is required

I have multiservices application which is using Spring Cloud OpenFeign. Now I have to use zipkin with that app. I remember that when i had app without Feign I just added Sleuth and Zipkin starters dependencies and run zipkin server on port 9411. After that Zipkin worked well.. But now, when i try same in my app with Feign i get error 500 "original request is required". I guess that Feign has some problems with headers when Sleuth add traces informations. Can you help me fix this?
It's hard to tell without more information. But it can be related to incompatible libraries. Can you post your dependencies?
In case you are using older version of okhttpclient with latest spring cloud:greenwich it can cause this issue.
I'm using Greenwich.RELEASE with okhttpclient:10.2.0 which works without problems
Use the below dependency Management for spring-boot to download the suitable versions for cloud version
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
I am using Java 10, cloud.version is Finchley.SR2 and sprinb-boot:2.2.0 and spring-cloud-starter-openfeign :2.1.2.RELEASE. and this combination worked for me to fix the issue.
Acctual problem was 10.x.x feign-core was not working only and io.github.openfeign:feign-core:jar:9.7.0:compile was working.
I faced this problem using java 11, springboot 2.3.0.RELEASE, and spring-cloud version Greenwich.RELEASE. Adding the following dependences saved me:
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-okhttp</artifactId>
<version>10.2.0</version>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-core</artifactId>
<version>10.2.0</version>
</dependency>
Hope this helps someone.

Is there a link between org.wildfly.bom and the version of the wildfly server used?

I'm currently developing some applications and I'm using wildfly 9.0.2.Final as the application server. Currently I'm using bom version 8.2.2.Final for the following artifacts:
jboss-javaee-7.0-with-tools
jboss-javaee-7.0-with-hibernate
jboss-javaee-7.0-with-security
I've started using these versions while following a tutorial. However I've seen that now wildfly 10 is out and probably some other dependencies also have dependencies. Maybe in the future javaee-8.0 will be available.
Is there some documentation on what the different artifacts include and maybe what should be kept in mind when upgrading the parent bom version?
With WildFly 9+ boms we changed structure a bit, so now we only have 2 boms.
Where most of them were merged into one.
wildfly-javaee7
wildfly-javaee7-with-tools
Where second one includes not only APIs but also tools that are useful for testing like arquillian, junit, etc...
so best for your needs would be to use this in your pom.xml
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.wildfly.bom</groupId>
<artifactId>wildfly-javaee7-with-tools</artifactId>
<scope>import</scope>
<type>pom</type>
<version>10.0.0.Final</version>
</dependency>
</dependencies>
</dependencyManagement>
you can always find latest info and docs on how to use it at github at repository https://github.com/wildfly/boms
Your BOM version should match your deployment Wildfly version.
Assuming you use provided scope for dependencies that are provided by Wildfly, you want to ensure you're using the correct versions. If you use a wrong version, your application might not work as expected or even fail to start, because some API might be deprecated/removed, or because some features might not be available yet.
Side note: Wildfly BOMs lack some dependencies, so we're using parent as BOM:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-parent</artifactId>
<version>9.0.2.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

Resources