Re: [netcdf-java] Using netcdf-java from Matlab

Just FYI, I found at least one workaround for this on the Matlab web site
at http://www.mathworks.com/support/solutions/en/data/1-2Z4RS7/


> I'm trying to use netcdf-java 4.0 from Matlab to access OpenDAP data and am
> getting the following error:
>
> >> import ucar.nc2.dataset.*
> >> nc = NetcdfDataset.openDataset('
> http://dods.mbari.org/cgi-bin/nph-nc/data/ssdsdata/deployments/m1/200810/m1_metsys_20081008_original.nc
> ')
> Loading units database: com/mathworks/uk/units/Unit.xml
> Fatal error: Could not open null
> java.io.IOException: Could not open null
> at
> com.mathworks.toolbox.mbc.units.UnitXML.urlToInputSource(UnitXML.java:541)
>  at com.mathworks.toolbox.mbc.units.UnitXML.toXdoc(UnitXML.java:148)
>

Technical SolutionsWhy do I receive errors when using the NetCDF Java
package in MATLAB 7.2 (R2006a)?
*Date Last Modified:* Friday, April 3, 2009*Solution ID:* 1-2Z4RS7*Product:*
 MATLAB <http://www.mathworks.com/products/matlab>*Reported in Release:*
R2006a*Platform:* All Platforms*Operating System:* All OS

Subject:

Why do I receive errors when using the NetCDF Java package in MATLAB 7.2
(R2006a)?
Problem Description:

I am attempting to use the NetCDF Java packages from within MATLAB and while
doing so I receive the following error:
Loading units database: com/mathworks/uk/units/Unit.xml
Fatal error: Could not open null
java.io.IOException: Could not open null
at
com.mathworks.toolbox.mbc.units.UnitXML.urlToInputSource(UnitXML.java:547)
at com.mathworks.toolbox.mbc.units.UnitXML.toXdoc(UnitXML.java:151)
at com.mathworks.toolbox.mbc.units.UnitXML.getFromXML(UnitXML.java:114)
at ucar.units.StandardUnitDB.addFromXML(StandardUnitDB.java:173)
at ucar.units.StandardUnitDB.<init>(StandardUnitDB.java:115)
...

Solution:

This issue is caused by and older version of the ucar.units package which is
used by the Model-Based Calibration Toolbox.

To work around this issue you can remove mwucarunits.jar from your classpath
as long as you do not use the Model-Based Calibration Toolbox which requires
mwucarunits.jar. To do this, follow these steps:

1. Execute the following command at the MATLAB command prompt:
edit classpath.txt
2. Find the following line:


$matlabroot/java/jarext/mwucarunits.jar

and comment it out:


##$matlabroot/java/jarext/mwucarunits.jar

3. Save the file and restart MATLAB.

-- 
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Brian Schlining
bschlining@xxxxxxxxx
  • 2009 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: