如何解决geomesa+hbase pom中的类路径问题

osh3o9ms  于 2021-06-09  发布在  Hbase
关注(0)|答案(1)|浏览(637)

createschema(sft)引发java.lang.nosuchmethoderror:org.apache.curator.shaded.com.google.common.collect.maps.uniqueindex(ljava/lang/iterable;lcom/google/common/base/function;)lorg/apache/curator/shaded/com/google/common/collect/immutablemap;
我试图复制hbase的geomesa教程中pom的部分内容,但是读了其他文章后,我意识到这可能与同一个库有两个不同版本有关,为了自己解决这个问题,我对maven绝对是新手。。。

<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>
    <name>ScalabilityGeomesaHBase</name>
    <groupId>gr.tioahome.ee.geomesa.hbase.ntriples</groupId>
    <artifactId>ScalabilityGeomesaHBase</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>

        <geomesa.version>2.3.1</geomesa.version>
        <gt.version>20.0</gt.version>
        <scala.abi.version>2.11</scala.abi.version>

        <!-- environment specific variables-->
        <hbase.version>1.4.10</hbase.version>
        <zookeeper.version>3.4.14</zookeeper.version>
        <hadoop.version>2.7.7</hadoop.version>
        <rdf4j.version>2.5.1</rdf4j.version>
    </properties>

    <repositories>
        <repository>
            <id>maven2-repository.dev.java.net</id>
            <name>Jave.net repository</name>
            <url>http://download.java.net/maven/2</url>
        </repository>
        <repository>
            <id>osgeo</id>
            <name>Open Source Geospatial Foundation Repository</name>
            <url>http://download.osgeo.org/webdav/geotools</url>
        </repository>
        <!--
        <repository>
            <id>boundless</id>
            <name>Boundless Maven Repository</name>
            <url>https://repo.boundlessgeo.com/main</url>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>daily</updatePolicy>
            </snapshots>
        </repository>
        -->
    </repositories>

    <dependencyManagement>
        <dependencies>
            <!-- https://mvnrepository.com/artifact/org.geotools/gt-epsg-wkt -->
            <dependency>
                <groupId>org.geotools</groupId>
                <artifactId>gt-epsg-wkt</artifactId>
                <version>${gt.version}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.locationtech.geomesa</groupId>
            <artifactId>geomesa_2.11</artifactId>
            <version>${geomesa.version}</version>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>org.locationtech.geomesa</groupId>
            <artifactId>geomesa-utils_${scala.abi.version}</artifactId>
            <version>${geomesa.version}</version>
        </dependency>
        <dependency>
            <groupId>org.locationtech.geomesa</groupId>
            <artifactId>geomesa-index-api_${scala.abi.version}</artifactId>
            <version>${geomesa.version}</version>
        </dependency>

        <dependency>
            <groupId>org.locationtech.geomesa</groupId>
            <artifactId>geomesa-hbase-datastore_2.11</artifactId>
            <version>${geomesa.version}</version>
        </dependency>

        <dependency>
            <groupId>org.locationtech.geomesa</groupId>
            <artifactId>geomesa-hbase-spark-runtime_2.11</artifactId>
            <version>${geomesa.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-cli</groupId>
                    <artifactId>commons-cli</artifactId>
                </exclusion>
            </exclusions> 
        </dependency>
        <dependency>
            <groupId>org.locationtech.geomesa</groupId>
            <artifactId>geomesa-spark-sql_2.11</artifactId>
            <version>${geomesa.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.hbase</groupId>
            <artifactId>hbase-common</artifactId>
            <version>${hbase.version}</version>
        </dependency>

        <dependency>
            <groupId>org.eclipse.rdf4j</groupId>
            <artifactId>rdf4j-runtime</artifactId>
            <version>${rdf4j.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>ch.qos.logback</groupId>
                    <artifactId>logback-classic</artifactId>
                </exclusion>
            </exclusions> 
        </dependency>

        <dependency>
            <groupId>commons-cli</groupId>
            <artifactId>commons-cli</artifactId>
            <version>1.4</version>
        </dependency>

        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-sql_2.11</artifactId>
            <version>2.4.0</version>
            <type>jar</type>
        </dependency>

    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.1.1</version>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}</outputDirectory>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>false</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
ojsjcaue

ojsjcaue1#

我建议不要把 geomesa-hbase-spark-runtime_2.11 依赖性-这是一个阴影jar,可能会给您带来问题。你可以包括 geomesa-hbase-spark_2.11 ,这是非着色等效项。除此之外,在类路径上的jar中搜索 org.apache.curator 可能表明哪个jar有问题。

相关问题