2016-04-13 3 views
0

Mavenを使用していくつかの依存関係(特にOrientDbとBouncy Castle)を含むide intellijでJavaアプリケーションを作成しました。OrientDBをIntelliJで実行可能にする

アプリケーションはideでうまく動作していますが、別のコンピュータでsshを使用して実行する必要があります。 Maven Assembly Plugin(http://maven.apache.org/plugins/maven-assembly-plugin/usage.html)を使用して、実行可能なjarを作成しました。 しかし、私はそれを実行したときに、私はこのエラーを取得:

$ 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 

私はこの問題を解決するために何ができますか?私は他のビルドソリューションにもオープンしていますが、Java/Mavenにはあまり経験がありません。

<?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:@ wolf4oodよう

は、私がいることを置く

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

私はこのPOMとMavenのシェードプラグインを使用してみまし提案

は、これは私のpom.xmlファイルでありますこのエラーを修正するフィルタ:

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

しかし、私は以前よりも正確に同じエラーを取得しています:

$ 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 

答えて

1

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

jarファイルを構築するためのMavenシェードプラグインを使用して、リソースの変圧器を使用する必要があります。

実際には、orientdb-coreパッケージだけが必要で、すべてのorientdb-graphパッケージが必要なわけではありません。依存関係の変更を

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

に変更すると、奇妙な例外が表示されなくなりました。

0

問題はMETA-INF/servicesにJAVAサービスです。実行可能ファイルにはマージされません。したがって、一部のエグゼキュータは正しく登録されていません。あなたは、私は私の問題の解決策を見つけた

+0

こんにちは、私はあなたの提案を試みましたが、私はまだ同じ問題を抱えています。私のアップデートをチェックできますか?ありがとう! –

関連する問題