[英]ERROR: Unmarshalled object is an unsupported type in camel XML file
我正在使用下面的駱駝路線。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
在我的情況下,原因是因為我在想我正在動態加載 XML 路由
context.loadRoutesDefinition(new ByteArrayInputStream(value.getBytes(StandardCharsets.UTF_8)));
其中value
是一個包含 XML 的String
。
但實際上我正在加載 Rest 路由而不是 XML:
context.loadRestDefinition(new ByteArrayInputStream(value.getBytes(StandardCharsets.UTF_8)));
因此,在更改... Rest
... 到... Routes
... 一切開始工作。 但在此之前,錯誤的格式完全相同。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.