请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

测试类发送mq消息成功后报错,搞不懂

rg.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name ‘eurekaAutoServiceRegistration’: Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220) [spring-beans-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310) ~[spring-beans-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1083) [spring-context-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.context.event.ApplicationListenerMethodAdapter.getTargetBean(ApplicationListenerMethodAdapter.java:291) ~[spring-context-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:261) ~[spring-context-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:182) ~[spring-context-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.context.event.ApplicationListenerMethodAdapter.onApplicationEvent(ApplicationListenerMethodAdapter.java:144) ~[spring-context-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167) ~[spring-context-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:399) [spring-context-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:405) [spring-context-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:353) [spring-context-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:996) [spring-context-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:963) [spring-context-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.cloud.context.named.NamedContextFactory.destroy(NamedContextFactory.java:76) [spring-cloud-context-2.0.0.M2.jar:2.0.0.M2]
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:256) [spring-beans-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:582) [spring-beans-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:558) [spring-beans-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:952) [spring-beans-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:527) [spring-beans-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.destroySingletons(FactoryBeanRegistrySupport.java:228) [spring-beans-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:959) [spring-beans-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1035) [spring-context-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1011) [spring-context-5.0.0.RC3.jar:5.0.0.RC3]
at org.springframework.context.support.AbstractApplicationContext$1.run(AbstractApplicationContext.java:933) [spring-context-5.0.0.RC3.jar:5.0.0.RC3]

2019-06-01 22:33:49.642 INFO 8940 — [ Thread-5] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default’
2019-06-01 22:33:49.643 INFO 8940 — [ Thread-5] com.zaxxer.hikari.HikariDataSource : testdb - Shutdown initiated…
2019-06-01 22:33:49.649 INFO 8940 — [ Thread-5] com.zaxxer.hikari.HikariDataSource : testdb - Shutdown completed.

Process finished with exit code 0

正在回答 回答被采纳积分+3

3回答

廖师兄 2019-06-02 23:28:30

日志格式化,不然没法看。测试类是怎么写的,测试类是放在哪个目录,截图。

1 回复 有任何疑惑可以回复我~
  • 提问者 花花君子 #1
    @Test
        public void send() {
            amqpTemplate.convertAndSend("myQueue", "now " + new Date());
        }
    就是这个发送代码,另外我反复看了视频老师,你执行这段代码发送消息成功最后也会报个错,不过画面一闪而过看不清楚
    回复 有任何疑惑可以回复我~ 2019-06-03 20:27:08
  • 廖师兄 回复 提问者 花花君子 #2
    你现在用我的源码会报错吗
    回复 有任何疑惑可以回复我~ 2019-06-04 11:10:32
  • 提问者 花花君子 回复 廖师兄 #3
    会的,用你的源码也是报错的,报错信息大致就是实例销毁了,无法再去创建实例
    回复 有任何疑惑可以回复我~ 2019-06-06 14:09:02
CrazyTaro 2019-07-03 13:31:25

我这边发送端也是相同问题

0 回复 有任何疑惑可以回复我~
  • 我这边用我的源码试了是没问题的,上面的同学没有回复了。你用我的源码试试,如果有问题,告诉我是哪个commit
    回复 有任何疑惑可以回复我~ 2019-07-03 22:56:39
  • CrazyTaro 回复 廖师兄 #2
    好的,我再试试
    回复 有任何疑惑可以回复我~ 2019-07-04 20:29:21
qq_改成什么名字呢_0 2019-06-11 12:53:43

不知道 我这边加了 spring session redis 的原因.....我也是这个问题,但是 有一点我怀疑你的描述,

你说消息发送成功的话 ,  接受端打印出消息了吗???

创建消息和 发送应该是两码事。。。我这边 消息队列里面创建成功了 但消息没成功接收到




0 回复 有任何疑惑可以回复我~
  • 提问者 花花君子 #1
    接收端一点问题没有,成功打印接收的log。发送端也发的好好的,发送完成后会抛这个异常
    回复 有任何疑惑可以回复我~ 2019-06-11 17:17:31
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信