Job with Subjobs error when deployed as OSGI (Karaf)

Highlighted
Five Stars

Job with Subjobs error when deployed as OSGI (Karaf)

Hello there,

 

I have a job with a tRESTrequest entry point doing some json extract, parsing and launching other job depending on some parameters.

The job and subjobs are all running and ok when testing inside the studio (7.2) but when i deploy it as an OSGI bundle on a karaf server it doesn't work anymore, the main job is running ok but i get an error as soon as the subjob is called :

 

java.lang.RuntimeException: java.lang.NoClassDefFoundError ...

Caused by: java.lang.ClassNotFoundException: process.transfert_oracle_ged_1p_ts_ta_1_0.Transfert_Oracle_GED_1P_TS_TA cannot be found by process.WS_Transfert_Oracle_GED_Prod_1.0.0

 

If anyone can help that would be lovely!

Sincerely,
Nrd


Accepted Solutions
Five Stars

Re: Job with Subjobs error when deployed as OSGI (Karaf)

Adding to my previous answer :

 

Job with subjobs is now working, but only with manual editing of the generated jar.

 

Step done : 

1. build as OSGI like usual

2. extract all subjob jar from the bundle and put their content in the same folder as the main job in the bundle jar

3. add libs needed by subjobs in the lib folder of the bundle jar and edit manifest accordingly

 

i've been able to reproduce this with 2 jobs + subjobs.

 

explanation :

 

the OSGI bundle generated from Talend is not correct, imagine a job "job1" with your tRestRequest and 2 subjobs ("sub1" and "sub2"), talend will generate a bundle with inside

  • lib : all lib needed but only for main job
  • META_INF : manifest file but again only for main job
  • [projectname] : inside you will find the folder of the mainjob with all its class
  • [jobname], so here "job1" : inside you will find the jar of all subjobs, so here 2 jars "sub1.jar" and "sub2.jar" <- this is a problem as karaf will look for the classes in job1/subjobname/*.class
  • 2 other folder (osgi_inf and xmlmappings) that seems correct

one solution is to move the folder contained in the subjob jar alongside the folder of the mainjobclass + add the required jar to the lib folder and edit the manifest.

 

Anyway it seems there's a bug with Talend and/or Maven here.

 

 


All Replies
Moderator

Re: Job with Subjobs error when deployed as OSGI (Karaf)

Hello,

The "Use an independent process to run subjob" option on tRunJob is not compatible with the Runtime. When this option is selected, the child Job will be executed as a separate application. It is a bundle installed on the Runtime after the Web Service or Route is deployed onto the Runtime, therefore it cannot find the executable class file for the child Job. To resolve this issue, please try to disable the "Use an independent process to run subjob" option on the tRunJob component and re-deploy the Web Service or Route onto Runtime server.

Let us know if it is OK with you.

Best regards

Sabrina

 

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Five Stars

Re: Job with Subjobs error when deployed as OSGI (Karaf)

Hello Sabrina,
Thanks for your answer.

Problem is I did not enable the use of independent process for my subjobs. checkbox is cleared.

Problems seems to be in the way the .jar is built, when i open it with a jar explorer subjobs jar seems to be in the wrong place

 

Annotation 2019-10-21 113430.png

Moderator

Re: Job with Subjobs error when deployed as OSGI (Karaf)

Hello,

 Are your studio and runtime on the same server? Did you run your .jar file in  V 7.2 runtime as well?

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Five Stars

Re: Job with Subjobs error when deployed as OSGI (Karaf)

No studio is on my desktop computer; a w10 box, runtime is installed on a linux dedicated server, both same version 7.2.
Moderator

Re: Job with Subjobs error when deployed as OSGI (Karaf)

Hello,

Are the JAVA_HOME and PATH configured with the correct Java installed locations on the runtime server?

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Five Stars

Re: Job with Subjobs error when deployed as OSGI (Karaf)

Thanks for your support by the way, a pleasure to have answers that fast Smiley Happy.

 

Yes they are, beside i have many ESB jobs (container) running on the server. Problem is only with this job, which is the only one with subjobs.

 

From what i see the problem seems to be the build OSGI function when there are subjobs  : when i look inside the .jar created, subjobs jar are in the wrong place, the lib folder is missing the jar needed by the subjobs and the manifest file seems incomplete.

 

To check, I tried to manually edit the compiled OSGI jar by :

  1. adding the folder with the subjobs compiled class in the correct folder (i extracted them from the jar) within the osgi jar
  2. adding the missing jar in the lib folder of the OSGI jar
  3. editing the manifest to load these jar (the one of 2.)

and the job is working now (main job launch subjob successfully on the server), though context variables are not passed on, so it seems there's still a problem or it's still missing something.

 

Anyway, it seems the build as OSGI function for a job with subjobs isn't working in v7.x, at least here.

 

Five Stars

Re: Job with Subjobs error when deployed as OSGI (Karaf)

Adding to my previous answer :

 

Job with subjobs is now working, but only with manual editing of the generated jar.

 

Step done : 

1. build as OSGI like usual

2. extract all subjob jar from the bundle and put their content in the same folder as the main job in the bundle jar

3. add libs needed by subjobs in the lib folder of the bundle jar and edit manifest accordingly

 

i've been able to reproduce this with 2 jobs + subjobs.

 

explanation :

 

the OSGI bundle generated from Talend is not correct, imagine a job "job1" with your tRestRequest and 2 subjobs ("sub1" and "sub2"), talend will generate a bundle with inside

  • lib : all lib needed but only for main job
  • META_INF : manifest file but again only for main job
  • [projectname] : inside you will find the folder of the mainjob with all its class
  • [jobname], so here "job1" : inside you will find the jar of all subjobs, so here 2 jars "sub1.jar" and "sub2.jar" <- this is a problem as karaf will look for the classes in job1/subjobname/*.class
  • 2 other folder (osgi_inf and xmlmappings) that seems correct

one solution is to move the folder contained in the subjob jar alongside the folder of the mainjobclass + add the required jar to the lib folder and edit the manifest.

 

Anyway it seems there's a bug with Talend and/or Maven here.

 

 

Four Stars

Re: Job with Subjobs error when deployed as OSGI (Karaf)

Hello,
I have the same problem. Is there already a bugfix?
Moderator

Re: Job with Subjobs error when deployed as OSGI (Karaf)

Hello @Breaker 

Are you getting this issue in v 7.2 as well on-premise solution? Could you please create a support case on talend support portal? In this way, our colleagues from support team will check it to see if there is a fixed patch for you.

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 3

Read about some useful Context Variable ideas

Blog

Talend Studio Improvements for API Services

Take a look at the Talend Studio improvements for API Services

Watch Now

Talend API Designer – Technical Overview

Take a look at this technical overview video of Talend API Designer

Watch Now