首页 > 解决方案 > Java java.lang.ClassNotFoundException:jade.core.migration.InterPlatformMobilityService

问题描述

我正在尝试解决java.lang.ClassNotFoundException:jade.core.migration.InterPlatformMobilityService,当我为“Inter”平台移动性安装添加包时,在JADE(Java 代理开发框架)InterPlatformMobilityService中发生,它有一个名为“migration.jar”的 JAR,其中包含类。我需要这个额外的 JAR,在不同的计算机上发送代理(代码和数据)。

这是显示错误的输出:

INFO: Service jade.core.mobility.AgentMobility initialized
Sep 03, 2021 3:38:48 PM jade.core.AgentContainerImpl initAdditionalServices
WARNING: Exception initializing service jade.core.migration.InterPlatformMobilityService
jade.core.ServiceException: An error occurred during service activation - Caused by:  jade.core.migration.InterPlatformMobilityService
        at jade.core.AgentContainerImpl.startService(AgentContainerImpl.java:1169)
        at jade.core.AgentContainerImpl.initAdditionalServices(AgentContainerImpl.java:450)
        at jade.core.AgentContainerImpl.startNode(AgentContainerImpl.java:389)
        at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:502)
        at jade.core.Runtime.createMainContainer(Runtime.java:159)
        at abc.def.hgi.Setup.start(Setup.java:47)
        at abc.def.hgi.App.main(App.java:51)
Nested Exception:
java.lang.ClassNotFoundException: jade.core.migration.InterPlatformMobilityService
        at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at jade.core.AgentContainerImpl.startService(AgentContainerImpl.java:1153)
        at jade.core.AgentContainerImpl.initAdditionalServices(AgentContainerImpl.java:450)
        at jade.core.AgentContainerImpl.startNode(AgentContainerImpl.java:389)
        at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:502)
        at jade.core.Runtime.createMainContainer(Runtime.java:159)
        at abc.def.hgi.Setup.start(Setup.java:47)
        at abc.def.hgi.App.main(App.java:51)

我的代码是纯 Java 并通过 Maven 构建的,这是我的 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/maven-v4_0_0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>abc.def.ghi</groupId>
      <artifactId>my_edge_ai</artifactId>
      <packaging>jar</packaging>
      <version>1.0-SNAPSHOT</version>
      <name>my_edge_ai</name>
      <url>http://maven.apache.org</url>
     <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        </properties>
        <repositories>
            <repository> 
                <id>tilab</id> 
                <url>https://jade.tilab.com/maven/</url> 
            </repository>
                <repository>
                    <id>jade-ipms</id>
                    <url>file:${basedir}/add-ons/ipms/lib/migration.jar</url>
                </repository>
                <repository>
                    <id>jade-ipms-harcoded</id>
                    <url></url>
                </repository>
        </repositories>
        <dependencies>
            <dependency>  
                <groupId>com.tilab.jade</groupId> 
                <artifactId>jade</artifactId> 
                <version>4.5.0</version>  
            </dependency>
            <dependency>  
                <groupId>com.tilab.jade</groupId> 
                <artifactId>jade-misc</artifactId> 
                <version>2.8.0</version>  
            </dependency>
            <dependency>  
                <groupId>com.tilab.jade</groupId> 
                <artifactId>jade-test-suite</artifactId> 
                <version>1.13.0</version>  
            </dependency>
            <dependency>  
                <groupId>com.tilab.jade</groupId> 
                <artifactId>jade-wsdc</artifactId> 
                <version>2.7.0</version>  
            </dependency>
    
            <dependency>  
                <groupId>com.tilab.jade</groupId> 
                <artifactId>jade-xml-codec</artifactId> 
                <version>1.11.0</version>  
            </dependency>
        </dependencies>
        <build>
            <plugins>
                <plugin>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>3.1.1</version>
                </plugin>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
            <execution>
                <id>copy-dependencies</id>
                <phase>prepare-package</phase>
                <goals>
                    <goal>copy-dependencies</goal>
                </goals>
                <configuration>
                    <outputDirectory>
                        ${project.build.directory}/libs
                    </outputDirectory>
                </configuration>
            </execution>
        </executions>
    </plugin>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
            <archive>
                <manifest>
                    <addClasspath>true</addClasspath>
                    <classpathPrefix>libs/</classpathPrefix>
                    <mainClass>
                        abc.def.ghi.App
                    </mainClass>
                </manifest>
            </archive>
        </configuration>
    </plugin>
            </plugins>
        </build>
    </project>

根据 JADE 的 ipms (InterPlatformMobilityService) 下载指南,我在我的<my_path>/jade/<extract_here>下提取了“ipmsAddOn-1.5.zp”,与<my_path>/jade/lib所在的级别相同 ,请参阅“ipms”自述文件: https ://jade.tilab.com/doc/tutorials/ipms/README

最后,我通过“mvn clean install”构建了我的项目,成功,输出片段:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  13.753 s
[INFO] Finished at: 2021-09-03T15:22:24-07:00
[INFO] ------------------------------------------------------------------------

我通过以下方式运行我的“jar”:

java -jar ./target/my_edge_ai-1.0-SNAPSHOT.jar 1 main

Java 代码尝试使用InterPlatformMobilityServicevia 初始化 JADE(请参阅代码片段):启动 JADE,但有以下例外:

这引用自(Fabio Belllifemine 等人的 JADE Mobility Services 的使用):

“6.4.2 跨平台移动服务 IPMS 未内置在平台中,必须作为附加组件安装。要安装附加组件,必须将包分发文件解压缩到 JADE 文件夹中,从该文件夹中使用 ant lib 命令创建一个包含所有已编译类文件的 Jar 文件。要使用该服务,必须在命令行中明确指定,不要忘记首先包含 Intra-Platform Mobility Service:”</p>

java jade.Boot -services jade.core.mobility.AgentMobilityService;jade.core.migration. InterPlatformMobilityService

java.lang.ClassNotFoundException在尝试通过 Java 或命令行方法启动 Intra-Platform Mobility Service 时,我得到了同样的结果。

尝试 1(migration.jar 作为 pom.xml 的 repo):

<repositories>
        <repository> 
            <id>tilab</id> 
            <url>https://jade.tilab.com/maven/</url> 
        </repository>
            <repository>
                <id>jade-ipms</id>
                <url>file:${basedir}/add-ons/ipms/lib/migration.jar</url>
            </repository>
            <repository>
                <id>jade-ipms-harcoded</id>
                <url>/root/my/my/jade/jade/add-ons/ipms/lib/migration.jar</url>
            </repository>
    </repositories>

构建项目没有错误,但是得到了与运行时相同的异常:java.lang.ClassNotFoundException: jade.core.migration.InterPlatformMobilityService.

尝试2(我将migration.jar手动复制到我的项目/ lib中):

root@pc-064067:~/my/my/jade/jade/my_edge_ai/my_edge_ai/libs# ls
commons-codec-1.3.jar  jade.jar  migration.jar

同样,构建项目没有错误,但是得到了与运行时相同的异常:java.lang.ClassNotFoundException: jade.core.migration.InterPlatformMobilityService.

尝试#3,我将migration.jar添加到我的系统类路径中:

export CLASSPATH=/root/my/my/jade/jade/my_edge_ai/my_edge_ai/libs/jade.jar:$CLASSPATH
export CLASSPATH=/root/my/my/jade/jade/my_edge_ai/my_edge_ai/libs/commons-codec-1.3.jar:$CLASSPATH
export CLASSPATH=/root/my/my /jade/jade/my_edge_ai/my_edge_ai/libs/migration.jar:$CLASSPATH

java -jar ./target/my-1.0-SNAPSHOT.jar 1 main

同样,构建项目没有错误,但是得到了与运行时相同的异常:java.lang.ClassNotFoundException: jade.core.migration.InterPlatformMobilityService.

我也使用 Java -cp 或 -classpath 标志遇到了同样的错误。

最后,我打开了migration.jar,以检查jade.core.migration.InterPlatformMobilityService 是否真的存在。

尝试 # 4)我做了一些讨厌的事情,我直接在我的 src/main/java 下复制了 migration.jar 中的类,但是又出现了同样的错误!

java.lang.ClassNotFoundException: jade.core.migration.InterPlatformMobilityService.

尝试5:

  1. 根据 StackOverflow 反馈,我在本地安装了 JAR,如下所示:

    mvn install:install-file -Dfile=/home/azureuser/cyz/my/multi_agents/my_edge_ai/JadeDownload/jade/add-ons/ipms/lib/migration.jar -DgroupId=jade.core.migration -DartifactId=InterPlatformMobilityService - Dversion=1.5 -Dpackaging=jar -DJadeAddOnsPath=/home/azureuser/xyz/my/multi_agents/my_edge_ai/JadeDownload/jade/add-ons/ipms/lib/

输出片段:

[INFO] ---------------------< abc.def.hgi:my_edge_ai >---------------------
[INFO] Building my_edge_ai 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ my_edge_ai ---
[INFO] Installing /home/azureuser/xyz/my/multi_agents/my_edge_ai/JadeDownload/jade/add-ons/ipms/lib/migration.jar to /home/azureuser/.m2/repository/jade/core/migration/InterPlatformMobilityService/1.5/InterPlatformMobilityService-1.5.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.893 s
[INFO] Finished at: 2021-09-07T23:50:50Z
[INFO] ------------------------------------------------------------------------
  1. 将此依赖块添加到依赖项部分:
jade.core.migration 迁移 1.5 系统 ${JadeAddOnsPath}/migration.jar
  1. 构建项目:

    sudo mvn clean install -DJadeAddOnsPath=/home/azureuser/xyz/my/multi_agents/my_edge_ai/JadeDownload/jade/add-ons/ipms/lib/

输出片段:

[INFO] --- maven-jar-plugin:3.1.1:jar (default-jar) @ my_edge_ai ---
[INFO] Building jar: /home/azureuser/xyz/my/multi_agents/my_edge_ai/my_edge_ai/target/my_edge_ai-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ my_edge_ai ---
[INFO] Installing /home/azureuser/xyz/my/multi_agents/my_edge_ai/my_edge_ai/target/my_edge_ai-1.0-SNAPSHOT.jar to /root/.m2/repository/abc/def/hgi/my_edge_ai/1.0-SNAPSHOT/my_edge_ai-1.0-SNAPSHOT.jar
[INFO] Installing /home/azureuser/xyz/my/multi_agents/my_edge_ai/my_edge_ai/pom.xml to /root/.m2/repository/abc/def/hgi/my_edge_ai/1.0-SNAPSHOT/my_edge_ai-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.609 s
[INFO] Finished at: 2021-09-07T23:51:57Z
[INFO] ------------------------------------------------------------------------

但是同样的错误:

WARNING: Exception initializing service jade.core.migration.InterPlatformMobilityService
jade.core.ServiceException: An error occurred during service activation - Caused by:  jade.core.migration.InterPlatformMobilityService
        at jade.core.AgentContainerImpl.startService(AgentContainerImpl.java:1169)
        at jade.core.AgentContainerImpl.initAdditionalServices(AgentContainerImpl.java:450)
        at jade.core.AgentContainerImpl.startNode(AgentContainerImpl.java:389)
        at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:502)
        at jade.core.Runtime.createMainContainer(Runtime.java:159)
        at abc.def.hgi.Setup.start(Setup.java:68)
        at abc.def.hgi.App.main(App.java:55)
Nested Exception:
java.lang.ClassNotFoundException: jade.core.migration.InterPlatformMobilityService
        at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at jade.core.AgentContainerImpl.startService(AgentContainerImpl.java:1153)
        at jade.core.AgentContainerImpl.initAdditionalServices(AgentContainerImpl.java:450)
        at jade.core.AgentContainerImpl.startNode(AgentContainerImpl.java:389)
        at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:502)
        at jade.core.Runtime.createMainContainer(Runtime.java:159)
        at abc.def.hgi.Setup.start(Setup.java:68)
        at abc.def.hgi.App.main(App.java:55)

尝试 #6(使用 jar -,基于 stackoverflow 反馈):

在atual JAR 中搜索jade.core.migration.InterPlatformMobilityService,因此必须在jade/core/migration/InterPlatformMobilityService 下,请参见粗体部分。

jar -tvf ./add-ons/ipms/lib/migration.jar 

输出片段:

0 Tue May 23 16:26:46 PDT 2017 META-INF/
   103 Tue May 23 16:26:44 PDT 2017 META-INF/MANIFEST.MF
     0 Tue May 23 16:26:44 PDT 2017 jade/
     0 Tue May 23 16:26:44 PDT 2017 jade/core/
     0 Tue May 23 16:26:46 PDT 2017 jade/core/migration/
     0 Tue May 23 16:26:46 PDT 2017 jade/core/migration/analysis/
     0 Tue May 23 16:26:46 PDT 2017 jade/core/migration/code/
     0 Tue May 23 16:26:46 PDT 2017 jade/core/migration/ontology/
     0 Tue May 23 16:26:46 PDT 2017 samples/
     0 Tue May 23 16:26:46 PDT 2017 samples/mobilegui/
  2739 Tue May 23 16:26:44 PDT 2017 jade/core/migration/AMSInitiator$PowerupRequest.class
  8881 Tue May 23 16:26:44 PDT 2017 jade/core/migration/AMSInitiator.class
 10918 Tue May 23 16:26:46 PDT 2017 jade/core/migration/AMSResponder.class
  1003 Tue May 23 16:26:46 PDT 2017 jade/core/migration/InterPlatformMobilityHelper.class
  2526 Tue May 23 16:26:46 PDT 2017 jade/core/migration/InterPlatformMobilityProxy.class
   272 Tue May 23 16:26:46 PDT 2017 **jade/core/migration/InterPlatformMobilityService$1.class**
  1687 Tue May 23 16:26:46 PDT 2017 jade/core/migration/InterPlatformMobilityService$CodeLocatorMonitor.class
  6816 Tue May 23 16:26:46 PDT 2017 jade/core/migration/InterPlatformMobilityService$CommandOutgoingFilter.class

I also checked the JAR manually by changing it to zip & jade.core.migration.InterPlatformMobilityService is where its suppose to be:

在此处输入图像描述

root:~/my/my/jade/jade/my_edge_ai/my_edge_ai# jar -tvf ./target/my_edge_ai-1.0-SNAPSHOT.jar   

输出:

401 Wed Sep 08 12:40:46 PDT 2021 META-INF/MANIFEST.MF
     0 Wed Sep 08 12:40:46 PDT 2021 META-INF/
     0 Wed Sep 08 12:40:40 PDT 2021 abc/
     0 Wed Sep 08 12:40:40 PDT 2021 abc/def/
     0 Wed Sep 08 12:40:40 PDT 2021 abc/def/hgi/
     0 Wed Sep 08 12:40:40 PDT 2021 abc/def/hgi/yellowpages/
     0 Wed Sep 08 12:40:46 PDT 2021 META-INF/maven/
     0 Wed Sep 08 12:40:46 PDT 2021 META-INF/maven/abc.def.hgi/
     0 Wed Sep 08 12:40:46 PDT 2021 META-INF/maven/abc.def.hgi/my_edge_ai/
  1045 Wed Sep 08 12:40:40 PDT 2021 abc/def/hgi/App.class
  3438 Wed Sep 08 12:40:40 PDT 2021 abc/def/hgi/ManagerAgent.class
  2164 Wed Sep 08 12:40:40 PDT 2021 abc/def/hgi/SearchForAudioAgent$1.class
  3993 Wed Sep 08 12:40:40 PDT 2021 abc/def/hgi/SearchForAudioAgent.class
  2228 Wed Sep 08 12:40:40 PDT 2021 abc/def/hgi/SearchForBiometricAgent$1.class
  3024 Wed Sep 08 12:40:40 PDT 2021 abc/def/hgi/SearchForBiometricAgent.class
  3316 Wed Sep 08 12:40:40 PDT 2021 abc/def/hgi/SearchForImageAnalysisAgent.class
  1094 Wed Sep 08 12:40:40 PDT 2021 abc/def/hgi/TestAgent$1.class
  3555 Tue Sep 07 15:44:40 PDT 2021 META-INF/maven/abc.def.hgi/my_edge_ai/pom.xml
  2703 Wed Sep 08 12:40:40 PDT 2021 abc/def/hgi/AudioAnalysisRegisterAgent$InaCyclicBehavior.class
  2264 Wed Sep 08 12:40:40 PDT 2021 abc/def/hgi/SearchForImageAnalysisAgent$1.class
  2669 Wed Sep 08 12:40:40 PDT 2021 abc/def/hgi/Setup.class
  1406 Wed Sep 08 12:40:40 PDT 2021 abc/def/hgi/TestAgent.class
    98 Wed Sep 08 12:40:46 PDT 2021 META-INF/maven/abc.def.hgi/my_edge_ai/pom.properties
  4507 Wed Sep 08 12:40:40 PDT 2021 abc/def/hgi/AudioAnalysisRegisterAgent.class
  2313 Wed Sep 08 12:40:40 PDT 2021 abc/def/hgi/yellowpages/DFRegisterAgent.class
  2667 Wed Sep 08 12:40:40 PDT 2021 abc/def/hgi/yellowpages/DFSubscribeAgent$1.class
  2827 Wed Sep 08 12:40:40 PDT 2021 abc/def/hgi/BiometricsRegisterAgent.class
  2755 Wed Sep 08 12:40:40 PDT 2021 abc/def/hgi/yellowpages/DFSearchAgent.class
  1870 Wed Sep 08 12:40:40 PDT 2021 abc/def/hgi/yellowpages/DFSubscribeAgent.class
   284 Wed Sep 08 12:40:40 PDT 2021 abc/def/hgi/HelloAgent.class
   275 Wed Sep 08 12:40:40 PDT 2021 abc/def/hgi/HiAgent.class
  1891 Wed Sep 08 12:40:40 PDT 2021 abc/def/hgi/ManagerAgent$1.class
  2481 Wed Sep 08 12:40:40 PDT 2021 abc/def/hgi/yellowpages/SubDF.class
  2836 Wed Sep 08 12:40:40 PDT 2021 abc/def/hgi/ImageAnalyisRegisterAgent.class

进一步调查:

项目构建的 MANIFEST.MF jar(./target/my-1.0-SNAPSHOT.jar):

Manifest-Version: 1.0
Built-By: root
Class-Path: libs/jade-4.5.0.jar libs/commons-codec-1.3.jar libs/jade-m
 isc-2.8.0.jar libs/jade-test-suite-1.13.0.jar libs/jade-wsdc-2.7.0.ja
 r libs/axis-plus-1.4.0.jar libs/addressing-1.1.1.jar libs/wss4j-1.5.1
 .jar libs/xmlsec-1.3.0.jar libs/jade-xml-codec-1.11.0.jar
Created-By: Apache Maven 3.6.3
Build-Jdk: 1.8.0_292
Main-Class: abc.def.ghi.App

尝试#7(问题仅​​在本地机器上解决):

  1. 我决定构建一个“胖 JAR”,其中包含JAR 本身内的所有库( http://tutorials.jenkov.com/maven/maven-build-fat-jar.html )。

  2. 我通过添加这个胖 JAR 插件更新了 pom.xml:

    org.apache.maven.plugins maven-assembly-plugin 3.1.1
                 <configuration>
                     <descriptorRefs>
                         <descriptorRef>jar-with-dependencies</descriptorRef>
                     </descriptorRefs>
                     <archive>
                         <manifest>
                             <addClasspath>true</addClasspath>
                             <classpathPrefix>libs/</classpathPrefix>
                             <mainClass>abc.def.ghi.App</mainClass>
                         </manifest>
                     </archive>
                 </configuration>
                 <executions>
                     <execution>
                         <id>make-assembly</id>
                         <phase>package</phase>
                         <goals>
                             <goal>single</goal>
                         </goals>
                     </execution>
                 </executions>
             </plugin>
    
  3. 进一步修复了不正确的 pom.xml artifactId,基于 (~/.m2/repository/jade/core/migration/InterPlatformMobilityService/1.5/InterPlatformMobilityService-1.5.pom) 中的 artifactID

    jam.core.migration InterPlatformMobilityService 1.5 系统 ${JadeAddOnsPath}/migration.jar

4)最终命令是:

mvn install:install-file -Dfile=/root/my/,y/jade/jade/add-ons/ipms/lib/migration.jar -DgroupId=jade.core.migration -DartifactId=InterPlatformMobilityService -Dversion=1.5 -Dpackaging =罐子

输出片段:

[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ carna_edge_ai ---
[INFO] Installing /root/my/my/jade/jade/add-ons/ipms/lib/migration.jar to /root/.m2/repository/jade/core/migration/InterPlatformMobilityService/1.5/InterPlatformMobilityService-1.5.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.409 s
[INFO] Finished at: 2021-09-09T14:42:31-07:00
[INFO] ------------------------------------------------------------------------

然后构建 & 打包 JAR:

sudo mvn clean package -DJadeAddOnsPath=/home/azureuser/xyz/my/multi_agents/my_edge_ai/JadeDownload/jade/add-ons/ipms/lib/

输出片段:

[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ my_edge_ai ---
[INFO] Building jar: /root/my/my/jade/jade/my_edge_ai/my_edge_ai/target/my_edge_ai-1.0-SNAPSHOT.jar
[INFO] 
[INFO] --- maven-assembly-plugin:3.1.1:single (make-assembly) @ my_edge_ai ---
[INFO] Building jar: /root/my/my/jade/jade/my_edge_ai/my_edge_ai/target/my_edge_ai-1.0-SNAPSHOT-jar-with-dependencies.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  24.332 s
[INFO] Finished at: 2021-09-09T14:55:00-07:00
[INFO] ------------------------------------------------------------------------

最终运行:

 java -jar ./target/my_edge_ai-1.0-SNAPSHOT-jar-with-dependencies.jar 1 main

程序启动时没有错误或异常。

但是,在 azure Ubuntu 服务器和三重检查路径上重复相同的确切步骤,再次产生:

java.lang.ClassNotFoundException:jade.core.migration.InterPlatformMobilityService

我什至尝试使用 -classpath 标志运行 jar:

sudo java -classpath "/home/azureuser/xyz/my/multi_agents/my_edge_ai/JadeDownload/jade/lib/jade.jar;/home/azureuser/xyz/my/multi_agents/my_edge_ai/JadeDownload/jade/lib/commons-codec /commons-codec-1.3.jar;/home/azureuser/xyz/my/multi_agents/my_edge_ai/JadeDownload/jade/add-ons/ipms/lib/migration.jar" -jar ./target/my_edge_ai-1.0-SNAPSHOT- jar-with-dependencies.jar 1 主要

但是再次(现在仅在远程):

java.lang.ClassNotFoundException:jade.core.migration.InterPlatformMobilityService

吸烟枪!最后我检查了fat JAR的内容,maven在远程Ubuntu上构建的fat JAR中不包括jade.core.migration.InterPlatformMobilityService,但在本地Ubuntu上包含它。

解决了:

在远程 pom.xml 中,我更改了 InterPlatformMobilityService 依赖项以使用 maven 本地 repo 而不是指向实际文件:

jade.core.migration InterPlatformMobilityService 1.5 系统 ${JadeAddOnsPath}/migration.jar -->

感谢社区的支持和反馈!

还有更多解决方案吗?

想法?

赞赏

标签: javamaven

解决方案


解决了:

在远程 pom.xml 中,我更改了 InterPlatformMobilityService 依赖项以使用 maven 本地 repo 而不是指向实际文件:

jade.core.migration InterPlatformMobilityService 1.5 系统 ${JadeAddOnsPath}/migration.jar --> 感谢社区支持和反馈!


推荐阅读