camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rakesh <rakesh.bha...@gmail.com>
Subject Issues Using Mybatis Camel Component and SpringBoot
Date Fri, 20 May 2016 14:37:14 GMT
Hi,

Need help with below problem:
I am trying to connect database, using camel mybatis component. I am using
spring boot started for both 
camel and mybatis.

		<dependency>
			<groupId>org.apache.camel</groupId>
			<artifactId>camel-spring-boot-starter</artifactId>
			<version>2.17.1</version>
		</dependency>
		
		<dependency>
			<groupId>org.mybatis.spring.boot</groupId>
			<artifactId>mybatis-spring-boot-starter</artifactId>
			<version>1.1.1</version>
		</dependency>

Since I am using Springboot, all the datasource properties are load on the
start-up. Also I am using mybatis "MapperScan" to get the mybatis mappers.
Then I use the came RouteBuilder class, to execute the "select" sql from the
Mapper.xml file.

from("timer://testOnly?repeatCount=1&delay=4000")
		.log("Starting Mybatis Camel Compotent Run...")
		.to("mybatis:getErrorByMessageId?statementType=SelectOne")
		.log("Mybatis DB Message: "+ body())
		.end();

but getting NPE

Caused by: java.lang.NullPointerException: null
	at
org.apache.ibatis.session.defaults.DefaultSqlSessionFactory.openSessionFromDataSource(DefaultSqlSessionFactory.java:95)
~[mybatis-3.4.0.jar:3.4.0]
	... 15 common frames omitted

After debugging, found the mybatis is getting NULL environment. 

*Question:* Has any one tried using springboot+mybatis and camel? any
examples?
What additional configuration is required to get these 3 framework together?



--
View this message in context: http://camel.465427.n5.nabble.com/Issues-Using-Mybatis-Camel-Component-and-SpringBoot-tp5782840.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message