REST webservices from TOS_ESB_6.4 to TOS_ESB_7.0 and tRESTClient component

Highlighted
Four Stars

REST webservices from TOS_ESB_6.4 to TOS_ESB_7.0 and tRESTClient component

Hello,

I have developed a set of REST webservices in TOS ESB 6.4 using tRESTRequest and tRESTResponse components. Each of theses webservices call subjobs via tRunJob component and connect to an ElasticSearch local database via tRESTClient component for reading and writing actions.
Theses webservices work well both in TOS ESB 6.4 and in Talend RunTime after building as OSGI bundles.

Now I want to migrate to TOS ESB 7.0. So I have exported my webservices in a zip archive to import them in TOS ESB 7.0.
One of the webservices execute well in the Studio, but I am facing a set of problems that I list below :

- Most of my webservices imported from Talend 6.4 to Talend 7.0 do not execute correctly in the Studio. I get a "Could not find or load main class local_project.myJobName" error. I read that this cood come from the fact that the JDK is not found by Talend. However some of the webservices do execute correctly in the studio.

- For the webservices that execute correctly in the Sudio 7.0, I have an issue with the build in OSGI bundle that I reproduced by creating a simple webservice. The following webservice calls a subjob which queries a local ElasticSearch database and send the result back to the main job and to the tRESTResponse.

mainJob.JPGSubJob.JPG

This job executes correctly in the Studio, but when I build the webservice as an OSGI bundle, it is well mounted by the Karak in the Runtime (the state is "Active" when I do a "list" command in Karaf") However, when I send a request to that webservice, I get a NoClassFoundException : "java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean".
Apparently the MANIFEST.MF file in the bundle jar misses some packages in the Import-Package part. Replacing in the manifest file the Import-Package part by the one similar Talend 6.4 built solves the problem : the webservice is mounted in Karaf.
Moreover, I realized that desactivating the tRestClient components in the webservice results in a correct built and a correct execution in Karaf.
So the conclusion seems to be that there is something going wrong in the build of a webservice containing tRESTClient components in Talend ESB 7.0.

Thank you for your help !

Thomas

Moderator

Re: REST webservices from TOS_ESB_6.4 to TOS_ESB_7.0 and tRESTClient component

Hello,

Have you tried to place the dependent jar "cxf-rt-rs-client-3.2.4.jar" in the karaf deploy folder(7.0.1) to see if it works?

It seems you are not able to deploy with all dependencies to the karaf for 7.0.1.

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.
Four Stars

Re: REST webservices from TOS_ESB_6.4 to TOS_ESB_7.0 and tRESTClient component

Hello Sabrina,

 

Thank you for your reply.

I have just added the file "cxf-rt-rs-client-3.2.4.jar" in the karaf deploy folder, but it does not change the problem. I also tried to add this Jar dependency to the folder /lib/ext/ of the Karaf container but with the same result and the same NoClassFound Exception.

I think the problem really comes from the MANIFEST.MF file that misses some dependencies.

 

Thank you for your help.

 

Best regards.

Thomas

Moderator

Re: REST webservices from TOS_ESB_6.4 to TOS_ESB_7.0 and tRESTClient component

Hello Thomas,

Here is a documentation about the osgi classloading algorithm, Managing OSGI Dependencies

For your issue, could you please create a jira issue of ESB project on talend bug tracker?

https://jira.talendforge.org/secure/Dashboard.jspa

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.
Four Stars

Re: REST webservices from TOS_ESB_6.4 to TOS_ESB_7.0 and tRESTClient component

Hi,

 

I have the same problem with TOS ESB 7.0.1

Do you know if it's solved with a later version ?

 

Thank you

Four Stars

Re: REST webservices from TOS_ESB_6.4 to TOS_ESB_7.0 and tRESTClient component

I meant with a *newer version, not a later Smiley Happy

Or if there is a workaround, any help is welcome.

Four Stars

Re: REST webservices from TOS_ESB_6.4 to TOS_ESB_7.0 and tRESTClient component

Solved; maybe someone would be interested by our case :

 

This error (class not found JAXRSClientFactoryBean) was triggered because we have a parent job that calls a child job; but we have deployed only the parent (ie build the OSGi bundle in Studio, then copy the .jar to container/deploy)

 

When we previously deploy the child job it's ok. The parent job is exposing a REST service with tRESTRequest, calling a child job that uses a 3d part REST API with a tRESTClient to build the response.

 

So when we build and deploy a job we have to build and deploy the chlidren first...

Six Stars

Re: REST webservices from TOS_ESB_6.4 to TOS_ESB_7.0 and tRESTClient component

@CAVincent I tried to build the child job first but it seems that this doesn't solve the issue for me. When I list all my jobs in Karaf the state of the child job is "Failure". Note that my child job does not start with a tRESTClient but first does a database query.

Did you do any other settings or just build the child job and then put it into the deploy folder? It looks that this workaround even made it worse because now I get a lot of NullPointerExceptions...

 

Four Stars

Re: REST webservices from TOS_ESB_6.4 to TOS_ESB_7.0 and tRESTClient component

@BasitThis thread concerns a very particular case with a parent job calling a child job using a tRESTClient. We had this very pb with this very situation. Indeed the solution for this was simply to build and deploy the child job, with no other actions.

I suggest you to open a new thread for your case, with more details : an extract of one of your child jobs in failure, and the logs produced by Karaf.

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

Talend API Designer – Technical Overview

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

Watch Now

Getting Started with APIs

Find out how to get started with APIs

Read