Six Stars

Could not find or load main class - Standalone Job

I have created a standalone job that I'm trying to run in an Azure WebJob.  It throws the 'Could not find or load main class" error, but I can't fathom why.

 

 

java -v
openjdk version "1.8.0_144"
OpenJDK Runtime Environment (Zulu 8.23.0.3-win64) (build 1.8.0_144-b01) OpenJDK 64-Bit Server VM (Zulu 8.23.0.3-win64) (build 25.144-b01, mixed mode)
 
 
%JAVA_HOME% = D:\Program Files\Java\zulu8.23.0.3-jdk8.0.144-win_x64
Execution path of job = D:\home\site\wwwroot\App_Data\jobs\triggered\Import
 
I have read all of the similar threads in the forums but the seem to relate to running jobs within TOS rather than standalone.
 
I'd welcome any advice on how to solve this?
1 ACCEPTED SOLUTION

Accepted Solutions
Six Stars

Re: Could not find or load main class - Standalone Job

I managed to solve my problem.

 

Azure WebJobs require the script to run the job (.bat or .sh) in the root of the job, and all supporting files need to be subfolders off that root.  TOS creates job ZIP files with a /lib folder one layer above the actual job, and the Azure setup couldn't cope with that.  

 

To fix this, all I did was move the /lib folder down a level to below where the scripts and/.jar files are, and edit the scripts to set the classpath (-cp switch) form ../lib to ./lib

 

I know this is not ideal when you have multiple jobs as there's no way to leverage a common set of supporting assemblies, but I only need one job to run, so it works for me.

4 REPLIES
Community Manager

Re: Could not find or load main class - Standalone Job

Hello
OpenJDK is not a supported Java environment, please use Oracle JDK.

Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Six Stars

Re: Could not find or load main class - Standalone Job

Firstly, that's strange as on a local Ubuntu box my job runs perfectly with

 

openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-2ubuntu1.16.04.3-b11)
OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)

Secondly, I changed the JDK version to 

 

 

java version "1.8.0_73"

Java(TM) SE Runtime Environment (build 1.8.0_73-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.73-b02, mixed mode)

... the only other choice on Azure, and I still get the same error.

 

Six Stars

Re: Could not find or load main class - Standalone Job

@shong I hate to bump a thread like this, but any other ideas as to why I might be getting this error?  Is there anything I can do to try and get more troubleshooting information?

Six Stars

Re: Could not find or load main class - Standalone Job

I managed to solve my problem.

 

Azure WebJobs require the script to run the job (.bat or .sh) in the root of the job, and all supporting files need to be subfolders off that root.  TOS creates job ZIP files with a /lib folder one layer above the actual job, and the Azure setup couldn't cope with that.  

 

To fix this, all I did was move the /lib folder down a level to below where the scripts and/.jar files are, and edit the scripts to set the classpath (-cp switch) form ../lib to ./lib

 

I know this is not ideal when you have multiple jobs as there's no way to leverage a common set of supporting assemblies, but I only need one job to run, so it works for me.