nctoolbox-20130305 and java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory

94 views
Skip to first unread message

Guillaume Galibert

unread,
Sep 26, 2013, 9:29:34 PM9/26/13
to ncto...@googlegroups.com, Monique Breslin
Hi all,

IMOS is an australian project on coastal oceanography and we are interested in using nctoolbox to provide users with a Matlab tool to read IMOS netCDF files either locally on their machine or via opendap. More details here https://github.com/aodn/imos-user-code-library/ .

We have been facing an odd issue recently to read datsets via opendap with the following configuration :

MATLAB Version 7.11.0.584 (R2010b)
Operating System: Microsoft Windows 7 Version 6.1 (Build 7601: Service Pack 1)
Java VM Version: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode

and

nctoolbox version 20130305


Please see below the Matlab commands and output. It would be much appreciated if you could point us what we might have done wrong.

>> setup_nctoolbox
NCTOOLBOX added to
Matlab path
>> javaclasspath
 
                                STATIC JAVA PATH
 
                C
:\Program Files\MATLAB\R2010b\java\patch                                        
                C
:\Program Files\MATLAB\R2010b\java\jarext\AnimatedTransitions.jar              
                C
:\Program Files\MATLAB\R2010b\java\jarext\ant.jar                    
               
...              
 
                                DYNAMIC JAVA PATH
 
                C
:\Users\Monique\Documents\MATLAB\nctoolbox-20130305\java\slf4j-log4j12-1.5.6.jar  
                C
:\Users\Monique\Documents\MATLAB\nctoolbox-20130305\java\slf4j-api-1.5.6.jar      
                C
:\Users\Monique\Documents\MATLAB\nctoolbox-20130305\java\protobuf-java-2.3.0.jar  
                C
:\Users\Monique\Documents\MATLAB\nctoolbox-20130305\java\opendap-2.2.jar          
                C
:\Users\Monique\Documents\MATLAB\nctoolbox-20130305\java\netcdf-4.2.jar            
                C
:\Users\Monique\Documents\MATLAB\nctoolbox-20130305\java\log4j-1.2.15.jar          
                C
:\Users\Monique\Documents\MATLAB\nctoolbox-20130305\java\je-4.0.71.jar            
                C
:\Users\Monique\Documents\MATLAB\nctoolbox-20130305\java\grib-8.0.jar              
                C
:\Users\Monique\Documents\MATLAB\nctoolbox-20130305\java\ehcache-1.6.0.jar        
                C
:\Users\Monique\Documents\MATLAB\nctoolbox-20130305\java\commons-httpclient-3.1.jar
                C
:\Users\Monique\Documents\MATLAB\nctoolbox-20130305\java\bufr-3.0.jar              
                C
:\Users\Monique\Documents\MATLAB\nctoolbox-20130305\java\bounce-0.14.jar          
                C
:\Users\Monique\Documents\MATLAB\nctoolbox-20130305\java                            
>> file_URL='http://thredds.aodn.org.au/thredds/dodsC/IMOS/eMII/demos/SOOP/SOOP-TMV/VLST_Spirit-of-Tasmania-1/transect/2011/07/IMOS_SOOP-TMV_TSB_20110709T092744Z_VLST_FV02_transect-D2M_END-20110709T203700Z.nc'
 
file_URL
=
 
http
://thredds.aodn.org.au/thredds/dodsC/IMOS/eMII/demos/SOOP/SOOP-TMV/VLST_Spirit-of-Tasmania-1/transect/2011/07/IMOS_SOOP-TMV_TSB_20110709T092744Z_VLST_FV02_transect-D2M_END-20110709T203700Z.nc
 
>> ncdataset(file_URL)
??? Error using ==> ncdataset>ncdataset.ncdataset at 91
Failed to open
http
://thredds.aodn.org.au/thredds/dodsC/IMOS/eMII/demos/SOOP/SOOP-TMV/VLST_Spirit-of-Tasmania-1/transect/2011/07/IMOS_SOOP-TMV_TSB_20110709T092744Z_VLST_FV02_transect-D2M_END-20110709T203700Z.nc
 
Caused by:
   
Java exception occurred:
    java
.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
 
                at
        org
.apache.commons.httpclient.MultiThreadedHttpConnectionManager.<clinit>(MultiThreadedHttpConnectionManager.java:70)
       
                at ucar
.nc2.util.net.HTTPSession.<clinit>(HTTPSession.java:74)
 
                at ucar
.nc2.dataset.NetcdfDataset.disambiguateHttp(NetcdfDataset.java:712)
 
                at ucar
.nc2.dataset.NetcdfDataset.openOrAcquireFile(NetcdfDataset.java:677)
 
                at ucar
.nc2.dataset.NetcdfDataset.openDataset(NetcdfDataset.java:424)
 
                at ucar
.nc2.dataset.NetcdfDataset.openDataset(NetcdfDataset.java:407)
 
                at ucar
.nc2.dataset.NetcdfDataset.openDataset(NetcdfDataset.java:392)
 
                at ucar
.nc2.dataset.NetcdfDataset.openDataset(NetcdfDataset.java:379)
 
   
Caused by: java.lang.ClassNotFoundException:
    org
.apache.commons.logging.LogFactory
 
                at java
.net.URLClassLoader$1.run(Unknown Source)
 
                at java
.security.AccessController.doPrivileged(Native Method)
 
                at java
.net.URLClassLoader.findClass(Unknown Source)
 
                at java
.lang.ClassLoader.loadClass(Unknown Source)
 
                at sun
.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
 
                at java
.lang.ClassLoader.loadClass(Unknown Source)
 
                at java
.lang.ClassLoader.loadClassInternal(Unknown Source)
 
               
... 8 more

We tried adding a commons-logging-1.1.3.jar to the path but without success :

>> ncdataset(file_URL)
??? Error using ==> ncdataset>ncdataset.ncdataset at 91
Failed to open
http
://thredds.aodn.org.au/thredds/dodsC/IMOS/eMII/demos/SOOP/SOOP-TMV/VLST_Spirit-of-Tasmania-1/transect/2011/07/IMOS_SOOP-TMV_TSB_20110709T092744Z_VLST_FV02_transect-D2M_END-20110709T203700Z.nc
 
Caused by:
   
Java exception occurred:
    java
.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
 
                at
        org
.apache.commons.httpclient.MultiThreadedHttpConnectionManager.<clinit>(MultiThreadedHttpConnectionManager.java:70)
       
                at ucar
.nc2.util.net.HTTPSession.<clinit>(HTTPSession.java:74)
 
                at ucar
.nc2.dataset.NetcdfDataset.disambiguateHttp(NetcdfDataset.java:712)
 
                at ucar
.nc2.dataset.NetcdfDataset.openOrAcquireFile(NetcdfDataset.java:677)
 
                at ucar
.nc2.dataset.NetcdfDataset.openDataset(NetcdfDataset.java:424)
 
                at ucar
.nc2.dataset.NetcdfDataset.openDataset(NetcdfDataset.java:407)
 
                at ucar
.nc2.dataset.NetcdfDataset.openDataset(NetcdfDataset.java:392)
 
                at ucar
.nc2.dataset.NetcdfDataset.openDataset(NetcdfDataset.java:379)
 
   
Caused by: java.lang.ClassNotFoundException:
    org
.apache.commons.logging.LogFactory
 
                at java
.net.URLClassLoader$1.run(Unknown Source)
 
                at java
.security.AccessController.doPrivileged(Native Method)
 
                at java
.net.URLClassLoader.findClass(Unknown Source)
 
                at java
.lang.ClassLoader.loadClass(Unknown Source)
 
                at sun
.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
 
                at java
.lang.ClassLoader.loadClass(Unknown Source)
 
                at java
.lang.ClassLoader.loadClassInternal(Unknown Source)
 
               
... 8 more


Brian Schlining

unread,
Sep 27, 2013, 11:26:07 AM9/27/13
to ncto...@googlegroups.com, Monique Breslin
Hi Guillaume,

Hey, glad you're trying out our tool. As to the issue below, when you added the apache-common.jar file, did you use `javaddpath`? 

Can you repeat what you did to add the apache-common.jar and then send me the entire output of javaclasspath?

Also, I've opened this as an issue at https://github.com/nctoolbox/nctoolbox/issues/12

Cheers

-- 
Brian Schlining

Reply all
Reply to author
Forward
0 new messages