You get this error because the Connection object is null ( https://github.com/apache/camel/blob/camel-2.2.0/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcProducer.java#L67). So I suspect that a problem occurred during creation of the DataSource object
On Fri, May 2, 2014 at 11:35 AM, Shiv <[email protected]> wrote: > Hi all, > I am using Camel JDBC component for first time and I need to query a table > in MS SQL Server 2008 R2 and push the results to an ActiveMQ queue. I used > the details on http://camel.apache.org/jdbc.html page and tried to get the > setup. Once my route define in Spring configuration file is started, I am > getting java.lang.NullPointerException in log. I am using Camel 2.2.0 (it > is pretty old but is part of a legacy system). I have camel-jdbc-2.2.0, > sqljdbc4 and org.springframework.jdbc-2.5.6 jars on classpath. any input > will be great. > > Route detail: > ----------------------------- > <from uri="timer://kickoff?period=1000"/> > <setBody><constant>select * from test</constant></setBody> > <to uri="jdbc:testdb"/> > <to uri="activemq:queue:testdb"/> > > Data Source: > ----------------- > <bean id="testdb" > class="org.springframework.jdbc.datasource.SimpleDriverDataSource"> > <property name="driverClass" > value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/> > <property name="url" > value="jdbc:microsoft:sqlserver://<host > name>:1433;DatabaseName=test"/> > <property name="username" value="test"/> > <property name="password" value="test"/> > </bean> > > Exception log: > ------------------- > 2014-05-02 14:39:59,467 | INFO | Exchange[ > , Id:6d87d9ba-85ef-4cf6-a9f7-a4b1be999f1b > , > > Properties:{CamelToEndpoint=log://toDLC?multiline=true&showAll=true&showCaughtException=true, > CamelTimerFiredTime=Fri May 02 14:39:59 IST 2014, > CamelFailureEndpoint=jdbc://testdb, CamelTimerPeriod=1000, > CamelTimerName=kickoff, > CamelExceptionCaught=java.lang.NullPointerException} > , Headers:{firedTime=Fri May 02 14:39:59 IST 2014} > , BodyType:String > , Body:select * from test > , CaughtExceptionType:java.lang.NullPointerException, > CaughtExceptionMessage:null, StackTrace:java.lang.NullPointerException > at > org.apache.camel.component.jdbc.JdbcProducer.process(JdbcProducer.java:67) > at > > org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:97) > at > > org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:95) > at > org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146) > at > org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:94) > at > org.apache.camel.processor.SendProcessor.process(SendProcessor.java:82) > at > > org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67) > at > > org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53) > at > > org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82) > at > > org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:93) > at > > org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52) > at > > org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67) > at > > org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:177) > at > > org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:143) > at > > org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88) > at > > org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:56) > at > org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:228) > at org.apache.camel.processor.Pipeline.process(Pipeline.java:74) > at > > org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:66) > at > > org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48) > at > > org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67) > at > > org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:103) > at > org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:50) > at java.util.TimerThread.mainLoop(Timer.java:512) > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/java-lang-NullPointerException-in-Camel-JDBC-component-for-Select-statement-tp5750783.html > Sent from the Camel - Users mailing list archive at Nabble.com. > -- Charles Moulliard Apache Committer / Architect @RedHat Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
