We want to import data on a Linux system. So we have 2 Java files for the 
import. One (*OrientDBMain.java*) is for creating an object that is doing 
all the work. The other (*OrientDB.java*) contains all the database 
functions like setting an index and so on. The second files starts with:
 
   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();
        }
    ...

Running this in Eclipse on a Windows and MAC works well. No error and data 
is correctly imported. 

But now we wanted to run this on our Linux system. So we setup a Maven 
project (m2e) and exported a Jar file with all the dependencies here:

  
  <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>



But if we run that Jar now we are getting some errors. They say that there 
is some OCommandExecutorNotFoundException thrown. But how can that be if it 
run great directly in Eclipse? We have 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

So the question is right now. Why does it throw that error and why does it 
work properly in Eclipse. And maybe do you know other way to compile import 
scripts for OrientDB in an easy way with less effort.

Thank you. 

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to orient-database+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to