Is there a protobuf 3 compatible Spring HTTP message converter? - java

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

Related

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

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.

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.

Java 6 service using/calling java8 library

Our service still uses Java 6 for compile and run. We need to use a library that is compiled with Java 8. Upon including the dependency in gradle we as expected see errors such as "class file has wrong version"
For android development gradle has something like gradle-retrolambda. Is there any generic gradle client that helps convert this library's bytecode compatible to java 6? or is there any other option other than our service upgrading to java8?
Thanks!

Which GSON version for Java 1.4

Is there any location where the JDK version supporting that GSON version is documented?
Specifically I want to know the highest GSON version that will run with Java 1.4.
I have a embedded JVM with version 1.4 that I cannot upgrade, and I want to test if GSON works on it.
GSON versions are available for download at this link.
Unfortunately it looks like GSON does not work with JDK 1.4. The answer provided by #Steven specifically states that GSON heavily uses features of JDK 1.5. Also, if you look at the oldest available GSON version in Maven Central (version 1.1), the pom.xml indicates that the minimum version for JDK is 1.5. Source, search for "targetJdk" and you'll see 1.5 listed.
Unfortunately this means GSON won't work with JDK 1.4.
I don't think you can run it with 1.4, even the Gson 1.0.1 is compiled for 1.5
You can check that, too:
download the jar you want to check
open a class-file inside
look for the bytes 6 and 7
compare result with this table https://en.wikipedia.org/wiki/Java_class_file#General_layout

Categories

Resources