NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

[netcdf-java] Maven dependency problem with slf4j

Hi list,

I have local system installation of netCDF-Java from Github:

$ git clone .../thredds.git
$ cd thredds
$ mvn install

Build works great, but I am trying to resolve dependencies to this installation 
locally with another package, and I am running into problems. I am using one of 
the basic netCDF-Java examples from the netCDF-Java website. This is the 
pom.xml file I am using to compile, while successfully resolves the netCDF-Java 
dependency:

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
    http://maven.apache.org/xsd/maven-4.0.0.xsd";>

    <modelVersion>4.0.0</modelVersion>
    <groupId>test</groupId>
    <artifactId>test</artifactId>
    <packaging>jar</packaging>
    <version>0.1</version>
    <name>test</name>

    <dependencies>
        <dependency>
                        <groupId>edu.ucar</groupId>
                        <artifactId>netcdf</artifactId>
                        <version>4.3.8-SNAPSHOT</version>
                </dependency>
    </dependencies>

</project>

However, when I try to run the example program,

$ java -cp target/test-0.1.jar Test

Exception in thread "main" java.lang.NoClassDefFoundError: 
ucar/ma2/InvalidRangeException
Caused by: java.lang.ClassNotFoundException: ucar.ma2.InvalidRangeException
        at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:266)

If I add the netCDF jar I get:

$ java -cp ../thredds/cdm/target/netcdf-4.3.8-SNAPSHOT.jar:target/test-0.1.jar 
Test

xception in thread "main" java.lang.NoClassDefFoundError: 
org/slf4j/LoggerFactory
        at ucar.nc2.NetcdfFile.<clinit>(NetcdfFile.java:97)
        at Test.main(Test.java:37)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
        at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
        ... 2 more

And so on. Is there a way to include all of these sub-dependencies 
automatically, given that I already included netcdf?

Thanks,
Noah



  • 2012 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: