camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wilkerson, Daniel" <dwilker...@fullsail.com>
Subject MyBatis Camel Route Config - ### Error opening session. Cause: java.lang.NullPointerException
Date Fri, 27 Mar 2015 16:35:48 GMT
Hi everyone. I'm working on a small prototype using Camel, Bindy, and MyBatis. I'm currently
doing this as a standalone Camel app. I'm not currently using Spring or Blueprint, just Java
DSL. I'm trying to keep this a simple as possible for the time being. We are looking at this
strategy to port an existing MyBatis based integration solution to Camel and MyBatis.

My code and Camel are able to bring in CSV files via the sFTP endpoint, process (bind) the
files to a list of Bean, and I'm trying to route it directly to a camel-mybatis endpoint.
Everything seems to be working fine until it tries to create the SqlSession. I get the error:
### Error opening session.  Cause: java.lang.NullPointerException

I have distilled our previous mybatis-config.xml down to one single <environment></environment>
for testing. I've read the MyBatis component page on the Camel site and see that for a Spring
based config, the session has to be externalized outside of the SqlMapConfig.xml.  I'm doing
my development in Eclipse using a Maven project. The Maven runtime I'm using inside of Eclipse
is 3.0.4

Is this the same for a DSL implementation not using Spring? How do I get Camel to crank up
a SqlSession? Also, once I get it to connect, how do I switch between different connections
configured in between <environment></environment> tags?

My DSL route that's inside my RouteBuilder subclass is:

  DataFormat bindy = new BindyCsvDataFormat("com.some.package.path.domain");

            from ("sftp:user@somedomain:4444/?password=********&binary=false&download=true&fileName=data.csv&consumer.delay="
+ delay)
            .log("<<<<Before Unmarshall>>>>").unmarshal(bindy).log(LoggingLevel.INFO,
"BODY OUTPUT: ${body}")
            .to("mybatis:insert?statementType=Insert&executorType=batch");


I think once I get the SqlSession to work the above route will work great. Thanks in advance
for any help!

Daniel

Mime
View raw message