尝试将AMQP与Spring Batch集成在一起,为什么会出现此异常?
@Bean
public SimpleMessageListenerContainer simpleMessageListenerContainer() {
SimpleMessageListenerContainer listenerContainer = new
SimpleMessageListenerContainer();
listenerContainer.setConnectionFactory(this.connectionFactory);
listenerContainer.setQueues(this.fileQueue());
listenerContainer.setConcurrentConsumers(1);
return listenerContainer;
}
@Bean
public IntegrationFlow inboundFlow() {
return IntegrationFlows.from(Amqp.inboundAdapter(simpleMessageListenerContainer()))
.handle(m -> System.out.println("Message has been received"))
//.transform(Transformers.fromJson(TransmissionFile.class))
//.handle( jobLaunchingMessageHandler() )
//.handle((m) -> {
// m.getPayload();
//})
.get();
}
...省略了17个共同的框架 java.lang.NoClassDefFoundError: org / springframework / integration / amqp / inbound / AmqpInboundChannelAdapter 在 org.springframework.integration.dsl.amqp.AmqpInboundChannelAdapterSpec。(AmqpInboundChannelAdapterSpec.java:45) 〜[spring-integration-java-dsl-1.2.3.RELEASE.jar:na]在 org.springframework.integration.dsl.amqp.Amqp.inboundAdapter(Amqp.java:148) 〜[spring-integration-java-dsl-1.2.3.RELEASE.jar:na]在 com.mgoode.integration.IntegrationConfig.inboundFlow(IntegrationConfig.java:70) 〜[classes /:na]在 com.mgoode.integration.IntegrationConfig $$ EnhancerBySpringCGLIB $$ 6ae3783e.CGLIB $ inboundFlow $ 6() 〜[classes /:na]在 com.mgoode.integration.IntegrationConfig $$ EnhancerBySpringCGLIB $$ 6ae3783e $$ FastClassBySpringCGLIB $$ fd96272f.invoke() 〜[classes /:na]在 org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) 〜[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE]在 org.springframework.context.annotation.ConfigurationClassEnhancer $ BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358) 〜[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]在 com.mgoode.integration.IntegrationConfig $$ EnhancerBySpringCGLIB $$ 6ae3783e.inboundFlow() 〜[classes /:na]在sun.reflect.NativeMethodAccessorImpl.invoke0(本机 方法)〜[na:1.8.0_161]在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 〜[na:1.8.0_161]在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 〜[na:1.8.0_161] at java.lang.reflect.Method.invoke(Method.java:498) 〜[na:1.8.0_161]在 org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) 〜[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE] ... 18个常见 省略帧造成原因:java.lang.ClassNotFoundException: org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter 在java.net.URLClassLoader.findClass(URLClassLoader.java:381) 〜[na:1.8.0_161]在 java.lang.ClassLoader.loadClass(ClassLoader.java:424)〜[na:1.8.0_161] 在sun.misc.Launcher $ AppClassLoader.loadClass(Launcher.java:338) 〜[na:1.8.0_161]在 java.lang.ClassLoader.loadClass(ClassLoader.java:357)〜[na:1.8.0_161] ...省略了31个共同的框架