Hi Bob:
That line refers to NetcdfFileCache, which you can verify is in
netcdf-2.2.16.jar. Could there be an older version of the nj22 library
somehow in your classpath?
John
Bob Simons wrote:
Last December I ran in to a dependency problem in netcdf-2.2.10.jar.
That problem seems to be still in netcdf-2.2.16.jar. The current
version of the exception is:
Exception in thread "main" java.lang.NoClassDefFoundError
at ucar.nc2.NCdump.print(NCdump.java:189)
at
gov.noaa.pfel.coastwatch.griddata.DataHelper.ncDumpString(DataHelper.
java:81)
at gov.noaa.pfel.coastwatch.griddata.Grid.testGrd(Grid.java:968)
at gov.noaa.pfel.coastwatch.griddata.Grid.main(Grid.java:4941)
at gov.noaa.pfel.coastwatch.TestAll.main(TestAll.java:125)
So your NCdump.java line 189 seems to be referring to a class that
wasn't included in the .jar file but should have been.
Your solution last December was to use the toolsUI-2.2.10.jar. That
worked then, so I will try to use toolsUI-2.2.16.jar now and hope that
fixes the problem.
There is also something about NetcdfFileCache in the email below (the
same problem?). But I don't know about that now because I don't use
NetcdfFileCache.
It would be great if you could fix this problem.
Thank you.
Here is the original email from around 2005-12-07:
John Caron wrote:
>
>
> Bob Simons wrote:
>
>> Thank you for your quick response.
>>
>> John Caron wrote:
>>
>>> i assume you are using ncCore.jar?
>>
>>
>>
>>
>> No. I'm using netcdf-2.2.10.jar. The download page says it just
reads netcdf 3 files but I needed to write them, too. And I am
interested (eventually) in netcdf 4.
>>
>>>
>>> It appears I introduced a dependency on NetcdfFileCache that i
forgot to include in the jar.
>>
>>
>>
>>
>> But NetcdfFileCache.class (and some inner classes) are in
netcdf-2.2.10.jar ...
>>
>>>
>>> This isnt a problem if you use the full netcdf.jar. If you need
the smaller jar, i will fix the problem.
>>
>>
>>
>>
>> It's sounds like I'm using the "right" jar. So which jar should I use?
>
>
>
>
> You should use netcdf-2.2.10.jar, which as you say has the
NetcdfFileCache in it. so why arent you seeing it?
> usually these things are classpath problems. put netcdf-2.2.10.jar
first to see if that solves it. If it does, track down what other jar
file in your classpath is interfering.
>
> if not, its probably a class loader problem. but lets not go there yet.
>
> BTW, sorry for the lack of documentation on transitioning from 2.1
-> 2.2. Ive gotten so used to it, I forget what has to be done.
Yes. Why isn't NetcdfFileCache being seen? I tried moving the
netcdf-2.2.10.jar reference to the beginning of the class path for the
compiler and Java. I still get the same error message. The source code
files and the older netcdf.jar are not in the class path (and the
files aren't in those directories either). And jikes and java are
clearly using 2.2.10, because I initially had several compiler errors
which forced me to switch to methods new to 2.2.10; those methods run
correctly when I run my test program; except for the problem with
NCdump.print/NetcdfFileCache.
class loader problem? I haven't had a class loader problem before. So
far, I'm just running this code on my computer (Windows XP Pro,
service pack 2), not on our Linux web server.
Please see additional comments below.
>
>>
>>>
>>>
>>> Bob Simons wrote:
>>>
>>>> I am trying to switch from Netcdf-java 2.1 to Netcdf-java 2.2.10.
>>>> I have gotten everything switched over (grumble, grumble, a
little documentation about how to handle things that have changed
would be nice... although maybe I just didn't find it, :-) ), except
for NCdump.print and its variants. Whenever I call it, I get the
error message:
>>>>
>>>> Exception in thread "main" java.lang.NoClassDefFoundError
>>>> at ucar.nc2.NCdump.print(NCdump.java:191)
>>>> at ucar.nc2.NCdump.printHeader(NCdump.java:54)
>>>> at <my code>
>>>>
>>>> Line 191 in the source code you distribute is
>>>> NetcdfFileCache.release(nc);
>>>>
>>>> Usually, these problems are solvable. But this time, I am at a
loss as to how to solve the problem.
>>>> It isn't an "import" problem in my code or a -cp problem on my
compiler command line, because my code compiles correctly.
>>>> It isn't a -cp problem on the java command line, because my
running code clearly finds NCdump.
>>>> It isn't that NetcdfFileCache.class isn't in the .jar you
distribute (I checked; it's there).
>>>>
>>>> I looked at the list of changes for 2.2.11, but didn't see
anything that looked relevant.
>>>>
>>>> I didn't find any unit test methods in the source code which
would demonstrate this class working correctly. (Maybe they are there
and I didn't find them.)
>>>>
>>>> Any suggestions?
>>>>
>>>> Sincerely,
>>>>
>>>> Bob Simons
>>>> Satellite Data Product Manager
>>>> Environmental Research Division
>>>> NOAA Southwest Fisheries Science Center
>>>> 1352 Lighthouse Ave
>>>> Pacific Grove, CA 93950-2079
>>>> (831)658-3205
>>>> bob.simons@xxxxxxxx
>>>> <>< <>< <>< <>< <>< <>< <>< <>< <><
>>
>>
>>
>>
>> Sincerely,
>>
>> Bob Simons
>> Satellite Data Product Manager
>> Environmental Research Division
>> NOAA Southwest Fisheries Science Center
>> 1352 Lighthouse Ave
>> Pacific Grove, CA 93950-2079
>> (831)658-3205
>> bob.simons@xxxxxxxx
>> <>< <>< <>< <>< <>< <>< <>< <>< <><
Sincerely,
Bob Simons
Satellite Data Product Manager
Environmental Research Division
NOAA Southwest Fisheries Science Center
1352 Lighthouse Ave
Pacific Grove, CA 93950-2079
(831)648-0272
bob.simons@xxxxxxxx
<>< <>< <>< <>< <>< <>< <>< <>< <><