2016-04-13 6 views
0

Ich machte eine Java-Anwendung mit dem ide intellij einschließlich mehrerer Abhängigkeiten (insbesondere OrientDb und Bouncy Castle) mit Maven.OrientDB ausführbares jar mit IntelliJ machen

Die Anwendung funktioniert gut mit der IDE, aber ich muss es in einem anderen Computer mit SSH ausführen. Also mit Maven Assembly Plugin (http://maven.apache.org/plugins/maven-assembly-plugin/usage.html) habe ich eine ausführbare jar. Aber , wenn ich es laufen lasse, bekomme ich diese Fehlermeldung:

$ java -jar 1-1.0-SNAPSHOT-jar-with-dependencies.jar 
apr 13, 2016 5:55:28 PM com.orientechnologies.common.log.OLogManager log 
INFORMAZIONI: OrientDB auto-config DISKCACHE=4.075MB (heap=1.751MB os=7.874MB disk=39.975MB) 
Exception in thread "main" com.orientechnologies.common.exception.OException: Error on creation of shared resource 
    at com.orientechnologies.common.concur.resource.OSharedContainerImpl.getResource(OSharedContainerImpl.java:66) 
    at com.orientechnologies.orient.core.storage.OStorageAbstract.getResource(OStorageAbstract.java:143) 
    at com.orientechnologies.orient.core.metadata.OMetadataDefault.init(OMetadataDefault.java:196) 
    at com.orientechnologies.orient.core.metadata.OMetadataDefault.load(OMetadataDefault.java:76) 
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.initAtFirstOpen(ODatabaseDocumentTx.java:2901) 
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.open(ODatabaseDocumentTx.java:259) 
    at bcvis.Main.main(Main.java:26) 
Caused by: com.orientechnologies.orient.core.command.OCommandExecutorNotFoundException: Cannot find a command executor for the command request: sql.select from OFunction order by name 
    at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.parse(OCommandExecutorSQLDelegate.java:72) 
    at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.parse(OCommandExecutorSQLDelegate.java:42) 
    at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.command(OAbstractPaginatedStorage.java:1400) 
    at com.orientechnologies.orient.core.sql.query.OSQLQuery.run(OSQLQuery.java:72) 
    at com.orientechnologies.orient.core.sql.query.OSQLSynchQuery.run(OSQLSynchQuery.java:85) 
    at com.orientechnologies.orient.core.query.OQueryAbstract.execute(OQueryAbstract.java:33) 
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.query(ODatabaseDocumentTx.java:714) 
    at com.orientechnologies.orient.core.metadata.function.OFunctionLibraryImpl.load(OFunctionLibraryImpl.java:65) 
    at com.orientechnologies.orient.core.metadata.OMetadataDefault$4.call(OMetadataDefault.java:201) 
    at com.orientechnologies.orient.core.metadata.OMetadataDefault$4.call(OMetadataDefault.java:197) 
    at com.orientechnologies.common.concur.resource.OSharedContainerImpl.getResource(OSharedContainerImpl.java:64) 
    ... 6 more 

Was kann ich tun, um dieses Problem zu lösen? Ich bin auch offen für andere Build-Lösungen, aber ich bin nicht sehr erfahren mit Java/Maven.

Dies ist meine pom.xml-Datei:

<?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>1</groupId> 
    <artifactId>1</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    <dependencies> 
     <dependency> 
      <groupId>com.orientechnologies</groupId> 
      <artifactId>orientdb-graphdb</artifactId> 
      <version>2.1.15</version> 
     </dependency> 
     <dependency> 
      <groupId>org.bouncycastle</groupId> 
      <artifactId>bcprov-jdk16</artifactId> 
      <version>1.45</version> 
     </dependency> 
    </dependencies> 
    <build> 
    <plugins> 
    <plugin> 
     <artifactId>maven-assembly-plugin</artifactId> 
     <version>2.6</version> 
     <configuration> 
      <descriptorRefs> 
       <descriptorRef>jar-with-dependencies</descriptorRef> 
      </descriptorRefs> 
      <archive> 
       <manifest> 
        <mainClass>bcvis.Main</mainClass> 
       </manifest> 
      </archive> 
     </configuration> 
     <executions> 
      <execution> 
       <id>make-assembly</id> <!-- this is used for inheritance merges --> 
       <phase>package</phase> <!-- bind to the packaging phase --> 
       <goals> 
        <goal>single</goal> 
       </goals> 
      </execution> 
     </executions> 
    </plugin> 

     </plugins> 
    </build> 
</project> 

EDIT:

Wie @ wolf4ood schlug ich Maven Schatten Plugin mit diesem POM

<?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>1</groupId> 
    <artifactId>1</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    <dependencies> 
     <dependency> 
      <groupId>com.orientechnologies</groupId> 
      <artifactId>orientdb-graphdb</artifactId> 
      <version>2.1.15</version> 
     </dependency> 
     <dependency> 
      <groupId>org.bouncycastle</groupId> 
      <artifactId>bcprov-jdk16</artifactId> 
      <version>1.45</version> 
     </dependency> 
    </dependencies> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-shade-plugin</artifactId> 
       <version>2.4.3</version> 
       <executions> 
        <execution> 
         <phase>package</phase> 
         <goals> 
          <goal>shade</goal> 
         </goals> 
         <configuration> 
          <filters> 
           <filter> 
            <artifact>*:*</artifact> 
            <excludes> 
             <exclude>META-INF/*.SF</exclude> 
             <exclude>META-INF/*.DSA</exclude> 
             <exclude>META-INF/*.RSA</exclude> 
            </excludes> 
           </filter> 
          </filters> 

          <transformers> 
           <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer"/> 

           <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> 
            <mainClass>bcvis.Main</mainClass> 
           </transformer> 


          </transformers> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
     </plugins> 
    </build> 

</project> 

Ich habe versucht, mit, dass Filter, um diesen Fehler zu beheben:

Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes 

Aber ich bin immer genau die gleichen Fehler als zuvor:

$ java -jar 1-1.0-SNAPSHOT.jar 
apr 13, 2016 9:59:16 PM com.orientechnologies.common.log.OLogManager log 
INFORMAZIONI: OrientDB auto-config DISKCACHE=4.075MB (heap=1.751MB os=7.874MB disk=40.019MB) 
Exception in thread "main" com.orientechnologies.common.exception.OException: Error on creation of shared resource 
    at com.orientechnologies.common.concur.resource.OSharedContainerImpl.getResource(OSharedContainerImpl.java:66) 
    at com.orientechnologies.orient.core.storage.OStorageAbstract.getResource(OStorageAbstract.java:143) 
    at com.orientechnologies.orient.core.metadata.OMetadataDefault.init(OMetadataDefault.java:196) 
    at com.orientechnologies.orient.core.metadata.OMetadataDefault.load(OMetadataDefault.java:76) 
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.initAtFirstOpen(ODatabaseDocumentTx.java:2901) 
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.open(ODatabaseDocumentTx.java:259) 
    at bcvis.Main.main(Main.java:26) 
Caused by: com.orientechnologies.orient.core.command.OCommandExecutorNotFoundException: Cannot find a command executor for the command request: sql.select from OFunction order by name 
    at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.parse(OCommandExecutorSQLDelegate.java:72) 
    at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.parse(OCommandExecutorSQLDelegate.java:42) 
    at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.command(OAbstractPaginatedStorage.java:1400) 
    at com.orientechnologies.orient.core.sql.query.OSQLQuery.run(OSQLQuery.java:72) 
    at com.orientechnologies.orient.core.sql.query.OSQLSynchQuery.run(OSQLSynchQuery.java:85) 
    at com.orientechnologies.orient.core.query.OQueryAbstract.execute(OQueryAbstract.java:33) 
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.query(ODatabaseDocumentTx.java:714) 
    at com.orientechnologies.orient.core.metadata.function.OFunctionLibraryImpl.load(OFunctionLibraryImpl.java:65) 
    at com.orientechnologies.orient.core.metadata.OMetadataDefault$4.call(OMetadataDefault.java:201) 
    at com.orientechnologies.orient.core.metadata.OMetadataDefault$4.call(OMetadataDefault.java:197) 
    at com.orientechnologies.common.concur.resource.OSharedContainerImpl.getResource(OSharedContainerImpl.java:64) 
    ... 6 more 

Antwort

1

ich die Lösung für mein Problem gefunden verwenden.

Tatsache ist, dass ich nur das Paket orientdb-core nicht alle orientdb-Grafik benötigt. Ändern der maven Abhängigkeit zu

<dependency> 
      <groupId>com.orientechnologies</groupId> 
      <artifactId>orientdb-core</artifactId> 
      <version>2.1.15</version> 
</dependency> 

machte die seltsame Ausnahme verschwinden!

0

Das Problem ist, JAVA Dienste in META-INF/services. Sie sind nicht in Ihrer ausführbaren Datei zusammengeführt. Einige Executoren sind nicht korrekt registriert. Sie sollten für den Bau des jar Maven Schatten-Plugin verwenden und Ressourcen Transformator

https://maven.apache.org/plugins/maven-shade-plugin/examples/resource-transformers.html

+0

Hallo, ich habe Ihren Vorschlag ausprobiert und ich habe immer noch das gleiche Problem, können Sie mein Update überprüfen? Vielen Dank! –

Verwandte Themen