On Sat, Jan 12, 2013 at 1:18 AM, Chris Wolf <[email protected]> wrote: > Hello Christian, > > I'm using 2.10.0. Ok, from your hint, I found: > http://camel.apache.org/scheduledroutepolicy.html > so that should be enough to get me going. > > Any ideas about the other issue? cast except when using jpa in > consumer mode with consumeDelete=true? >
Can you post your Camel route. And the @Entity class that you use? The class cast exception does indicate some kind of array error, not sure why (eg that JDK class cast exception has always not been good at showing the exact types in use, so there is no confusion) > Thanks, > > -Chris > > On Fri, Jan 11, 2013 at 5:37 PM, Christian Müller > <[email protected]> wrote: >> Which version of Camel do you use? >> Have a look at route policy and/or the quartz component for sheduling >> routes. >> >> Best, >> Christian >> Am 11.01.2013 20:23 schrieb "Chris Wolf" <[email protected]>: >> >>> I have a JPA endpoint setup as a consumer, just performing a basic >>> query. If I have consumeDelete=false configured, >>> then it works and I see the entities. When consumeDelete=false is not >>> configured (default is to remove), then the error >>> occurs upon JpaTemplate calling EntityManagerImpl.remove(arg) - but >>> "arg" is of type Object[] - not the entity. >>> >>> Second issue is I'd like the route to just perform the query once. >>> As it is, invokes the query in a loop. >>> >>> Thanks >>> >>> Chris >>> >>> P.S. the EntityManagerImpl.remove(arg) issue is not due to the >>> entities not being enhanced - I verified that with javap. >>> >>> FailedObject: [Ljava.lang.Object;@1e3a0ec. Will commit all previous >>> successful processed message, and ignore this last failure. >>> javax.persistence.PersistenceException: <openjpa-2.2.0-r422266:1244990 >>> nonfatal user error> org.apache.openjpa.persistence.ArgumentException: >>> Attempt to cast instance "[Ljava.lang.Object;@1e3a0ec" to >>> PersistenceCapable failed. Ensure that it has been enhanced. >>> FailedObject: [Ljava.lang.Object;@1e3a0ec >>> at >>> org.apache.camel.component.jpa.JpaConsumer$1.doInJpa(JpaConsumer.java:102) >>> at >>> org.apache.camel.component.jpa.JpaTemplateTransactionStrategy$1$1.doInJpa(JpaTemplateTransactionStrategy.java:82) >>> at >>> org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:183) >>> at >>> org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:146) >>> at >>> org.apache.camel.component.jpa.JpaTemplateTransactionStrategy$1.doInTransaction(JpaTemplateTransactionStrategy.java:80) >>> at >>> org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130) >>> at >>> org.apache.camel.component.jpa.JpaTemplateTransactionStrategy.execute(JpaTemplateTransactionStrategy.java:78) >>> at >>> org.apache.camel.component.jpa.JpaConsumer.poll(JpaConsumer.java:75) >>> at >>> org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:139) >>> at >>> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:91) >>> at >>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) >>> at >>> java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317) >>> at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150) >>> at >>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98) >>> at >>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180) >>> at >>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204) >>> at >>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) >>> at >>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) >>> at java.lang.Thread.run(Thread.java:662) >>> Caused by: <openjpa-2.2.0-r422266:1244990 nonfatal user error> >>> org.apache.openjpa.persistence.ArgumentException: Attempt to cast >>> instance "[Ljava.lang.Object;@1e3a0ec" to PersistenceCapable failed. >>> Ensure that it has been enhanced. >>> FailedObject: [Ljava.lang.Object;@1e3a0ec >>> at >>> org.apache.openjpa.kernel.BrokerImpl.assertPersistenceCapable(BrokerImpl.java:4662) >>> at >>> org.apache.openjpa.kernel.BrokerImpl.cascadeTransient(BrokerImpl.java:2681) >>> at >>> org.apache.openjpa.kernel.BrokerImpl.delete(BrokerImpl.java:2769) >>> at >>> org.apache.openjpa.kernel.BrokerImpl.delete(BrokerImpl.java:2740) >>> at >>> org.apache.openjpa.kernel.DelegatingBroker.delete(DelegatingBroker.java:1102) >>> at >>> org.apache.openjpa.persistence.EntityManagerImpl.remove(EntityManagerImpl.java:730) >>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>> at >>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >>> at >>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >>> at java.lang.reflect.Method.invoke(Method.java:597) >>> at >>> org.springframework.orm.jpa.JpaTemplate$CloseSuppressingInvocationHandler.invoke(JpaTemplate.java:425) >>> at $Proxy12.remove(Unknown Source) >>> at >>> org.apache.camel.component.jpa.JpaConsumer$3.deleteObject(JpaConsumer.java:337) >>> at >>> org.apache.camel.component.jpa.JpaConsumer.processBatch(JpaConsumer.java:159) >>> at >>> org.apache.camel.component.jpa.JpaConsumer$1.doInJpa(JpaConsumer.java:97) >>> ... 18 more >>> -- Claus Ibsen ----------------- Red Hat, Inc. FuseSource is now part of Red Hat Email: [email protected] Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
