#1 2012-06-20 19:23:38

DavidPujol
New member
Registered: 2012-05-14
Posts: 2

Route problem with cTalend Job and quartz scheduler

Hi all,

I want to schedule a job with quartz camel component.
My Job works fine : it calls a REST WS and pushes some data in a postgresql database.

To schedule this job, I have used cTalendJob as I've seen in the doc "TalendOpenStudio_ESB_MediationComponents_RG_51a_FR.pdf"

After that, I have used a cMessagingEndpoint with this URI (But I don't understand what is this "mygroup" and "mytimername"... Can you explain? ) :
"quartz://myGroup/myTimerName?cron=0+0/1+08-20+?+*+MON-FRI"

My route goes from the cMessaging Endpoint to the cTalend Job.

When I run the Job I have an Exception with a big stack trace :

Code:

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jersey/api/client/UniformInterfaceException
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
    at java.lang.Class.getConstructor0(Unknown Source)
    at java.lang.Class.newInstance0(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at org.apache.camel.util.ObjectHelper.newInstance(ObjectHelper.java:1119)
    at org.apache.camel.util.ReflectionInjector.newInstance(ReflectionInjector.java:32)
    at org.apache.camel.impl.DefaultInjector.newInstance(DefaultInjector.java:45)
    at org.talend.camel.TalendEndpoint.instantiateJob(TalendEndpoint.java:51)
    at org.talend.camel.TalendEndpoint.createProducer(TalendEndpoint.java:36)
    at org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:377)
    at org.apache.camel.impl.ProducerCache.acquireProducer(ProducerCache.java:108)
    at org.apache.camel.impl.ProducerCache.startProducer(ProducerCache.java:139)
    at org.apache.camel.processor.SendProcessor.doStart(SendProcessor.java:164)
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:49)
    at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:70)
    at org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:78)
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:49)
    at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:70)
    at org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:78)
    at org.apache.camel.processor.interceptor.TraceInterceptor.doStart(TraceInterceptor.java:358)
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:49)
    at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:70)
    at org.apache.camel.processor.RedeliveryErrorHandler.doStart(RedeliveryErrorHandler.java:1044)
    at org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:41)
    at org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:28)
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:49)
    at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:70)
    at org.apache.camel.processor.interceptor.DefaultChannel.doStart(DefaultChannel.java:152)
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:49)
    at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:70)
    at org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:78)
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:49)
    at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:70)
    at org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:78)
    at org.apache.camel.processor.UnitOfWorkProcessor.doStart(UnitOfWorkProcessor.java:88)
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:49)
    at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:70)
    at org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:78)
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:49)
    at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:70)
    at org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:78)
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)
    at org.apache.camel.impl.RouteService.startChildService(RouteService.java:315)
    at org.apache.camel.impl.RouteService.warmUp(RouteService.java:151)
    at org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:1925)
    at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1853)
    at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1646)
    at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1533)
    at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1420)
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)
    at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1388)
    at esb_cnrgv.cronsynchrogimaco_0_1.CronSynchroGIMACO$1CamelImpl.doStart(CronSynchroGIMACO.java:201)
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)
    at org.apache.camel.main.MainSupport.run(MainSupport.java:139)
    at esb_cnrgv.cronsynchrogimaco_0_1.CronSynchroGIMACO.Route(CronSynchroGIMACO.java:289)
    at esb_cnrgv.cronsynchrogimaco_0_1.CronSynchroGIMACO.runJobInTOS(CronSynchroGIMACO.java:410)
    at esb_cnrgv.cronsynchrogimaco_0_1.CronSynchroGIMACO.main(CronSynchroGIMACO.java:323)
Caused by: java.lang.ClassNotFoundException: com.sun.jersey.api.client.UniformInterfaceException
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    ... 74 more

I don't understand where is the problem. I tried "timer" and "seda" instead of "quartz", but I have the same exception sad

Could anyone help me?

How can I test only  my cTalendJob ?

Thanks,


Uploaded Images

Last edited by DavidPujol (2012-06-20 19:24:28)

Offline

#2 2012-06-20 21:58:52

eost
Talend Team
Registered: 2010-12-07
Posts: 246

Re: Route problem with cTalend Job and quartz scheduler

Hi David

Things like group and timer name are part of the quartz api.  You can find quartz specific documentation here http://quartz-scheduler.org/documentation .  The camel-quartz component provides a connector for quartz.  You can get the details from the Mediation Components guide that you mentioned, or read other information online here http://quartz-scheduler.org/documentation .

It looks like the problem is that you are not finding the appropriate REST libraries to support the REST invocation in your Job.  Can you post a picture of the job which you are trying to schedule with cTalendJob?  I assume you can run that job successfully yourself from within Studio, and that you only have problems when you try and run the job from the ESB Route?

Your approach is fine, but have you considered just invoking the RESTful service with the http://camel.apache.org/cxfrs.html consumer?   It may simplify your development experience.

Offline

#3 2012-06-21 18:36:21

DavidPujol
New member
Registered: 2012-05-14
Posts: 2

Re: Route problem with cTalend Job and quartz scheduler

Hi,

Thank you for your reply.

As you can see in the picture, I have used tREST component to call my Web Service.
Yes, I can run the Job from the studio, and also into the ESB runtime (Karaf).
And yes, I only have problem when my job is on a ESB route (Mediation perspective)

How can I use the Camel CXFRS inside the Studio? Is it the "cCXF" component?
But if I use it in the mediation perspective, how can i make the other parts of my job (XMLExtract, XMLMap...)?

Thank you for your help.


Uploaded Images

Last edited by DavidPujol (2012-06-21 18:38:13)

Offline

Board footer

Powered by FluxBB