java错误:在camel XML文件中,解组对象是不受支持的类型
我正在使用下面的骆驼路线。xml文件。如果没有线程池配置和多播配置,它可以正常工作。我添加了线程和多播配置,以便@Handler方法将在多个线程中运行,以实现对传入消息的并行处理。但是,当我运行它时,我在启动应用程序时遇到了以下错误。任何想法/建议都是可以接受的
<?xml version="1.0" encoding="UTF-8"?>
<camelContext xmlns="http://camel.apache.org/schema/spring"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<threadPoolProfile id="routerThreadPoolProfile"
defaultProfile="true" poolSize="10" maxPoolSize="20" maxQueueSize="1000"
allowCoreThreadTimeOut="false" rejectedPolicy="CallerRuns" />
<route id="IncomingRoute">
<from
uri="ceh:eventTest?namespaceName=sourceUri" />
<multicast parallelProcessing="true" executorServiceRef="routerThreadPoolProfile">
<to uri="bean:{{processorname}}" />
<log message="Message Body - ${body}" />
</multicast>
</route>
</camelContext>
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
[${artifactId}][SYSTEM][SYSTEM][EMPTY][EMPTY][2020-06-04 15:02:25][main][ERROR][SpringApplication:771] - Application startup failed
org.apache.camel.spring.boot.CamelSpringBootInitializationException: java.lang.IllegalArgumentException: Unmarshalled object is an unsupported type: org.apache.camel.spring.CamelContextFactoryBean -> org.apache.camel.spring.CamelContextFactoryBean@1e1598e5
at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:250) ~[camel-spring-boot-2.21.0.fuse-000077-redhat-1.jar!/:2.21.0.fuse-000077-redhat-1]
at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:57) ~[camel-spring-boot-2.21.0.fuse-000077-redhat-1.jar!/:2.21.0.fuse-000077-redhat-1]
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) ~[spring-context-5.0.16.RELEASE.jar!/:5.0.16.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) ~[spring-context-5.0.16.RELEASE.jar!/:5.0.16.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-5.0.16.RELEASE.jar!/:5.0.16.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:404) ~[spring-context-5.0.16.RELEASE.jar!/:5.0.16.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:358) ~[spring-context-5.0.16.RELEASE.jar!/:5.0.16.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:900) ~[spring-context-5.0.16.RELEASE.jar!/:5.0.16.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:146) ~[spring-boot-1.5.19.RELEASE.jar!/:1.5.19.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:554) ~[spring-context-5.0.16.RELEASE.jar!/:5.0.16.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:124) ~[spring-boot-1.5.19.RELEASE.jar!/:1.5.19.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.19.RELEASE.jar!/:1.5.19.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.19.RELEASE.jar!/:1.5.19.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.19.RELEASE.jar!/:1.5.19.RELEASE]
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134) [spring-boot-1.5.19.RELEASE.jar!/:1.5.19.RELEASE]
at com.els.galaxy.galaxy_remoteview_router_boot.RVRouterApplicationBoot.main(RVRouterApplicationBoot.java:55) [classes!/:1.2.0.1-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [galaxy-remoteview-router-today.jar:1.2.0.1-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [galaxy-remoteview-router-today.jar:1.2.0.1-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [galaxy-remoteview-router-today.jar:1.2.0.1-SNAPSHOT]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [galaxy-remoteview-router-today.jar:1.2.0.1-SNAPSHOT]
Caused by: java.lang.IllegalArgumentException: Unmarshalled object is an unsupported type: org.apache.camel.spring.CamelContextFactoryBean -> org.apache.camel.spring.CamelContextFactoryBean@1e1598e5
at org.apache.camel.model.ModelHelper.loadRoutesDefinition(ModelHelper.java:190) ~[camel-core-2.21.0.fuse-000077-redhat-1.jar!/:2.21.0.fuse-000077-redhat-1]
at org.apache.camel.model.ModelHelper.loadRoutesDefinition(ModelHelper.java:152) ~[camel-core-2.21.0.fuse-000077-redhat-1.jar!/:2.21.0.fuse-000077-redhat-1]
at org.apache.camel.impl.DefaultCamelContext.loadRoutesDefinition(DefaultCamelContext.java:1034) ~[camel-core-2.21.0.fuse-000077-redhat-1.jar!/:2.21.0.fuse-000077-redhat-1]
at org.apache.camel.spring.boot.RoutesCollector.loadXmlRoutes(RoutesCollector.java:281) ~[camel-spring-boot-2.21.0.fuse-000077-redhat-1.jar!/:2.21.0.fuse-000077-redhat-1]
at org.apache.camel.spring.boot.RoutesCollector.onApplicationEvent(RoutesCollector.java:142) ~[camel-spring-boot-2.21.0.fuse-000077-redhat-1.jar!/:2.21.0.fuse-000077-redhat-1]
... 23 more
[${artifactId}][SYSTEM][SYSTEM][EMPTY][EMPTY][2020-06-04 15:02:25][main][INFO ][AnnotationConfigEmbeddedWebApplicationContext:1006] - Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1fdfafd2: startup date [Thu Jun 04 15:00:10 IST 2020]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@7cf10a6f
[${artifactId}][SYSTEM][SYSTEM][EMPTY][EMPTY][2020-06-04 15:02:25][main][INFO ][DefaultLifecycleProcessor:369] - Stopping beans in phase 2147483647
[${artifactId}][SYSTEM][SYSTEM][EMPTY][EMPTY][2020-06-04 15:02:25][main][INFO ][SpringCamelContext:3499] - Apache Camel 2.21.0.fuse-000077-redhat-1 (CamelContext: camel-1) is shutting down
[${artifactId}][SYSTEM][SYSTEM][EMPTY][EMPTY][2020-06-04 15:02:26][main][INFO ][SpringCamelContext:3590] - Apache Camel 2.21.0.fuse-000077-redhat-1 (CamelContext: camel-1) uptime
[${artifactId}][SYSTEM][SYSTEM][EMPTY][EMPTY][2020-06-04 15:02:26][main][INFO ][SpringCamelContext:3591] - Apache Camel 2.21.0.fuse-000077-redhat-1 (CamelContext: camel-1) is shutdown in 0.047 seconds
# 1 楼答案
在我的例子中,原因是我认为我正在使用
其中
value
是包含XML的String
但实际上我加载的是Rest路由而不是XML:
所以,在改变之后
Rest
。。。到Routes
。。。一切都开始起作用了。但在此之前,错误的格式完全相同