Hi Try to get a JPA example working on Tomcat without Camel. JPA is not that trivial to get working on various contains as it got classloading tricks to do for the JPA stuff. So I would look for a JPA + Tomcat. Maybe there is a example WAR ready to just try out.
And if you use Hibernate for JPA then check Hibernate docs to get it working in Tomcat. On Fri, Mar 19, 2010 at 6:12 PM, j_h_scheufen <janhendrik.scheu...@sungard.com> wrote: > > Hi all, > > I really don't know what could be going wrong in my JPA scenario. I'm using > the following route: > > from("jpa:com.infinity.bpm.jpa.beans.TransactionTracker") > .to("bean:transactionMessageTranslator") > .choice() > // the presence of the header field "correlationMap" > indicates that the > transaction message > // is intended to update an existing transaction > process. > .when( header("correlationMap").isNotNull() ) > //.to("bean:searchTransactionActivity") > .to("bean:transactionActivitySearch") > // Otherwise a new transaction process needs to be > created > .otherwise() > .setHeader("processID", > constant("TransactionProcessing")) > .end() > .to("activemq:queue:ApplicationQueue?jmsMessageType=Object"); > > When I load the spring application context in a unit test, everything is > fine. I have SQL output turned on and I see the JPA consumer polling the DB > and triggering the route when my test case inserts a line into the table: > > Hibernate: select transactio0_.id as id0_, transactio0_.plan_id as plan2_0_, > transactio0_.status as status0_, transactio0_.trans_id as trans4_0_ from > db.workqueue transactio0_ > Hibernate: select transactio0_.id as id0_, transactio0_.plan_id as plan2_0_, > transactio0_.status as status0_, transactio0_.trans_id as trans4_0_ from > db.workqueue transactio0_ > Hibernate: select transactio0_.id as id0_, transactio0_.plan_id as plan2_0_, > transactio0_.status as status0_, transactio0_.trans_id as trans4_0_ from > db.workqueue transactio0_ > Hibernate: select id from db.workqueue where id =? for update > 12:58:14 INFO [aComponent] Tracer - > a77f0f0b-f858-4a65-940d-cf1a3439ba75 >>> (route1) > from(jpa://com.infinity.bpm.jpa.beans.TransactionTracker) --> > bean://transactionMessageTranslator <<< Pattern:InOnly, > Headers:{cameljpatemplate=org.springframework.orm.jpa.jpatempl...@161e946}, > BodyType:com.infinity.bpm.jpa.beans.TransactionTracker, > Body:com.infinity.bpm.jpa.beans.transactiontrac...@e16021 > 12:58:14 INFO [aComponent] Tracer - > a77f0f0b-f858-4a65-940d-cf1a3439ba75 >>> (route1) > bean://transactionMessageTranslator --> choice <<< Pattern:InOnly, > Headers:{cameljpatemplate=org.springframework.orm.jpa.jpatempl...@161e946}, > BodyType:java.util.HashMap, Body:{status=null, transId=242424, planId=34534} > 12:58:14 INFO [aComponent] Tracer - > a77f0f0b-f858-4a65-940d-cf1a3439ba75 >>> (route1) choice --> > setHeader[processID] <<< Pattern:InOnly, > Headers:{cameljpatemplate=org.springframework.orm.jpa.jpatempl...@161e946}, > BodyType:java.util.HashMap, Body:{status=null, transId=242424, planId=34534} > > So far so good. Now I deploy everything on a local Tomcat instance with the > only difference being that the Spring context is now bootstrapped via the > web context loader. All beans including the CamelContext get loaded without > problems, but then the JPA consumer is just sitting there and is not polling > the DB at all, i.e. there's no SQL trace of the consumer ever querying the > DB. I even enabled JMX and used JConsole to look into the camel MBeans and > all looks fine. > > Does anyone have an idea what the reason could be for the JPA consumer not > to be polling in the Tomcat environment? There are no exceptions whatsoever > ... > > Any thought that I could investigate would help right now ... > > Thanks a lot! > > > -- > View this message in context: > http://old.nabble.com/JPA-consumer-starts-up%2C-but-is-not-polling-tp27951000p27951000.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus