java.lang.IllegalArgumentException - 'other' 具有不同的根

标签 java eclipse illegalargumentexception vert.x

我正在使用 Vertx 编写一个 java 应用程序。我正在尝试使用以下代码部署我的模块之一。但我面临着 IllegalArgumentException,我无法解决。

我的主课的一部分:

System.out.println(System.getProperty("user.dir")
                + File.separator + "modules" + File.separator
                + "agents-0.0.1-SNAPSHOT-mod.zip");
        InputStream agf = new FileInputStream(System.getProperty("user.dir")
                + File.separator + "conf" + File.separator
                + "dbproperties1.json");
            String json = IOUtils.toString( agf );
            LOGGER.debug("db json:::"+json);
        JsonObject configprop =  new JsonObject(json);
        pm.deployModuleFromZip(System.getProperty("user.dir")
                + File.separator + "modules" + File.separator
                + "agents-0.0.1-SNAPSHOT-mod.zip", configprop, 1,
                new AsyncResultHandler<String>() {
                    public void handle(AsyncResult<String> asyncResult) {
                        LOGGER.debug("Deployment agnet ID dddd");
                        if (asyncResult.succeeded()) {
                            LOGGER.debug("Deployment agnet ID is "
                                    + asyncResult.result());
                        } else {
                            LOGGER.debug("Deployment agnet  ID is null "
                                    + asyncResult.result());
                            asyncResult.cause().printStackTrace();
                        }
                    }
                }); 
        agf.close();

控制台报错如下:

java.lang.IllegalArgumentException: 'other' has different root
    at sun.nio.fs.WindowsPath.relativize(WindowsPath.java:392)
    at sun.nio.fs.WindowsPath.relativize(WindowsPath.java:44)
    at org.vertx.java.platform.impl.DefaultPlatformManager.setPathResolver(DefaultPlatformManager.java:1128)
    at org.vertx.java.platform.impl.DefaultPlatformManager.access$2000(DefaultPlatformManager.java:55)
    at org.vertx.java.platform.impl.DefaultPlatformManager$18.run(DefaultPlatformManager.java:1276)
    at org.vertx.java.core.impl.DefaultContext$3.run(DefaultContext.java:171)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:353)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:366)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
    at java.lang.Thread.run(Thread.java:745)

在这方面的任何帮助将不胜感激。

最佳答案

我找到了适合我的案例的解决方案。

对于vertx项目,项目中会有mod.json文件。它应该具有以下 json。

{
  "main": "com.company.agent.Manager",
  "preserve-cwd": true
}

"preserve-cwd": true 有帮助。

关于java.lang.IllegalArgumentException - 'other' 具有不同的根,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29604972/

相关文章:

eclipse - JUnit + Maven + Eclipse : Why @BeforeClass does not work?

android - 方向更改时找不到 id 的 View IllegalArgumentException :?

java - 比较方法违反了它的一般契约 - 如何避免它

java - 了解多态性

java.lang.ClassFormat错误: when trying to mock HttpServletRequest using Mockito

java - 当单击我的按钮时,应用程序停止并在 android java 中出现错误

android - : java. lang.IllegalArgumentException 多个 fragment 引起

java - 为什么 Spring Data 存储库方法参数名称在 Java 8 上也不可用?

java - 将 Eclipse 项目导出到 Runnable Jar 不起作用

java - 我如何在eclipse中写入文件?