Linux 시스템에서 데이터를 가져 오려합니다. 따라서 우리는 가져 오기에 2 개의 Java 파일을 가지고 있습니다. One (OrientDBMain.java)은 모든 작업을 수행하는 오브젝트를 작성하기위한 것입니다. 다른 하나 (OrientDB.java)에는 색인 설정과 같은 모든 데이터베이스 기능이 포함되어 있습니다. 잘 작동윈도우 및 MAC에 이클립스에서 실행OCommandExecutorNotFoundException jar 파일을 통해 OrientDB 데이터베이스 생성
public class OrientDB {
private OrientGraphFactory factoryGraph;
private ODatabaseDocumentTx db;
private String csvPath;
@SuppressWarnings("resource")
public OrientDB(String dbPath) {
OGlobalConfiguration.STORAGE_KEEP_OPEN.setValue(true);
OGlobalConfiguration.ENVIRONMENT_CONCURRENT.setValue(false);
db = new ODatabaseDocumentTx(dbPath).create();
}
...
이 : 두 번째 파일이 시작됩니다. 오류 및 데이터를 제대로 가져 오지 않았습니다.
하지만 지금 우리는 리눅스 시스템에서 이것을 실행하고 싶습니다. 그래서 우리를 셋업 메이븐 프로젝트 (m2e)와 여기에 모든 종속 JAR 파일 내보내기 :
<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>mapegy</groupId>
<artifactId>orientdbcsv</artifactId>
<version>0.0.2-SNAPSHOT</version>
<packaging>jar</packaging>
<name>orientdbcsv</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.orientechnologies</groupId>
<artifactId>orientdb-graphdb</artifactId>
<version>2.0-M1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>mapegy.orientdbcsv.OrientDBMain</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
을하지만 우리는 그 항아리를 실행하면 지금 우리는 약간의 오차가지고있다. OCommandExecutorNotFoundException이 발생했습니다. 그러나 Eclipse에서 직접 실행하면 어떻게 될 수 있습니까? 우리는 2 개의 args {pathtoimportdata, pathtodestinationdb}를 가지고 있습니다.
C:\eclipse-workspace\orientdbcsv\target>java -jar orientdbcsv-0.0.2-SNAPSHOT-jar
-with-dependencies.jar "C:\data" "C:\orientdb-community-2.0-M1\databases\test"
Exception in thread "main" com.orientechnologies.orient.core.exception.ODatabase
Exception: Cannot create database
at com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.c
reate(ODatabaseRecordAbstract.java:289)
at com.orientechnologies.orient.core.db.ODatabaseWrapperAbstract.create(
ODatabaseWrapperAbstract.java:61)
at com.orientechnologies.orient.core.db.ODatabaseRecordWrapperAbstract.c
reate(ODatabaseRecordWrapperAbstract.java:72)
at com.orientechnologies.orient.core.db.ODatabaseWrapperAbstract.create(
ODatabaseWrapperAbstract.java:56)
at com.orientechnologies.orient.core.db.ODatabaseRecordWrapperAbstract.c
reate(ODatabaseRecordWrapperAbstract.java:66)
at mapegy.orientdbcsv.OrientDB.<init>(OrientDB.java:36)
at mapegy.orientdbcsv.OrientDBMain.main(OrientDBMain.java:6)
Caused by: com.orientechnologies.orient.core.command.OCommandExecutorNotFoundExc
eption: Cannot find a command executor for the command request: sql.select count
(*) from ORole where name.type() not in ["STRING"] and name is not null
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.par
se(OCommandExecutorSQLDelegate.java:48)
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.par
se(OCommandExecutorSQLDelegate.java:33)
at com.orientechnologies.orient.core.storage.OStorageEmbedded.command(OS
torageEmbedded.java:69)
at com.orientechnologies.orient.core.command.OCommandRequestTextAbstract
.execute(OCommandRequestTextAbstract.java:59)
at com.orientechnologies.orient.core.metadata.schema.OClassImpl.checkPer
sistentPropertyType(OClassImpl.java:1597)
at com.orientechnologies.orient.core.metadata.schema.OClassImpl.addPrope
rty(OClassImpl.java:1911)
at com.orientechnologies.orient.core.metadata.schema.OClassImpl.createPr
operty(OClassImpl.java:580)
at com.orientechnologies.orient.core.metadata.security.OSecurityShared.c
reateMetadata(OSecurityShared.java:350)
at com.orientechnologies.orient.core.metadata.security.OSecurityShared.c
reate(OSecurityShared.java:282)
at com.orientechnologies.orient.core.metadata.security.OSecurityProxy.cr
eate(OSecurityProxy.java:70)
at com.orientechnologies.orient.core.metadata.OMetadataDefault.create(OM
etadataDefault.java:84)
at com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.c
reate(ODatabaseRecordAbstract.java:269)
... 6 more
그래서 지금 당장 의문입니다. 왜 그 오류를 던지며 Eclipse에서 제대로 작동하지 않는 이유는 무엇입니까? OrientDB 용 가져 오기 스크립트를 적은 노력으로 손쉽게 컴파일 할 수있는 다른 방법을 알고 계신 것 같습니다.
감사합니다.
나는 Fran에게이 사실을 설명하는 이메일을 보냈습니다 ... 내일 아침에 그와 확인하십시오! 만나서 반갑습니다. –
제 친구도 고맙습니다. 지금 당장 시도 할거야. 다른 건 잠들 수 없어. =) – kwoxer
Fran는 지금도 노력 중입니다. –