org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: null due to
来源:互联网 发布:廖承宇直播软件 编辑:程序博客网 时间:2024/05/16 08:15
http://mail-archives.apache.org/mod_mbox/camel-dev/201102.mbox/%3C1222930868.10702.1298463158380.JavaMail.tomcat@hel.zones.apache.org%3E
interceptFrom and from(Endpoint) don't work together
----------------------------------------------------
Key: CAMEL-3709
URL: https://issues.apache.org/jira/browse/CAMEL-3709
Project: Camel
Issue Type: Bug
Components: camel-core
Affects Versions: 2.5.0
Reporter: Søren Markert
Priority: Minor
When using interceptFrom(String) together with from(Endpoint), the below Exception occurs
during the routes building process. Looking at RoutesDefinition.java:217 reveals, that the
FromDefintion just created has no URI. That causes the comparison to all the interceptFroms'
URIs to fail. As far as I can tell, the way to fix this would be to add {{setUri(myEndpoint.getEndpointUri())}}
in the constructor {{FromDefinition(Endpoint endpoint)}}.
Below the stack trace, there is a unit test that demonstrates the issue. Until it if fixed,
it can be easily circumvented by adding the commented-out line, and then change to {{from("myEndpoint")}}.
{code}
org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: null due to:
null
at org.apache.camel.util.EndpointHelper.matchEndpoint(EndpointHelper.java:109)
at org.apache.camel.model.RoutesDefinition.route(RoutesDefinition.java:217)
at org.apache.camel.model.RoutesDefinition.from(RoutesDefinition.java:167)
at org.apache.camel.builder.RouteBuilder.from(RouteBuilder.java:101)
at dk.mobilethink.adc2.endpoint.UnsetUriTest$1.configure(UnsetUriTest.java:18)
at org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:318)
at org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:273)
at org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:259)
at org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:612)
at org.apache.camel.test.CamelTestSupport.setUp(CamelTestSupport.java:111)
at junit.framework.TestCase.runBare(TestCase.java:132)
at org.apache.camel.test.TestSupport.runBare(TestSupport.java:65)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.NullPointerException
at org.apache.camel.util.UnsafeUriCharactersEncoder.encode(UnsafeUriCharactersEncoder.java:56)
at org.apache.camel.util.URISupport.normalizeUri(URISupport.java:162)
at org.apache.camel.util.EndpointHelper.matchEndpoint(EndpointHelper.java:107)
... 24 more
{code}
{code}
package dk.mobilethink.adc2.endpoint;
import org.apache.camel.Endpoint;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.CamelTestSupport;
public class UnsetUriTest extends CamelTestSupport {
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
interceptFrom("URI1").to("irrelevantURI");
Endpoint myEndpoint = getContext().getComponent("direct").createEndpoint("ignoredURI");
// getContext().addEndpoint("myEndpoint", myEndpoint);
from(myEndpoint)
.inOnly("log:foo");
}
};
}
public void testNothing() { }
}
{code}
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
=================
if we want to use uri in interceptfrom
<camel:interceptFrom uri="xxx">
<camel:bean ref="xxx" method="xxx"></camel:bean>
</camel:interceptFrom>
we must make surei there isn't any route like:
<route id="xxx" startupOrder="1">
<from ref="xxx" />
<to uri="xxx" />
</route>
we should change it to
<route id="xxx" startupOrder="1"
>
<from uri="xxx" />
<to uri="xxx" />
</route>
=============
interceptFrom & ref
http://camel.465427.n5.nabble.com/interceptFrom-amp-ref-td4283865.html
I guess would be logically correct to include such an attribute to refer to the endpoints instead of copy/pasting of URIs.
The source code has a TODO in there about that, so yeah its a known
issue that interceptXXX uses uris. However you can always use
"ref:xxx" to refer to an endpoint by its id, in the uri. So that
should work. Its just that the we dont have interceptXXXRef to
indicate it expect a reference.
- org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: null due to
- Handshake failed due to invalid Upgrade header: null
- Failed to resolve: 之一
- Failed to resolve:aar
- org.apache.spark.shuffle.FetchFailedException:Failed to connect to异常
- Android Studio failed to resolve .....
- Android Studio:Failed to resolve
- AndroidStudio提示failed to resolve:
- failed to resolve:com.github.********
- Failed to resolve: com.github
- Failed to load or instantiate TagLibraryValidator class: org.apache.taglibs.!
- tomcat org.apache.catalina.LifecycleException: Failed to start component
- Failed to execute goal org.apache.maven.plugins
- 解决Failed to execute goal org.apache.maven.plugins
- org.apache.catalina.LifecycleException: Failed to start component 异常
- Failed to execute goal org.apache.maven.plugins:
- Failed to execute goal org.apache.maven.plugins
- org.apache.jasper.JasperException: Failed to load or instantiate TagLibraryV
- 某QQ群聊天记录
- 松下伺服驱动器A4 串口通讯协议 中文
- jsp的request及增进研究【2】--编写代码解释Get及Post来的数据
- Windows CE 电源管理
- C#界面库
- org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: null due to
- 公开发布版的Windows Azure 基础结构服务中的 SQL Server – 文档和最佳实践(已更新),还有即将发布的博客
- python常用模块
- 解决 IE 不支持 document.getElementsByClassName() 的方法
- php nginx
- tomcat学院派&resin实用派
- CSS定位机制之一:普通流
- ASP.NET MVC3快速入门——第一节、概述
- 子窗口刷新父窗口然后关闭