incompatible types: org.apache.http.impl.client.CloseableHttpClient cannot be converted to org.apache.hc.client5.http.classic.HttpClient - java

Am upgrading 'spring-boot-starter' version from 2.5.7 to 3.0.2 then am getting compilation error saying like
'incompatible types: org.apache.http.impl.client.CloseableHttpClient cannot be converted to org.apache.hc.client5.http.classic.HttpClient'
can you please some one help on this?
Thanks in advance.
am expecting the resolution for the problem

org.apache.http.impl.client.CloseableHttpClient is part of the older Apache HttpComponents library, which has been deprecated in favour of the newer Apache HttpComponents Client 5 library.
Here you can find more details:
https://hc.apache.org/httpcomponents-client-5.2.x/migration-guide/migration-to-classic.html
There will be compilation errors due to API incompatibilities between
version series 4.x and 5.x mostly related to SSL/TLS and timeout
settings and CloseableHttpClient instance creation. Remove old
org.apache.http imports and re-import HttpClient classes from
org.apache.hc.httpclient5 package namespace.
If you are using version 5.x of the library, you will need to make sure that you are using the correct classes and interfaces from that version, rather than the older ones from version 4.x.

Related

Apache Camel 2.20.2 compatibility with JDK 11

I'm working on Oracle JDK 8 to AdoptOpenJDK 11 migration. We are also using Apache Camel 2.20.2. After JDK migration, I'm facing below issues in Camel Context XML file.
not able to recognize exchangePattern parameter
enum value not permissible
Even after having above issues, sometimes my application runs successfully and sometimes it gives error that it is not able to create spring bean. While creating below bean it says trustAllPackages is not a valid parameter which I know is not actually causing the issue.
bean creation
I think the issue is somewhat related to the errors in XML file. My question is:
Is Camel 2.20.2 compatible with JDK 11? If not, are above errors result of this incompatibility?
How to resolve these errors and why isn't this causing issue every time I run my application?
Currently we are using :
AdoptOpenJDK 11
Spring 4.3.11.RELEASE
Camel 2.20.2
ActiveMQ 5.15.0
Maven Build Tool
Thanks in advance.
You can see here what JDK version Camel supports
https://camel.apache.org/manual/latest/what-are-the-dependencies.html
Camel 2.x only supports Java 8.
You need Camel 3.x for Java 11 support.

Compatibility between protobuf 2.3.0 and 2.6.0

I'm working with two sets of protobuf bindings, A and B.
A has been generated with protoc version 2.3.0 and B has been generated with protoc version 2.6.0. In my application that uses both of the above I'm using the protobuf-java library version 2.6.0.
With this setup I get the following kind of error when interacting with A protobuf bindings:
java.lang.RuntimeException: Generated message class "A$Builder" missing method "getAMessageBuilder"
There are plenty of posts and questions about backwards compatibility between protobuf schemas, but what about library versions? Are there any guarantees between protobuf versions?
Protobuf for Java supports running older generated code against a newer runtime library and also mixing generated code from different compiler versions. However, this support only exists starting from version 3.0 (see the change log entry here). So in your case it would probably be best to upgrade to 3.0 (or higher) if possible and regenerate your code with the 3.0 protoc, but after that one-time step you will no longer need to worry about regenerating your code as you update the protobuf library version.

Is there a protobuf 3 compatible Spring HTTP message converter?

There's a org.springframework.http.converter.protobuf.ProtobufHttpMessageConverter that can be used to convert protobuf generated java message classes, but it's tested only with protobuf version 2.5
Is there a version compatible with the version 3 of protobuf?
Here's a not fully tested solution still in a git branch:
https://github.com/bclozel/spring-framework/blob/SPR-13589/spring-web/src/main/java/org/springframework/http/converter/protobuf/ProtobufHttpMessageConverter.java

Version compatibility issues?

I'm new to opentaps environment. I have some doubt in opentaps. I have opentaps1.5 version. It is contain apache 6.0.26 and ofbiz 10 version. I want to work using jdk1.8. While compile the program using jdk1.6 or 1.7 it is providing expected results. When I used jdk1.8 It showing
ExceptionInInitializerError.
Please tell me how to resolve this issue. I need to work opentaps1.5 with jdk1.8. Thanking you in Advance.
Apache OFBiz, which is the base of opentaps, just introduced Java 1.8 compatibility in the upcoming 14.12 branch. OFBiz 10 is very old and not maintained anymore. It is not compatible with Java 1.8.
As far as I know, opentaps is forked from OFBiz and might have newer versions which are Java 1.8 compatible.
You may want to contact the support (http://www.opentaps.org/services-support) to get more accurate informations.

Use apache httpclient 4.3.2 and httpclient 4.1.2 at the same time

I'm stuck in a project where I have two dependencies that seem to be contradicting themselves.
One lib is apache's httpClient 4.1.* and the other is apache's HttpClient 4.3.*.
Is there a way to have HttpClient 4.3.* and keep it backwards compatible with 4.1.*?
According to the javadoc, the interface is deprecated, not removed.
When I try to use just the 4.3.2, I get:
java.lang.ClassNotFoundException: org.apache.http.protocol.HttpContext
I'm running on Tomcat 7.0.50 and I'm running on eclipse
In the end, this happened because of the IDE I am using (eclipse) even though I once tell that I want to use all dependencies on the server I have it associated with (in this case, tomcat 7.0), It didn't update when I had added this HttpClient 4.3.2.
Furthermore, the program was giving problems in one of the sub-systems that was requiring 4.1.* in a class that is classified as deprecated in 4.3.2.
It was just a series of coincidences (and misreading the manual or gap in the manual) that lead to my misinterpretation of what was really happening.
On eclipse, to add libraries from the project to make them available from the server, use this tool:
project -> properties -> deployment assembly

Categories

Resources