Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is Spring Integration 5.5.10 must be based on Java 9 to use or depend on spring integration? #3761

Closed
herodotus-ecosystem opened this issue Mar 27, 2022 · 2 comments

Comments

@herodotus-ecosystem
Copy link

herodotus-ecosystem commented Mar 27, 2022

I have a microservice project based on spring boot 2.6.4, spring cloud 2021.0.1 and Java 8.

Among them, the core message mechanism is spring cloud starter bus Kafka. All functions operate normally.

My question is:

Today, I upgraded the spring boot version used in the project from 2.6.4 to 2.6.5. After starting the application, the following error occurs.

org.springframework.context.ApplicationContextException: Failed to start bean 'inputBindingLifecycle'; nested exception is java.lang.NoSuchMethodError: java.util.List.of(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/util/List;
	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181) ~[spring-context-5.3.17.jar:5.3.17]
	at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54) ~[spring-context-5.3.17.jar:5.3.17]
	at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356) ~[spring-context-5.3.17.jar:5.3.17]
	at java.lang.Iterable.forEach(Iterable.java:75) ~[na:1.8.0_301]
	at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155) ~[spring-context-5.3.17.jar:5.3.17]
	at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123) ~[spring-context-5.3.17.jar:5.3.17]
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935) ~[spring-context-5.3.17.jar:5.3.17]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) ~[spring-context-5.3.17.jar:5.3.17]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.6.5.jar:2.6.5]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:740) [spring-boot-2.6.5.jar:2.6.5]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:415) [spring-boot-2.6.5.jar:2.6.5]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-2.6.5.jar:2.6.5]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1312) [spring-boot-2.6.5.jar:2.6.5]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) [spring-boot-2.6.5.jar:2.6.5]
	at cn.herodotus.cloud.uaa.UaaApplication.main(UaaApplication.java:22) [classes/:na]
Caused by: java.lang.NoSuchMethodError: java.util.List.of(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/util/List;
	at org.springframework.integration.support.json.JacksonJsonUtils.<clinit>(JacksonJsonUtils.java:58) ~[spring-integration-core-5.5.10.jar:5.5.10]
	at org.springframework.integration.kafka.inbound.KafkaMessageDrivenChannelAdapter.<init>(KafkaMessageDrivenChannelAdapter.java:139) ~[spring-integration-kafka-5.5.10.jar:5.5.10]
	at org.springframework.cloud.stream.binder.kafka.KafkaMessageChannelBinder.createConsumerEndpoint(KafkaMessageChannelBinder.java:735) ~[spring-cloud-stream-binder-kafka-3.2.2.jar:3.2.2]
	at org.springframework.cloud.stream.binder.kafka.KafkaMessageChannelBinder.createConsumerEndpoint(KafkaMessageChannelBinder.java:163) ~[spring-cloud-stream-binder-kafka-3.2.2.jar:3.2.2]
	at org.springframework.cloud.stream.binder.AbstractMessageChannelBinder.doBindConsumer(AbstractMessageChannelBinder.java:426) ~[spring-cloud-stream-3.2.2.jar:3.2.2]
	at org.springframework.cloud.stream.binder.AbstractMessageChannelBinder.doBindConsumer(AbstractMessageChannelBinder.java:92) ~[spring-cloud-stream-3.2.2.jar:3.2.2]
	at org.springframework.cloud.stream.binder.AbstractBinder.bindConsumer(AbstractBinder.java:143) ~[spring-cloud-stream-3.2.2.jar:3.2.2]
	at org.springframework.cloud.stream.binding.BindingService.doBindConsumer(BindingService.java:180) ~[spring-cloud-stream-3.2.2.jar:3.2.2]
	at org.springframework.cloud.stream.binding.BindingService.bindConsumer(BindingService.java:137) ~[spring-cloud-stream-3.2.2.jar:3.2.2]
	at org.springframework.cloud.stream.binding.AbstractBindableProxyFactory.createAndBindInputs(AbstractBindableProxyFactory.java:118) ~[spring-cloud-stream-3.2.2.jar:3.2.2]
	at org.springframework.cloud.stream.binding.InputBindingLifecycle.doStartWithBindable(InputBindingLifecycle.java:58) ~[spring-cloud-stream-3.2.2.jar:3.2.2]
	at java.util.LinkedHashMap$LinkedValues.forEach(LinkedHashMap.java:608) ~[na:1.8.0_301]
	at org.springframework.cloud.stream.binding.AbstractBindingLifecycle.start(AbstractBindingLifecycle.java:57) ~[spring-cloud-stream-3.2.2.jar:3.2.2]
	at org.springframework.cloud.stream.binding.InputBindingLifecycle.start(InputBindingLifecycle.java:34) ~[spring-cloud-stream-3.2.2.jar:3.2.2]
	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178) ~[spring-context-5.3.17.jar:5.3.17]
	... 14 common frames omitted

After checking the code, I found that with the upgrade of spring boot version, the spring integration core version was upgraded from 5.5.9 to 5.5.10。

Under version 5.5.10, the class org.springframework.integration.support.json.JacksonJsonUtils has added a static constant using method List.of() to initialize. Because there is no such method in Java 8, which is available in Java 9.

	/**
	 * The packages to trust on JSON deserialization by default.
	 */
	public static final List<String> DEFAULT_TRUSTED_PACKAGES =
			List.of(
					"java.util",
					"java.lang",
					"org.springframework.messaging.support",
					"org.springframework.integration.support",
					"org.springframework.integration.message",
					"org.springframework.integration.store",
					"org.springframework.integration.history"
			);

Is this a bug? Or I have to use Java 9 now?

@herodotus-ecosystem herodotus-ecosystem added status: waiting-for-triage The issue need to be evaluated and its future decided type: bug labels Mar 27, 2022
@artembilan
Copy link
Member

Yes, this is a bug. Unfortunately we noticed it already after that 5.5.10 release: 81f5b6b.

So, you have two workarounds: use Java 9 (or higher) or use Spring Integration 5.5.9 in your project:

<properties>
    <spring-integration.version>5.5.9</spring-integration.version>
</properties>

Sorry for that.

Fix via mentioned commit.

@artembilan artembilan added in: core and removed status: waiting-for-triage The issue need to be evaluated and its future decided labels Mar 27, 2022
@artembilan artembilan added this to the 5.5.11 milestone Mar 27, 2022
@herodotus-ecosystem
Copy link
Author

OK,Thank you for your reply

herodotus-ecosystem added a commit to dromara/dante-cloud that referenced this issue Mar 27, 2022
- 重要更新
  - Spring Boot 版本升级至 2.6.5
  - Spring Boot Admin 版本升级至 2.6.3
- 一般更新
  - 强制降低 Spring Integration 版本至 5.5.9,临时解决 Spring Integration 5.5.10 不兼容 Java 8 问题。已提交 ISSUE 至 Spring Integration 项目 [#3761](spring-projects/spring-integration#3761 Spring Integration 5.5.11 修复该问题
  - 修复 @async@transactional 注解冲突,导致 @transactional 失效问题。
  - 修复因@transactional 失效,导致的权限数据存储死锁问题。
- 依赖更新
  - Redisson 版本升级至 3.17.0
  - Fastjson 版本升级至 1.2.80
  - Okhttps 版本升级至 3.4.4
  - Bce-java-sdk 版本升级至 0.10.201
  - Alipay-sdk-java 版本升级至 4.22.67.ALL
  - Logback 版本升级至 1.2.11
herodotus-ecosystem added a commit to herodotus-ecosystem/dante-cloud-athena that referenced this issue Mar 27, 2022
- 重要更新
  - Spring Boot 版本升级至 2.6.5
  - Spring Boot Admin 版本升级至 2.6.3
- 一般更新
  - 强制降低 Spring Integration 版本至 5.5.9,临时解决 Spring Integration 5.5.10 不兼容 Java 8 问题。已提交 ISSUE 至 Spring Integration 项目 [#3761](spring-projects/spring-integration#3761 Spring Integration 5.5.11 修复该问题
  - 修复 @async@transactional 注解冲突,导致 @transactional 失效问题。
  - 修复因@transactional 失效,导致的权限数据存储死锁问题。
- 依赖更新
  - Redisson 版本升级至 3.17.0
  - Fastjson 版本升级至 1.2.80
  - Okhttps 版本升级至 3.4.4
  - Bce-java-sdk 版本升级至 0.10.201
  - Alipay-sdk-java 版本升级至 4.22.67.ALL
  - Logback 版本升级至 1.2.11
@artembilan artembilan changed the title Dose Must be based on Java 9 to use or depend on spring integration? Is Spring Integration 5.5.10 must be based on Java 9 to use or depend on spring integration? Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants