ClassNotFoundException: java.lang.NoClassDefFoundError

Highlighted
Six Stars

ClassNotFoundException: java.lang.NoClassDefFoundError

Hi there;

In one of my tJavaRow I’m using the library “org.apache.commons.lang3” where I use the Static class StringUtils and the method isBlank().

Obviously I added the java import org.apache.commons.lang3.StringUtils; on the advance tab of the tJavaRow.

 

The code compiles properly!

But at run time I get:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils

Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang3.StringUtils

 

So it compiles! therefore the compiler found the library!!!

But not the run time???

 

The library is physically in the following path under the Talend install:

 

lang3 in plugins.PNG

 

 

 

 

Talend knows that it is there as shown here:

talend know lang3.PNG

 

 

 

 

 

 

So what is out of synch that the compiler finds it but not the run time and how do I fix it.?

Do I add reference in one of the POMs?

 

 


Accepted Solutions
Six Stars

Re: ClassNotFoundException: java.lang.NoClassDefFoundError

Ok Since I'm back around I'll note my findings so others can benefit.

 

The issue is that talend was installed with Admin privileges and now when I run it without admin right I get the error above. If I run it with admin rights (run as administrator) it works fine!

 

Not intuitively obvious!!

 


All Replies
Moderator

Re: ClassNotFoundException: java.lang.NoClassDefFoundError

Hello,

Do you want to install external jar file into studio?

There are two ways for you to import and use an external jar.
1)Using tLibraryload component to load the jar file at the begininig of job. for example:
tLibraryLoad
   |
tJava(on tJava, use the external API)

2)Creating custom routine, import the external jar file by clicking on the routine name and editing the routine libraries, and then call this routine in the job.

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

Re: ClassNotFoundException: java.lang.NoClassDefFoundError

Hi there;

 

Maybe I do not understand the meaning of what I am seeing.

Given both images in my initial posting specially in the second which is specifically related to "installation details"

I would have expected that the package was there and visible. Specifically that given the import statement the code compiles.

 

Anyhow at this point it is mystery as I think some configuration is out of synch but the tLoadLibrary did work.

Six Stars

Re: ClassNotFoundException: java.lang.NoClassDefFoundError

Ok Since I'm back around I'll note my findings so others can benefit.

 

The issue is that talend was installed with Admin privileges and now when I run it without admin right I get the error above. If I run it with admin rights (run as administrator) it works fine!

 

Not intuitively obvious!!

 

Moderator

Re: ClassNotFoundException: java.lang.NoClassDefFoundError

Hello,

Thanks for sharing your solution with us.

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.

Calling Talend Open Studio Users

The first 100 community members completing the Open Studio survey win a $10 gift voucher.

Start the survey

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 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download