一、该问题的重现步骤是什么?
1. 在eclipse,运行正常
2. 以blade-system为例,通过 java -Dfile.encoding=utf-8 -jar blade-system.jar --spring.profiles.active=prod 的方式部署生产运行就会报错
3.
二、你期待的结果是什么?实际看到的又是什么?
期望的结果: 启动blade相关项目成功
实际看到的: 启动blade相关项目报错
三、你正在使用的是什么产品,什么版本?在什么操作系统上?
BladeX、BladeX-Tool V2.7.0 windows 2016
四、请提供详细的错误堆栈信息,这很重要。
2021-02-20 11:23:16.192 [com.alibaba.nacos.naming.push.receiver] [] [com.alibaba.nacos.client.naming]
ERROR: [NA] error while receiving push data
java.net.SocketException: socket closed
at java.net.DualStackPlainDatagramSocketImpl.socketReceiveOrPeekData(Native Method)
at java.net.DualStackPlainDatagramSocketImpl.receive0(Unknown Source)
at java.net.AbstractPlainDatagramSocketImpl.receive(Unknown Source)
at java.net.DatagramSocket.receive(Unknown Source)
at com.alibaba.nacos.client.naming.core.PushReceiver.run(PushReceiver.java:83)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
2021-02-20 11:23:16.442 [main] [] [org.springframework.boot.SpringApplication]
ERROR: Application run failed
org.springframework.context.ApplicationContextException: Failed to start bean 'outputBindingLifecycle'; nested exception is java.lang.IllegalArgumentException: A default binder has been requested, but there is no binder available
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:185)
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53)
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360)
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158)
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:122)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:895)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:162)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:554)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:405)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140)
at org.springblade.core.launch.BladeApplication.run(BladeApplication.java:50)
at org.springblade.system.user.UserApplication.main(UserApplication.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:51)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)
Caused by: java.lang.IllegalArgumentException: A default binder has been requested, but there is no binder available
at org.springframework.util.Assert.notEmpty(Assert.java:555)
at org.springframework.cloud.stream.binder.DefaultBinderFactory.doGetBinder(DefaultBinderFactory.java:157)
at org.springframework.cloud.stream.binder.DefaultBinderFactory.getBinder(DefaultBinderFactory.java:140)
at org.springframework.cloud.stream.binding.BindingService.getBinder(BindingService.java:379)
at org.springframework.cloud.stream.binding.BindingService.bindProducer(BindingService.java:268)
at org.springframework.cloud.stream.binding.BindingService.bindProducer(BindingService.java:291)
at org.springframework.cloud.stream.binding.AbstractBindableProxyFactory.createAndBindOutputs(AbstractBindableProxyFactory.java:136)
at org.springframework.cloud.stream.binding.OutputBindingLifecycle.doStartWithBindable(OutputBindingLifecycle.java:58)
at java.util.LinkedHashMap$LinkedValues.forEach(Unknown Source)
at org.springframework.cloud.stream.binding.AbstractBindingLifecycle.start(AbstractBindingLifecycle.java:57)
at org.springframework.cloud.stream.binding.OutputBindingLifecycle.start(OutputBindingLifecycle.java:34)
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182)
... 22 common frames omitted
五、若有更多详细信息,请在下面提供。
之前是blade-xxljob在eclipse中出现这个错误,并且提了问题:https://sns.bladex.cn/q-4142.html
blade-core-cloud 还需要删除spring-cloud-stream依赖
在blade-core-cloud中的pom.xml文件中没有找到spring-cloud-stream
BladeX-Tool org.springblade 2.7.0.RELEASE 4.0.0 blade-core-cloud ${project.artifactId} ${project.parent.version} jar org.springblade blade-core-context org.springblade blade-starter-auth org.springframework.retry spring-retry io.github.openfeign feign-okhttp org.springframework.cloud spring-cloud-starter-openfeign commons-logging commons-logging org.springframework.cloud spring-cloud-starter-netflix-hystrix commons-logging commons-logging org.springframework.boot spring-boot-starter-actuator de.codecentric spring-boot-admin-starter-client com.alibaba.cloud spring-cloud-starter-alibaba-nacos-discovery com.alibaba.cloud spring-cloud-starter-alibaba-nacos-config com.alibaba.cloud spring-cloud-starter-alibaba-sentinel org.springblade blade-core-auto provided
而是在blade-xxljob-admin中排除,就没问题了
org.springblade blade-common org.springblade blade-core-cloud org.springframework.cloud spring-cloud-stream
也看到2.7.1.RELEAS解决了,[删除]spring-cloud-stream依赖,按需引入,但目前不太想升级到新版
手动加一下这个类也可以解决
package org.springblade.core.tool.support; import java.util.function.Supplier; /** * 解决 no binder available 问题 * * @author Chill */ public class BinderSupplier implements Supplier<Object> { @Override public Object get() { return null; } }
sss
package org.springblade.core.tool.config; import org.springblade.core.tool.support.BinderSupplier; import org.springblade.core.tool.utils.SpringUtil; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import java.util.function.Supplier; /** * 工具配置类 * * @author Chill */ @Configuration public class ToolConfiguration { /** * Spring上下文缓存 */ @Bean public SpringUtil springUtil() { return new SpringUtil(); } /** * Binder支持类 */ @Bean @ConditionalOnMissingBean public Supplier<Object> binderSupplier() { return new BinderSupplier(); } }
搜索查询过之前的问题,在blade-xxljob-adminV2.7.0启动报错Failed to start bean 'outputBindingLifecycle' 问题中就添加了,但未起作用,还是报错。
package org.springblade.core.tool.config; import org.springblade.core.tool.support.BinderSupplier; import org.springblade.core.tool.utils.SpringUtil; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import java.util.function.Supplier; /** * 工具配置类 * * @author Chill */ @Configuration public class ToolConfiguration { /** * Spring上下文缓存 */ @Bean public SpringUtil springUtil() { return new SpringUtil(); } /** * Binder支持类 */ @Bean @ConditionalOnMissingBean public Supplier<Object> binderSupplier() { return new BinderSupplier(); } }
package org.springblade.core.tool.config; import org.springblade.core.tool.support.BinderSupplier; import org.springblade.core.tool.utils.SpringUtil; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import java.util.function.Supplier; /** * 工具配置类 * * @author Chill */ @Configuration public class ToolConfiguration { /** * Spring上下文缓存 */ @Bean public SpringUtil springUtil() { return new SpringUtil(); } /** * Binder支持类 */ @Bean @ConditionalOnMissingBean public Supplier<Object> binderSupplier() { return new BinderSupplier(); } }
ToolConfiguration.java
最靠谱的办法就是你下载BladeX-Tool,然后排除掉stream依赖,再本地执行mvn clean install安装依赖就行了。
扫一扫访问 Blade技术社区 移动端