One Star

[resolved] Error Could not find the main class

Hi,
I have exported a Job created with TIS 4.2.2|r63143.
When I deployed my Job inside my server and when I launch it ( with a cron tasks ) I have this error :
Exception in thread "main" java.lang.NoClassDefFoundError: routines/system/api/TalendJob
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Caused by: java.lang.ClassNotFoundException: routines.system.api.TalendJob
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 12 more
Could not find the main class: projet_albin.my_job.my_job. Program will exit.

That's very strange because when I make the same export with a TOS version, I have no problem when I execute my Job.
Some idea ?
Thanks.
2 ACCEPTED SOLUTIONS

Accepted Solutions
One Star

Re: [resolved] Error Could not find the main class

Hi all,
there is a bug in the 4.2.2 job's extraction !!
If you choose only Unix version, the classpath.jar is incorrect !!
To by pass the pb you can generate both (win + unix) then the classpath.jar generated will be ok !!!!
Regards,
etl_talend
One Star

Re: [resolved] Error Could not find the main class

Still present in v4.2.3 r67267, and I'm REALLY glad I found this post - I was going crazy! Using "All" for "Shell Launcher" option solved the problem.
17 REPLIES
Community Manager

Re: [resolved] Error Could not find the main class

Hi albin
The job is not exported completely, some of class file are missing. To check if the job runs fine in a TIS studio and try to regenerate it again.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] Error Could not find the main class

Hi Shong,
Thanks for your answer.
My Job works perfectly inside TIS Studio.

I tried to export it a several time but the problem persits.
Community Manager

Re: [resolved] Error Could not find the main class

Hi alin
Ok, please report a support ticket and send us the job item, so that our support team can investigate it further.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] Error Could not find the main class

Hi all,
there is a bug in the 4.2.2 job's extraction !!
If you choose only Unix version, the classpath.jar is incorrect !!
To by pass the pb you can generate both (win + unix) then the classpath.jar generated will be ok !!!!
Regards,
etl_talend
One Star

Re: [resolved] Error Could not find the main class

I confirm.
I have export my Job with both (win + unix ) and my Job work fine now into my Unix server.
Thanks a lot for your answers.
One Star

Re: [resolved] Error Could not find the main class

Am trying to export a job but files are missing???
I tried to export it as UNIX project, Windows or Any but I still get the same issue!!!!
Is there a way to export only the files you need including java files?????????????
Thank you in advance,
Bujar
One Star

Re: [resolved] Error Could not find the main class

Hello,
It looks the bug is still present in the TOS version 4.2.3...
Is a patch planned in a near future?
One Star

Re: [resolved] Error Could not find the main class

Still present in v4.2.3 r67267, and I'm REALLY glad I found this post - I was going crazy! Using "All" for "Shell Launcher" option solved the problem.
One Star

Re: [resolved] Error Could not find the main class

hi, i had the same problem and is a problem with the 4.2.2 job's extraction. I only had to changed the version. very good post.
tks
One Star

Re: [resolved] Error Could not find the main class

Same here (on 4.2.3) - thanks for the post. I thought I'm going crazy.
I had it exported once and it worked while later exports keep erroring out. The difference was I was only selecting the Unix launcher...
One Star

Re: [resolved] Error Could not find the main class

Hi albin
The job is not exported completely, some of class file are missing. To check if the job runs fine in a TIS studio and try to regenerate it again.
Best regards
Shong

Thats all very nice and dandy but what do I do if I don't have TIS???
One Star

Re: [resolved] Error Could not find the main class

Same problem on 5.0.2 under windows XP.
Using "All" for "Shell Launcher" option works too on this version, thanks!
One Star

Re: [resolved] Error Could not find the main class

Here's Every one's export functionality is working in one or the other way but it was not working in my system Smiley Sad
Problem: I created a job and was working perfect but when i am exporting the same job main class is missing in folder. I followed the suggestions who all mentioned above {using "All" for Shell Launcher and by windows too} but still it is not working. I request to help and im new to talend.
I am using Talend 5.2.0 on windows 7 machine.
Thanks a Lot in Advance.
Regards
Naveen
One Star

Re: [resolved] Error Could not find the main class

Here's Every one's export functionality is working in one or the other way but it was not working in my system Smiley Sad
Problem: I created a job and was working perfect but when i am exporting the same job main class is missing in folder. I followed the suggestions who all mentioned above {using "All" for Shell Launcher and by windows too} but still it is not working. I request to help and im new to talend.
I am using Talend 5.2.0 on windows 7 machine.
Thanks a Lot in Advance.
Regards
Naveen

Strange, not working for me too, i am using talend 5.4 on windows 7 , tried both way only windows and all.
Community Manager

Re: [resolved] Error Could not find the main class

Hi shripatel
This topic is a little old, for better following up your problem, I would suggest you to open a new topic for your problem with details.
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] Error Could not find the main class

hi
I am using Talend Big Data 6.2 tool and exporting job as BuildJob->Build Type: OSGI Bundle for ESB. Now when I am using java code to call this jar file, it is still showing error as : 
Exception in thread "main" java.lang.NoClassDefFoundError: routines/system/api/TalendJob
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at TestClassTalendJar.main(TestClassTalendJar.java:5)
Caused by: java.lang.ClassNotFoundException: routines.system.api.TalendJob
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 13 more
Please suggest me the way. We are running behind of time and not able to progress a single steps ahead.
Prakash
Moderator

Re: [resolved] Error Could not find the main class

Hi Prakash,
We have replied to your another topic:https://www.talendforge.org/forum/viewtopic.php?id=52521.
Could you please take a look at it?
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.