Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 无法实例化实现:AstyanaxStoreManager_Java_Maven_Cassandra_Titan - Fatal编程技术网

Java 无法实例化实现:AstyanaxStoreManager

Java 无法实例化实现:AstyanaxStoreManager,java,maven,cassandra,titan,Java,Maven,Cassandra,Titan,我尝试使用Cassandra后端访问Titan graph数据库,使用以下代码一切正常: package ch.uzh.ifi.ddis.dm.twhc.clusterhierarchy; import ch.uzh.ifi.ddis.dm.twhc.clusterhierarchy.persistence.ITreeSerializer; import ch.uzh.ifi.ddis.dm.twhc.clusterhierarchy.persistence.Titan

我尝试使用Cassandra后端访问Titan graph数据库,使用以下代码一切正常:

    package ch.uzh.ifi.ddis.dm.twhc.clusterhierarchy;

    import ch.uzh.ifi.ddis.dm.twhc.clusterhierarchy.persistence.ITreeSerializer;
    import ch.uzh.ifi.ddis.dm.twhc.clusterhierarchy.persistence.TitanSerializer;

    public class ConnectionOkDriver {

        public static void main(String[] args) {
            ITreeSerializer serializer = TitanSerializer.getInstance();
            if (serializer.dbConnected()) {
                System.out.print("connection ok");
            } else {
                System.out.print("connection NOT ok");
            }
        }
    }
输出(忽略SLF4J错误):

现在,如果我启动以下主方法,我会得到一个
无法实例化实现的
错误:

    package ch.uzh.ifi.ddis.dm.twhc.input;

    import ch.uzh.ifi.ddis.dm.twhc.clusterhierarchy.persistence.ITreeSerializer;
    import ch.uzh.ifi.ddis.dm.twhc.clusterhierarchy.persistence.TitanSerializer;

    public class ConnectionFailsDriver {

        public static void main(String[] args) {
            ITreeSerializer serializer = TitanSerializer.getInstance();
            if (serializer.dbConnected()) {
                System.out.print("connection ok");
            } else {
                System.out.print("connection NOT ok");
            }
        }
    }
输出(再次忽略SLF4J错误):


你知道我为什么会出现这个错误吗?

这个问题与分布在多个maven模块上的依赖项有关。为了修复它,我将所有“外部”依赖项(如
titan-all
)移动到核心(或者我们应该如何称呼它?)maven模块
2whc
。所有其他模块现在只依赖于我自己的模块。例如,
2whc cluster impl
仅依赖于
2whc cluster hierarchy impl
2whc cluster hierarchy impl
对其自身pom没有任何依赖关系。然而,EclipseMavenPOM编辑器的tab-effective pom为所有模块显示了模块自己的依赖项和核心模块
2whc
依赖项

2whc集群实施的pom

<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>
    <parent>
        <artifactId>2whc</artifactId>
        <groupId>ch.uzh.ifi.ddis.dm</groupId>
        <version>0.0.1-SNAPSHOT</version>
        <relativePath>..</relativePath>
    </parent>

    <artifactId>2whc-clustering-impl</artifactId>

    ...

    <dependencies>      
        <dependency>
            <groupId>ch.uzh.ifi.ddis.dm</groupId>
            <artifactId>2whc-cluster-hierarchy-impl</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>   
    </dependencies>
</project>
2whc的pom

<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>ch.uzh.ifi.ddis.dm</groupId>
    <artifactId>2whc</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>Two-Way Hierarchical Clustering</name>

    ...

    <modules>
        <module>2whc-clustering-api</module>
        <module>2whc-clustering-impl</module>
        <module>2whc-cluster-hierarchy-impl</module>
        <module>2whc-recommendations-impl</module>
    </modules>

    ...

    <dependencies>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${slf4j.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>${testng.version}</version>
        </dependency>
        <dependency>
            <groupId>net.sf.supercsv</groupId>
            <artifactId>super-csv</artifactId>
            <version>2.1.0</version>
        </dependency>    
        <dependency>
            <groupId>org.apache.xmlbeans</groupId>
            <artifactId>xmlbeans</artifactId>
            <version>2.6.0</version>
        </dependency>    
        <dependency>
            <groupId>net.sf.trove4j</groupId>
            <artifactId>trove4j</artifactId>
            <version>3.0.3</version>
        </dependency>    
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-math3</artifactId>
            <version>3.2</version>
        </dependency>           
        <dependency>
            <groupId>ch.uzh.agglorecommender</groupId>
            <artifactId>inputbeans</artifactId>
            <version>0.01</version>
        </dependency>           
        <dependency>
            <groupId>com.thinkaurelius.titan</groupId>
            <artifactId>titan-all</artifactId>
            <version>0.3.2</version>
        </dependency>           
    </dependencies>
    <properties>
        <testng.version>6.8.5</testng.version>
        <slf4j.version>1.6.6</slf4j.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>
</project>

4.0.0
ch.uzh.ifi.ddis.dm
2whc
0.0.1-快照
聚甲醛
双向层次聚类
...
2whc集群api
2whc群集impl
2whc集群层次结构impl
2whc建议impl
...
org.slf4j
slf4j api
${slf4j.version}
假如
org.slf4j
slf4j-log4j12
${slf4j.version}
测试
org.testng
testng
${testng.version}
net.sf.sv
超级csv
2.1.0
org.apache.xmlbeans
xmlbeans
2.6.0
net.sf.trove4j
trove4j
3.0.3
org.apache.commons
commons-math3
3.2
ch.uzh.烧结机
输入豆
0.01
com.thinkaurelius.titan
泰坦所有
0.3.2
6.8.5
1.6.6
UTF-8
UTF-8

能否请您为每个项目附加依赖项,可能是mvn dependency:tree-Dverbose的结果。
    private static final String DB_TYPE = "cassandra";
    private static final String DB_IP = "127.0.0.1";
    private TitanSerializer() {
            Configuration conf = new BaseConfiguration();
            conf.setProperty("storage.backend", DB_TYPE);
            conf.setProperty("storage.hostname", DB_IP);
            this.graph = TitanFactory.open(conf);
            .
            .
            .
    }
<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>
    <parent>
        <artifactId>2whc</artifactId>
        <groupId>ch.uzh.ifi.ddis.dm</groupId>
        <version>0.0.1-SNAPSHOT</version>
        <relativePath>..</relativePath>
    </parent>

    <artifactId>2whc-clustering-impl</artifactId>

    ...

    <dependencies>      
        <dependency>
            <groupId>ch.uzh.ifi.ddis.dm</groupId>
            <artifactId>2whc-cluster-hierarchy-impl</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>   
    </dependencies>
</project>
<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>
    <parent>
        <artifactId>2whc</artifactId>
        <groupId>ch.uzh.ifi.ddis.dm</groupId>
        <version>0.0.1-SNAPSHOT</version>
        <relativePath>..</relativePath>
    </parent>

    <artifactId>2whc-cluster-hierarchy-impl</artifactId>

    ...

    <dependencies>

    </dependencies>
</project>
<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>ch.uzh.ifi.ddis.dm</groupId>
    <artifactId>2whc</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>Two-Way Hierarchical Clustering</name>

    ...

    <modules>
        <module>2whc-clustering-api</module>
        <module>2whc-clustering-impl</module>
        <module>2whc-cluster-hierarchy-impl</module>
        <module>2whc-recommendations-impl</module>
    </modules>

    ...

    <dependencies>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${slf4j.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>${testng.version}</version>
        </dependency>
        <dependency>
            <groupId>net.sf.supercsv</groupId>
            <artifactId>super-csv</artifactId>
            <version>2.1.0</version>
        </dependency>    
        <dependency>
            <groupId>org.apache.xmlbeans</groupId>
            <artifactId>xmlbeans</artifactId>
            <version>2.6.0</version>
        </dependency>    
        <dependency>
            <groupId>net.sf.trove4j</groupId>
            <artifactId>trove4j</artifactId>
            <version>3.0.3</version>
        </dependency>    
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-math3</artifactId>
            <version>3.2</version>
        </dependency>           
        <dependency>
            <groupId>ch.uzh.agglorecommender</groupId>
            <artifactId>inputbeans</artifactId>
            <version>0.01</version>
        </dependency>           
        <dependency>
            <groupId>com.thinkaurelius.titan</groupId>
            <artifactId>titan-all</artifactId>
            <version>0.3.2</version>
        </dependency>           
    </dependencies>
    <properties>
        <testng.version>6.8.5</testng.version>
        <slf4j.version>1.6.6</slf4j.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>
</project>