Java.Lang.RuntimeException - Talend ESB - Karaf OSGi

Five Stars

Java.Lang.RuntimeException - Talend ESB - Karaf OSGi

Hello,

I have a very simple service I deployed in Karaf, when I run it I raise following error code:

 

error.jpg

 

 

Exception in component tRun]ob_3 (test_callPortype_test_calloperation)
java.lang.RuntineException: Child job returns 1. It doesn't terminate normally.
Error: Could not find or load main class local_project.test_message_0_1.test_message

My configuration is:

Talend ESB on Ubuntu machine 16.04 64 bit on VM machine

Java ver:

java.jpg

 

Sixteen Stars

Re: Java.Lang.RuntimeException - Talend ESB - Karaf OSGi

This is due to your "test_callPortype_test_calloperation" job failing for whatever reason. You need to show us what your "test_callPortype_test_calloperation" job looks like to give us any idea of why this might be.

Five Stars

Re: Java.Lang.RuntimeException - Talend ESB - Karaf OSGi

Hello,

this is how jobs looks like:

job.jpg

I made a dummy Job3 (a simple message box) and it works fine in the Talend ESB environment:

After exporting the service, creating a *.KAR file, and after deploying it to the OSGi Karaf environment everythig seems to work as expected:

karadf.jpg

Sixteen Stars

Re: Java.Lang.RuntimeException - Talend ESB - Karaf OSGi

You can't have a message box running within a service unless it is in the Studio. Where would the message box pop-up when running somewhere other than the Studio? It is completely redundant apart from within the Studio environment for testing. This will be why the job failed. Remove the message box and I would expect the service to work.

Five Stars

Re: Java.Lang.RuntimeException - Talend ESB - Karaf OSGi

Sorry I don't get you: I made intentionally a "dummy" service as the other 2 subjob are not working too.

Maybe my bad not to have explained correctly:

  • I have a main JOB that is a web service calling subjobs (based on parameter)
  • I have a Service that is connected to Test_call mainJOB
  • If I deploy on Karaf in Windows I don't have any problem: everything work as expected (including the dummy message)

So it seems this error is dependent on platform?

Thank you

Regs

 

Sixteen Stars

Re: Java.Lang.RuntimeException - Talend ESB - Karaf OSGi

Yeah I got that your web service is calling child jobs. The problem is caused by where the code is actually running. On your Studio, all of the code is running via a graphical user interface (Eclipse). It is a pseudo Talend runtime and works very differently from the Talend Runtime (Apache Karaf). The Talend Runtime runs on another machine WITHOUT a graphical user interface. A web service does not support pop-up windows or any graphical interfaces like that. The only reason it works on your Studio is because the Studio is a graphical user interface that runs the service within it in a debug state. This will never work on the Talend Runtime. You should NEVER use the message box in a web service. You shouldn't really use it very much with a DI job either. If you want to  output messages, use a a tJava and the System.out.

Five Stars

Re: Java.Lang.RuntimeException - Talend ESB - Karaf OSGi

First really thanks for your support, I do really appreciate.

Got your suggestion about GUI/WebService, but even I exclude the dummy job (messagebox) other jobs are not containing any GUI (basically they receive parameters, they open MySQL and does certain operation on DB) and they are not working as well.

As I said, Karaf container on another PC using Windows works as expected as a charm.

I did check all settings, JAVA, path, etc... but I cannot figure out what else to check.

Thx

Sixteen Stars

Re: Java.Lang.RuntimeException - Talend ESB - Karaf OSGi

The error you had previously was caused by the message box. You will need to raise a new issue regarding other problems. Can you look in your log folder  of your Runtime when you try to run the service (mine is here, as an example "E:\Talend\6.2.1\esb\container-app\log") and take a look in the tesb log file (you will likely see about 11 files in this folder). You need to send us the error messages you receive. My guess is that your MySQL database connection is not working.

Five Stars

Re: Java.Lang.RuntimeException - Talend ESB - Karaf OSGi

Hello, I just have 1 file in the ESBRuntime/Log folder (see attached).

MySQL DB was working ok as I did cross checked using the Studio job execution.

 

This is my application log:

Exception in component tRunJob_1 (test_callPortType_test_callOperation)
java.lang.RuntimeException: Child job returns 1. It doesn't terminate normally.
Error: Could not find or load main class local_project.esb_fb_post_0_1.ESB_fb_post

	at local_project.test_callporttype_test_calloperation_0_1.test_callPortType_test_callOperation.tRunJob_1Process(test_callPortType_test_callOperation.java:1432)
	at local_project.test_callporttype_test_calloperation_0_1.test_callPortType_test_callOperation.tESBProviderRequest_1_LoopProcess(test_callPortType_test_callOperation.java:4182)
	at local_project.test_callporttype_test_calloperation_0_1.test_callPortType_test_callOperation.tJava_1Process(test_callPortType_test_callOperation.java:2823)
	at local_project.test_callporttype_test_calloperation_0_1.test_callPortType_test_callOperation.runJobInTOS(test_callPortType_test_callOperation.java:4654)
	at org.talend.esb.job.controller.internal.RuntimeESBProviderCallback.run(RuntimeESBProviderCallback.java:120)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

Thx

Regs

SL

 

Sixteen Stars

Re: Java.Lang.RuntimeException - Talend ESB - Karaf OSGi

This seems to suggest that one of your child jobs (esb_fb_post_0_1) cannot be found or loaded. How are you building your service and how are you deploying it? Do you have another instance of that job deployed in your runtime? Also, what version of Talend are you using?

Five Stars

Re: Java.Lang.RuntimeException - Talend ESB - Karaf OSGi

Hello, I will try to answer your questions.

  • How are you building your service and how are you deploying it? 

I have a main JOB "test_callPortType_test_call" that is connected with a Services (port 8090) and it's executing subjobs based on parameter:

1.JPGMainJOb2.JPGConnected Service

To deploy it in Karaf:

  1. I created a KAR file exporting from the service
  2. I've executed Talend ESB Container (sudo ./trun)
  3. I've copied the KAR file into container/deploy folder 
  • Do you have another instance of that job deployed in your runtime?

NO, I've tested using Studio runtime (executing JOB), everything works has expected, but my goal is to use Karaf container as a service in my Ubuntu machine

 

  • What version of Talend are you using?

Talend ESB Ubuntu 64 bit - V.7.0.1.20171219_1109-M2

Sixteen Stars

Re: Java.Lang.RuntimeException - Talend ESB - Karaf OSGi

On your Karaf server (Runtime) can you try the following URL?

 

http://localhost:8040/services

 

This should show you the services that you have running. It should link to your WSDL.

 

Also, from the command line, log-in to your Karaf and type ....

 

bundle:list

 

Your service bundle should be Active.

 

Also, try running the service (if it is up and running and available) after having typed ....

 

log:tail

 

This will show you what happens when you run the service.

 

Post about what you see doing all of that. 

 

It might also be an idea to add some logging in the job that fails as well.

 

My suspicion is that your child job is failing due to MySQL connection issues. Just because it worked in the Studio does not mean it will work in the Runtime. They are very different environments. You need to identify why it is failing in your Runtime and this will require some logging.

Five Stars

Re: Java.Lang.RuntimeException - Talend ESB - Karaf OSGi

Hello,

this are the http://localhost:8040/services outputs:

1.JPG2.JPGbundle:list output:

3.JPG

 

log:tail output:

4.JPG

it shows it generate the output LOG file, I've checked again the MySQL DB and I cannot figure out about any potential issue: it works as expected.

 

As I said, If I deploy on Karaf on Windows10-64 bit all works as expected.

I'm really lost.

Any other things I can do to debug?

Thx

Sixteen Stars

Re: Java.Lang.RuntimeException - Talend ESB - Karaf OSGi

Ah, I didn't know (or didn't register) the bit about it working on another machine using Karaf. Did you say you are using Ubuntu (or some other flavour of Linux)? I think this could just be a communication issue with your MySQL box. The Karaf it works on isn't on the same box as the MySQL server is it? This could be an old (and rather annoying) "feature" of MySQL with user permissions per machine.

Five Stars

Re: Java.Lang.RuntimeException - Talend ESB - Karaf OSGi

Yes I'm using Ubuntu machine 16.04 64 bit on VM machine and I'm executing Karaf with sudo permission.

I'll try to create another dummy service to deploy and test, just simple log wirter to exclude any MySQL library.

 

Sixteen Stars

Re: Java.Lang.RuntimeException - Talend ESB - Karaf OSGi

On the Ubuntu machine, can you install a MySQL client and use it to communicate with your MySQL instance using exactly the same login credentials as Talend? That should tell you quite quickly whether that is the issue. This is just a guess as I have experienced similar issues in the past.

Five Stars

Re: Java.Lang.RuntimeException - Talend ESB - Karaf OSGi

Hello,

there's absolutely no problem with the MySQL DB:

1.JPG

 

I'll try to investigate more creating a new Service, but I suspect it may be due permission issue on Ubuntu?

Keep you posted and thanks a lot

Sixteen Stars

Re: Java.Lang.RuntimeException - Talend ESB - Karaf OSGi

Sorry for going back over old ground, but I want to make sure I am aware of everything. So the service works on the Windows machine, but not on Ubuntu? A MySQL client will work on both Ubuntu and Windows? 

What is NOT working? What is happening on Windows but not on Ubuntu? Is a database record being updated? Is a file being written? What indicates the failure on Ubuntu? 

Is there an error message that you can share?

Are you running the service as root (or sudo) on Ubuntu?

Have you configured the Runtimes the same? Do you have all of the same features installed in both? Are you using connection pooling? Do you have the same Jars in your deploy folders?

Five Stars

Re: Java.Lang.RuntimeException - Talend ESB - Karaf OSGi

Hello, my comments:

  • So the service works on the Windows machine, but not on Ubuntu? 

Service deployed on Karaf works only on my Windows Machine. In the EBS studio it works on both

  • MySQL client will work on both Ubuntu and Windows? 

Yes

  • What is NOT working? What is happening on Windows but not on Ubuntu? Is a database record being updated? Is a file being written? What indicates the failure on Ubuntu? 

When I export Service as KAR file to be runned inside Karaf OSGi in Ubuntu, it gives me the error: 

java.lang.RuntineException: Child job returns 1. It doesn't terminate normally.
Error: Could not find or load main class local_projec

 As I tryed to explain there's a Service listening for command, based on parameters it fires subjob.

SubJobs consist of inserting records in the MySQL DB

  • Is there an error message that you can share?

I've reported in the thread the error message that I got + Karaf LOG

 

  • Are you running the service as root (or sudo) on Ubuntu?

I've tryed everything, even running as sudo, granting 777 chmod right on the mail folder where all file are installed (jars, Talend files, etc...)

 

  • Have you configured the Runtimes the same? Do you have all of the same features installed in both? Are you using connection pooling? Do you have the same Jars in your deploy folders?

Absolutely everything configured equally.

 

 

Thank you

 

Sixteen Stars

Re: Java.Lang.RuntimeException - Talend ESB - Karaf OSGi

Does exactly the same Kar file (from the same compilation....an exact copy of the file) work on the Windows box but not the Linux box? If so, it proves that there is nothing wrong with the Kar, but there is a difference between your environments.

 

Sorry for all of the questions, but this is something that I would spend a while picking apart in detail....because there will be a difference. My initial suspicion was your MySQL connectivity (since I have seen this many times), but that doesn't appear to be the case. I'm now curious about the version of Java installed. Do you have the same JDK installed on all environments? It must be the JDK and not the JRE as there are subtle differences between the JDK's runtime and the JRE's runtime.

 

The other thing that I would want to look at is to try to identify what is causing the child job to fail. This can be painful, but the best way to do this is to remove functionality from the child job (deactivate) and run it until it completes successfully. This is a pain, but when the error message tells you very little, this is all you can really do. Remember that when you remove functionality, the job still needs to be able to complete without nullpointerexceptions, etc. So make sure the flow is OK.

Sorry I can't give you an instant answer, but believe it or not, this sort of frustrating, bang your head against a wall problem is how I learnt some of the most useful things with the Karaf.