You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by jbailie1992 <jo...@libertymutual.com> on 2017/03/30 23:09:11 UTC
Camel - No component found with scheme:mybatis
I've got a Spring Boot app that makes use of Camel and Mybatis. I've got the
following mybatis dependencies in pom.xml:
*pom.xml*
....
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-mybatis</artifactId>
<version>${camel.version}</version>
</dependency>
....
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.0.1</version>
</dependency>
....
I've got the following route:
*MyRoute.java*
@Component
public class MyRoute extends SpringRouteBuilder{
@Autowired
MQConnectionProperties mqConnectionProperties;
@Override
public void configure() throws Exception {
from(mqConnectionProperties.getResponseQueue())
.to("mybatis:selectLogByPrimaryKey?statementType=SelectOne")
.process(new TargetSystemProcessor())
.end()
}
}
and the test for the route:
*MyRouteUnitTest.java*
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {MyRouteTestConfiguration.class})
@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
public class MyRouteUnitTest extends CamelTestSupport{
@Mock
MyBatisComponent mybatis;
@Autowired
MQConnectionProperties mqProps;
@Autowired
MyRouteBuilder route;
@Before
public void setup() throws Exception {
super.setUp();
context.addComponent("mybatis", mybatis);
}
@Test
public void test() throws Exception {
startCamelContext();
assertTrue(true);
stopCamelContext();
}
}
When I try to start the test without adding mybatis as a component to the
context, I get this error:
org.apache.camel.FailedToCreateRouteException: Failed to create route
My_Route at: >>>
To[mybatis:selectAuditLogByPrimaryKey?statementType=SelectOne] <<< in route:
Route(My_Route)[[From[seda:inpu... because of Failed to resolve endpoint:
mybatis://selectAuditLogByPrimaryKey?statementType=SelectOne due to: Cannot
auto create component: mybatis
....
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to
resolve endpoint:
mybatis://selectAuditLogByPrimaryKey?statementType=SelectOne due to: Cannot
auto create component: mybatis
....
Caused by: java.io.FileNotFoundException: Cannot find resource:
SqlMapConfig.xml in classpath for URI: SqlMapConfig.xml
Whenever I add the component to the context as shown i nthe test above, I
get this error:
org.apache.camel.FailedToCreateRouteException: Failed to create route
My_Route at: >>>
To[mybatis:selectAuditLogByPrimaryKey?statementType=SelectOne] <<< in route:
Route(My_Route)[[From[seda:inpu... because of Failed to resolve endpoint:
mybatis://selectAuditLogByPrimaryKey?statementType=SelectOne due to: No
component found with scheme: mybatis
As far as I can tell, I've got the right dependencies i nthe pom file to
hook all of this together, and mybatis works fine in the source code. For
unit testing I can work around it by replacing the endpoint, but I can't
write any integration tests for my route
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-No-component-found-with-scheme-mybatis-tp5796761.html
Sent from the Camel - Users mailing list archive at Nabble.com.