[netcdf-java] ThreddsDatasetChooser

Eric Russell eric-r at northwestern.edu
Wed Sep 5 10:42:43 MDT 2007


There is some initialization code for various libraries that needs to be 
called before you can use the ThreddsDatasetChooser. Here's what I have:

    thredds.ui.BAMutil.setResourcePath("/resources/nj22/ui/icons/");
    thredds.ui.UrlAuthenticatorDialog authenticator = new thredds.ui.UrlAuthenticatorDialog(null);
    java.net.Authenticator.setDefault(authenticator);
    ucar.nc2.dataset.HttpClientManager.init(authenticator, "Your Application Name");
    ucar.nc2.dods.DODSNetcdfFile.setAllowSessions(false);
    thredds.util.URLStreamHandlerFactory.register("adde", new edu.wisc.ssec.mcidas.adde.AddeURLStreamHandler());

In your case I think it was the HttpClientManager that failed because it
wasn't initialized.

Also, I may be missing some initialization code, because I got the above
by copy-and-pasting from ToolsUI.

Eric


At 10:31 AM -0400 9/5/07, Christopher Mueller wrote:
>Hello All,
>
>I was hoping someone out there had some experience implementing the
>ThreddsDatasetChooser component and would be willing to help me out a bit.
>I've made a very simple test class to get the ThreddsDatasetChooser up and
>running.  The class is at the end of this email.  I'm able to display the
>dialog without much trouble, but I am unable to make it connect to a
>catalog.  When I enter a catalog URL into the combobox and click
>"Connect", a progress dialog comes up after a few seconds and tells me
>that it's "opening the catalog"Šbut after about 20 seconds or so, the
>dialog goes away and nothing else happens.  I also get the following
>exception in the output pane of my IDE:
>
>Exception in thread "Thread-2" java.lang.NullPointerException
>        at
>thredds.catalog.ui.CatalogFactoryCancellable$OpenCatalogTask.run(CatalogFactoryCancellable.java:158)
>        at java.lang.Thread.run(Thread.java:613)
>
>Can anyone help me out and let me know what I'm not doing or doing wrong??
>
>Thanks in advance,
>Chris
>
>
>import java.io.IOException;
>import javax.swing.*;
>import thredds.catalog.ui.ThreddsDatasetChooser;
>import ucar.util.prefs.PreferencesExt;
>import ucar.util.prefs.XMLStore;
>
>/**
> *
> * @author asamac
> */
>public class Browse {
>
[etc...]

-- 
Eric Russell
eric-r at northwestern.edu


More information about the netcdf-java mailing list