Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Could not find or load main class from javax.mail

I have a two component job: tLibraryLoad --> onSubJobOK --> tJava.  In the tJava, I'm using the AWS SDK to interact with Amazon SES, which requires that the javax.mail.jar be installed.  I see that this doesn't exist as a download in Talend (mvn0683p000009MA5A.pngrg.talend.libraries/javax.mail/6.0.0-SNAPSHOT/jar), but I downloaded the jar manually and pointed to it through the Modules window.  Whenever I add that jar's path to the tLibraryLoad Advanced Settings page, I get a "Could not find or load main class" for the job upon running locally by pressing the Run button.  When I remove that jar reference from tLibraryLoad and run, the component works just fine.  Attempted to add the jar to Windows > Preferences > Java > Build Path > Classpath Variables, but no luck.

 

Any idea how I get this jar to be added to the component?

Labels (4)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Found a "solution": don't use javax.mail.  It turns out that the code inside a tSendMail component references javax.mail, but in the required modules only lists activation.jar and mail-1.4.jar, both of which were already listed as installed for me.  So, I added the mail jar to its own tLibraryLoad and the job ran.  Interestingly, when I tried to add it to the already-existing tLibraryLoad that contained other libraries (aws, joda, jackson, etc), the job threw an error on build.  Separating it into its own tLibraryLoad worked without issue.  

View solution in original post

8 Replies
Anonymous
Not applicable
Author

@Cory 

 

I would recommend to use routines instead of tLibraryLoad as it will be much easier to handle without showing the complexities within the Talend job. I have done a similar integration for Amazon Translate service. It may give you idea about creating the flow without tLibrary components.

 

https://community.talend.com/t5/Design-and-Development/Talend-and-Amazon-Translate-Integration/ta-p/...

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

Anonymous
Not applicable
Author

This is great and I'll take a look at it.  At a cursory glance, I see that it has the other jars I need to interact with SES.  However, it says that I need to install these jars to the routine.  If I can't install the library using my current methodology, I'm wondering if this method will result in the same error message?

 

I see that Step 4 under "Configure a Talend Routine for Amazon Translate" has an additional link about how to add Java libraries: Talend and Amazon Comprehend Integration.  However, when I click that link, I get a page that says "You do not have sufficient privileges for this resource or its parent to perform this action."   

Anonymous
Not applicable
Author

Hi,

 

    There seems to be a broken link in the article. Please refer the direct link shown below.

 

https://community.talend.com/t5/Design-and-Development/Talend-and-Amazon-Comprehend-Integration/ta-p...

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

Anonymous
Not applicable
Author

Thanks!  Will follow it through and respond when I've recreated the job as a routine.

Anonymous
Not applicable
Author

So I've followed the steps to install the jars in the routine.  As I add the import statements, I get an error: The import javax.mail cannot be resolved.  

Anonymous
Not applicable
Author

Currently researching to see if there's some other way to add the jar to the build classpath. Do you know of a way to accomplish this? It seems to not be reading the jar, even though I've added it to the BuildPath as both a classpath variable and a user library.

 

Edit: In case other people are having the same issue, look here:

https://javaee.github.io/javamail/FAQ#classpath

"You haven't set CLASSPATH properly."  So, the question remains: how do we add this jar to the classpath so that Talend will read it?

 

It goes on to say that if the program is running using java-jar, the CLASSPATH environment variable setting is ignored.  But, if you check the log file in your Talend install directory > workspace > .metadata > .log, you can see the command used to launch the job.

 

In my case, that's not the issue:

 

!ENTRY org.talend.platform.logging 1 0 2019-06-27 10:45:22.873
!MESSAGE 2019-06-27 10:45:22,872 INFO org.talend.designer.core.runprocess.Processor - Command line: java -Xms256M -Xmx1024M -Dfile.encoding=UTF-8 -cp /Applications/TalendToolsStudio-7.1.1/studio/workspace/.repositories/1669957220/master/[job-path]/classpath.jar: [job-name] --context=Default --stat_port=3799

 

Edit 2: 

Attempted to build the job and it says "Could not find artifact org.talend.libraries:javax.mail:jar:6.0.0-SNAPSHOT", even though I've pointed to it in the aforementioned paths and did a manual install of the jar and pointed to that from the Modules window.  Currently using Talend 7.1.1.  Is this a bug of some sort with this jar and Talend?

Anonymous
Not applicable
Author

I had some updates that I posted that have all seem to have disappeared in the last 15 minutes.  Really strange.  

 

Anyway, it's a classpath issue: https://javaee.github.io/javamail/FAQ#classpath. Unsure how to get libraries to be added to the buildpath given what I've tried above.  The question now is: How do we get Talend to reference this library?

Anonymous
Not applicable
Author

Found a "solution": don't use javax.mail.  It turns out that the code inside a tSendMail component references javax.mail, but in the required modules only lists activation.jar and mail-1.4.jar, both of which were already listed as installed for me.  So, I added the mail jar to its own tLibraryLoad and the job ran.  Interestingly, when I tried to add it to the already-existing tLibraryLoad that contained other libraries (aws, joda, jackson, etc), the job threw an error on build.  Separating it into its own tLibraryLoad worked without issue.